Skip to content

Commit eca64b3

Browse files
committed
Use removePackageLI instead of removing mPackages
When adding an system app via OTA, trying to remove it from mPackages directly doesn't work. The ContentProviders and other things aren't removed and point to the hidden system app's applicationInfo instead of the updated app. Bug: 6685263 Change-Id: I487cf518e0e3c60fae736e9b974617023a7dee8d
1 parent e9b4b3e commit eca64b3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

services/java/com/android/server/pm/PackageManagerService.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,8 @@ public PackageManagerService(Context context, boolean factoryTest, boolean onlyC
10871087
/*
10881088
* If the package is scanned, it's not erased.
10891089
*/
1090-
if (mPackages.containsKey(ps.name)) {
1090+
final PackageParser.Package scannedPkg = mPackages.get(ps.name);
1091+
if (scannedPkg != null) {
10911092
/*
10921093
* If the system app is both scanned and in the
10931094
* disabled packages list, then it must have been
@@ -1096,7 +1097,9 @@ public PackageManagerService(Context context, boolean factoryTest, boolean onlyC
10961097
* application can be scanned.
10971098
*/
10981099
if (mSettings.isDisabledSystemPackageLPr(ps.name)) {
1099-
mPackages.remove(ps.name);
1100+
Slog.i(TAG, "Expecting better updatd system app for " + ps.name
1101+
+ "; removing system app");
1102+
removePackageLI(scannedPkg, true);
11001103
}
11011104

11021105
continue;
@@ -8626,6 +8629,10 @@ protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
86268629
}
86278630
pw.print(" ["); pw.print(entry.getKey()); pw.println("]:");
86288631
pw.print(" "); pw.println(p.toString());
8632+
if (p.info != null && p.info.applicationInfo != null) {
8633+
final String appInfo = p.info.applicationInfo.toString();
8634+
pw.print(" applicationInfo="); pw.println(appInfo);
8635+
}
86298636
}
86308637
}
86318638

services/java/com/android/server/pm/Settings.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,6 +2459,7 @@ void dumpPackagesLPr(PrintWriter pw, String packageName, DumpState dumpState) {
24592459
pw.print(" nativeLibraryPath="); pw.println(ps.nativeLibraryPathString);
24602460
pw.print(" versionCode="); pw.println(ps.versionCode);
24612461
if (ps.pkg != null) {
2462+
pw.print(" applicationInfo="); pw.println(ps.pkg.applicationInfo.toString());
24622463
pw.print(" flags="); printFlags(pw, ps.pkg.applicationInfo.flags, FLAG_DUMP_SPEC); pw.println();
24632464
pw.print(" versionName="); pw.println(ps.pkg.mVersionName);
24642465
pw.print(" dataDir="); pw.println(ps.pkg.applicationInfo.dataDir);
@@ -2592,6 +2593,10 @@ void dumpPackagesLPr(PrintWriter pw, String packageName, DumpState dumpState) {
25922593
pw.print(" compat name=");
25932594
pw.println(ps.name);
25942595
}
2596+
if (ps.pkg != null && ps.pkg.applicationInfo != null) {
2597+
pw.print(" applicationInfo=");
2598+
pw.println(ps.pkg.applicationInfo.toString());
2599+
}
25952600
pw.print(" userId=");
25962601
pw.println(ps.appId);
25972602
pw.print(" sharedUser=");

0 commit comments

Comments
 (0)