OSDN Git Service

Fix a regression in SettingsProvider
authorSvetoslav Ganov <svetoslavganov@google.com>
Wed, 2 Mar 2016 21:26:40 +0000 (13:26 -0800)
committerSvetoslav Ganov <svetoslavganov@google.com>
Wed, 2 Mar 2016 21:26:43 +0000 (13:26 -0800)
bug24990012

Change-Id: I1631d125df029f559ffc059ffcb73067389184e8

packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java

index 9842e28..a424d55 100644 (file)
@@ -1128,10 +1128,15 @@ public class SettingsProvider extends ContentProvider {
 
     private PackageInfo getCallingPackageInfoOrThrow(int userId) {
         try {
-            return mPackageManager.getPackageInfo(getCallingPackage(), 0, userId);
+            PackageInfo packageInfo = mPackageManager.getPackageInfo(
+                    getCallingPackage(), 0, userId);
+            if (packageInfo != null) {
+                return packageInfo;
+            }
         } catch (RemoteException e) {
-            throw new IllegalStateException("Calling package doesn't exist");
+            /* ignore */
         }
+        throw new IllegalStateException("Calling package doesn't exist");
     }
 
     private int getGroupParentLocked(int userId) {