OSDN Git Service

Using GET_UNINSTALLED_PACKAGES flag when getting packageInfo for a managed profile app
authorSunny Goyal <sunnygoyal@google.com>
Fri, 28 Aug 2015 17:26:48 +0000 (10:26 -0700)
committerSunny Goyal <sunnygoyal@google.com>
Fri, 28 Aug 2015 17:27:41 +0000 (10:27 -0700)
Bug: 23515512
Change-Id: I60678eccd4b60225ff30960f7197d633f72c7659

src/com/android/launcher3/IconCache.java

index ea1c0fd..59ab839 100644 (file)
@@ -616,7 +616,9 @@ public class IconCache {
             // Check the DB first.
             if (!getEntryFromDB(cacheKey, entry, useLowResIcon)) {
                 try {
-                    PackageInfo info = mPackageManager.getPackageInfo(packageName, 0);
+                    int flags = UserHandleCompat.myUserHandle().equals(user) ? 0 :
+                        PackageManager.GET_UNINSTALLED_PACKAGES;
+                    PackageInfo info = mPackageManager.getPackageInfo(packageName, flags);
                     ApplicationInfo appInfo = info.applicationInfo;
                     if (appInfo == null) {
                         throw new NameNotFoundException("ApplicationInfo is null");
@@ -787,7 +789,7 @@ public class IconCache {
     }
 
     private static final class IconDB extends SQLiteOpenHelper {
-        private final static int DB_VERSION = 6;
+        private final static int DB_VERSION = 7;
 
         private final static String TABLE_NAME = "icons";
         private final static String COLUMN_ROWID = "rowid";