OSDN Git Service

Skip packages with missing metadata.
authorJeff Sharkey <jsharkey@android.com>
Tue, 3 Sep 2013 19:01:20 +0000 (12:01 -0700)
committerJeff Sharkey <jsharkey@android.com>
Tue, 3 Sep 2013 19:01:20 +0000 (12:01 -0700)
Otherwise this would result in NPE, and packages.list would never
be updated.

Bug: 10577538
Change-Id: I35a4407dbc283ab20a4c45a2ea1a14b04044c98c

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

index ff1128d..415cda1 100644 (file)
@@ -1385,6 +1385,11 @@ final class Settings {
 
                 StringBuilder sb = new StringBuilder();
                 for (final PackageSetting pkg : mPackages.values()) {
+                    if (pkg.pkg == null || pkg.pkg.applicationInfo == null) {
+                        Slog.w(TAG, "Skipping " + pkg + " due to missing metadata");
+                        continue;
+                    }
+
                     final ApplicationInfo ai = pkg.pkg.applicationInfo;
                     final String dataPath = ai.dataDir;
                     final boolean isDebug = (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;