OSDN Git Service

PackageManagerService: fix NPE while renaming foreign dex markers.
authorNarayan Kamath <narayan@google.com>
Tue, 7 Jun 2016 08:31:55 +0000 (09:31 +0100)
committerNarayan Kamath <narayan@google.com>
Thu, 9 Jun 2016 08:24:11 +0000 (08:24 +0000)
The User passed in to scan*LI is null during the initial boot scan
and maybeRenameForeignDexMarkers wasn't expecting it. We attempt to
rename markers for all users if that happens.

bug: 29167406
Change-Id: I892dcc542e75d62d72c062b8ce5506ef85df5fc2

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

index b9d7991..87141b4 100644 (file)
@@ -8613,7 +8613,11 @@ public class PackageManagerService extends IPackageManager.Stub {
             // We don't expect installation to fail beyond this point
 
             if (pkgSetting.pkg != null) {
-                maybeRenameForeignDexMarkers(pkgSetting.pkg, pkg, user);
+                // Note that |user| might be null during the initial boot scan. If a codePath
+                // for an app has changed during a boot scan, it's due to an app update that's
+                // part of the system partition and marker changes must be applied to all users.
+                maybeRenameForeignDexMarkers(pkgSetting.pkg, pkg,
+                    (user != null) ? user : UserHandle.ALL);
             }
 
             // Add the new setting to mSettings