Critical fixes for AndroidPackage migration

Includes a series of fixes for bugs found during development of tests.
Those tests will be included in another CL. For now, merge the critical
fixes to allow devices to work properly.

Test: manual run atest com.android.server.pm.parsing with verify all
Test: atest android.content.pm.PackageParserTest
Test: atest com.android.server.pm.PackageParserTest
Test: atest com.android.server.pm.ScanTests

Change-Id: Ic8eb4b0072150f3841fd07f817060549591d4d91
19 files changed