Loading src/com/android/launcher3/AllAppsList.java +3 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import java.util.List; /** * Stores the list of all applications for the all apps view. */ class AllAppsList { public class AllAppsList { public static final int DEFAULT_APPLICATIONS_NUMBER = 42; /** The list off all apps. */ Loading Loading @@ -112,8 +112,7 @@ class AllAppsList { final List<AppInfo> data = this.data; for (int i = data.size() - 1; i >= 0; i--) { AppInfo info = data.get(i); final ComponentName component = info.intent.getComponent(); if (info.user.equals(user) && packageName.equals(component.getPackageName())) { if (info.user.equals(user) && packageName.equals(info.componentName.getPackageName())) { removed.add(info); data.remove(i); } Loading @@ -127,7 +126,7 @@ class AllAppsList { final List<AppInfo> data = this.data; for (int i = data.size() - 1; i >= 0; i--) { AppInfo info = data.get(i); if (matcher.matches(info, info.intent.getComponent())) { if (matcher.matches(info, info.componentName)) { info.isDisabled = op.apply(info.isDisabled); modified.add(info); } Loading src/com/android/launcher3/AppInfo.java +0 −20 Original line number Diff line number Diff line Loading @@ -52,11 +52,6 @@ public class AppInfo extends ItemInfo { public ComponentName componentName; static final int DOWNLOADED_FLAG = 1; static final int UPDATED_SYSTEM_APP_FLAG = 2; int flags = 0; /** * {@see ShortcutInfo#isDisabled} */ Loading Loading @@ -88,7 +83,6 @@ public class AppInfo extends ItemInfo { IconCache iconCache, boolean quietModeEnabled) { this.componentName = info.getComponentName(); this.container = ItemInfo.NO_ID; flags = initFlags(info); if (PackageManagerHelper.isAppSuspended(info.getApplicationInfo())) { isDisabled |= ShortcutInfo.FLAG_DISABLED_SUSPENDED; } Loading @@ -101,25 +95,11 @@ public class AppInfo extends ItemInfo { this.user = user; } public static int initFlags(LauncherActivityInfoCompat info) { int appFlags = info.getApplicationInfo().flags; int flags = 0; if ((appFlags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0) { flags |= DOWNLOADED_FLAG; if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) { flags |= UPDATED_SYSTEM_APP_FLAG; } } return flags; } public AppInfo(AppInfo info) { super(info); componentName = info.componentName; title = Utilities.trim(info.title); intent = new Intent(info.intent); flags = info.flags; isDisabled = info.isDisabled; iconBitmap = info.iconBitmap; } Loading src/com/android/launcher3/InstallShortcutReceiver.java +2 −1 Original line number Diff line number Diff line Loading @@ -226,7 +226,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver { String packageName = pendingInfo.getTargetPackage(); if (!TextUtils.isEmpty(packageName)) { UserHandleCompat myUserHandle = UserHandleCompat.myUserHandle(); if (!LauncherModel.isValidPackage(context, packageName, myUserHandle)) { if (!LauncherAppsCompat.getInstance(context) .isPackageEnabledForProfile(packageName, myUserHandle)) { if (DBG) Log.d(TAG, "Ignoring shortcut for absent package: " + pendingInfo.launchIntent); continue; Loading src/com/android/launcher3/LauncherModel.java +9 −64 Original line number Diff line number Diff line Loading @@ -93,7 +93,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.Executor; Loading Loading @@ -145,9 +144,6 @@ public class LauncherModel extends BroadcastReceiver // Entire list of widgets. private final WidgetsModel mBgWidgetsModel; // Maps all launcher activities to the id's of their shortcuts (if they have any). private final MultiHashMap<ComponentKey, String> mBgDeepShortcutMap = new MultiHashMap<>(); private boolean mHasShortcutHostPermission; // Runnable to check if the shortcuts permission has changed. private final Runnable mShortcutPermissionCheckRunnable = new Runnable() { Loading Loading @@ -316,15 +312,7 @@ public class LauncherModel extends BroadcastReceiver ComponentName cn = si.getTargetComponent(); if (si.isPromise() && (cn != null) && packageName.equals(cn.getPackageName())) { if (si.hasStatusFlag(ShortcutInfo.FLAG_AUTOINTALL_ICON)) { // For auto install apps update the icon as well as label. mIconCache.getTitleAndIcon(si, si.promisedIntent, user, si.shouldUseLowResIcon()); } else { // Only update the icon for restored apps. si.updateIcon(mIconCache); } updates.add(si); } } Loading Loading @@ -2647,14 +2635,14 @@ public class LauncherModel extends BroadcastReceiver Log.d(TAG, "loadAndBindDeepShortcuts mDeepShortcutsLoaded=" + mDeepShortcutsLoaded); } if (!mDeepShortcutsLoaded) { mBgDeepShortcutMap.clear(); sBgDataModel.deepShortcutMap.clear(); mHasShortcutHostPermission = mDeepShortcutManager.hasHostPermission(); if (mHasShortcutHostPermission) { for (UserHandleCompat user : mUserManager.getUserProfiles()) { if (mUserManager.isUserUnlocked(user)) { List<ShortcutInfoCompat> shortcuts = mDeepShortcutManager .queryForAllShortcuts(user); updateDeepShortcutMap(null, user, shortcuts); sBgDataModel.updateDeepShortcutMap(null, user, shortcuts); } } } Loading @@ -2678,36 +2666,9 @@ public class LauncherModel extends BroadcastReceiver } } /** * Clear all the shortcuts for the given package, and re-add the new shortcuts. */ private void updateDeepShortcutMap( String packageName, UserHandleCompat user, List<ShortcutInfoCompat> shortcuts) { if (packageName != null) { Iterator<ComponentKey> keysIter = mBgDeepShortcutMap.keySet().iterator(); while (keysIter.hasNext()) { ComponentKey next = keysIter.next(); if (next.componentName.getPackageName().equals(packageName) && next.user.equals(user)) { keysIter.remove(); } } } // Now add the new shortcuts to the map. for (ShortcutInfoCompat shortcut : shortcuts) { boolean shouldShowInContainer = shortcut.isEnabled() && (shortcut.isDeclaredInManifest() || shortcut.isDynamic()); if (shouldShowInContainer) { ComponentKey targetComponent = new ComponentKey(shortcut.getActivity(), shortcut.getUserHandle()); mBgDeepShortcutMap.addToList(targetComponent, shortcut.getId()); } } } public void bindDeepShortcuts() { final MultiHashMap<ComponentKey, String> shortcutMapCopy = mBgDeepShortcutMap.clone(); final MultiHashMap<ComponentKey, String> shortcutMapCopy = sBgDataModel.deepShortcutMap.clone(); Runnable r = new Runnable() { @Override public void run() { Loading Loading @@ -2989,11 +2950,6 @@ public class LauncherModel extends BroadcastReceiver } } // Restore the shortcut. if (appInfo != null) { si.flags = appInfo.flags; } si.intent = si.promisedIntent; si.promisedIntent = null; si.status = ShortcutInfo.DEFAULT; Loading Loading @@ -3221,7 +3177,7 @@ public class LauncherModel extends BroadcastReceiver if (mUpdateIdMap) { // Update the deep shortcut map if the list of ids has changed for an activity. updateDeepShortcutMap(mPackageName, mUser, mShortcuts); sBgDataModel.updateDeepShortcutMap(mPackageName, mUser, mShortcuts); bindDeepShortcuts(); } } Loading Loading @@ -3289,7 +3245,7 @@ public class LauncherModel extends BroadcastReceiver } // Remove shortcut id map for that user Iterator<ComponentKey> keysIter = mBgDeepShortcutMap.keySet().iterator(); Iterator<ComponentKey> keysIter = sBgDataModel.deepShortcutMap.keySet().iterator(); while (keysIter.hasNext()) { if (keysIter.next().user.equals(mUser)) { keysIter.remove(); Loading @@ -3297,7 +3253,8 @@ public class LauncherModel extends BroadcastReceiver } if (isUserUnlocked) { updateDeepShortcutMap(null, mUser, mDeepShortcutManager.queryForAllShortcuts(mUser)); sBgDataModel.updateDeepShortcutMap( null, mUser, mDeepShortcutManager.queryForAllShortcuts(mUser)); } bindDeepShortcuts(); } Loading Loading @@ -3338,15 +3295,6 @@ public class LauncherModel extends BroadcastReceiver return !launcherApps.isPackageEnabledForProfile(packageName, user); } public static boolean isValidPackage(Context context, String packageName, UserHandleCompat user) { if (packageName == null) { return false; } final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context); return launcherApps.isPackageEnabledForProfile(packageName, user); } /** * Make an ShortcutInfo object for a restored application or shortcut item that points * to a package that is not yet installed on the system. Loading Loading @@ -3454,9 +3402,6 @@ public class LauncherModel extends BroadcastReceiver info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; info.user = user; info.contentDescription = mUserManager.getBadgedLabelForUser(info.title, info.user); if (lai != null) { info.flags = AppInfo.initFlags(lai); } return info; } Loading src/com/android/launcher3/LauncherProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -1014,7 +1014,7 @@ public class LauncherProvider extends ContentProvider { public void checkId(String table, ContentValues values) { long id = values.getAsLong(LauncherSettings.BaseLauncherColumns._ID); if (table == WorkspaceScreens.TABLE_NAME) { if (WorkspaceScreens.TABLE_NAME.equals(table)) { mMaxScreenId = Math.max(id, mMaxScreenId); } else { mMaxItemId = Math.max(id, mMaxItemId); Loading Loading
src/com/android/launcher3/AllAppsList.java +3 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,7 @@ import java.util.List; /** * Stores the list of all applications for the all apps view. */ class AllAppsList { public class AllAppsList { public static final int DEFAULT_APPLICATIONS_NUMBER = 42; /** The list off all apps. */ Loading Loading @@ -112,8 +112,7 @@ class AllAppsList { final List<AppInfo> data = this.data; for (int i = data.size() - 1; i >= 0; i--) { AppInfo info = data.get(i); final ComponentName component = info.intent.getComponent(); if (info.user.equals(user) && packageName.equals(component.getPackageName())) { if (info.user.equals(user) && packageName.equals(info.componentName.getPackageName())) { removed.add(info); data.remove(i); } Loading @@ -127,7 +126,7 @@ class AllAppsList { final List<AppInfo> data = this.data; for (int i = data.size() - 1; i >= 0; i--) { AppInfo info = data.get(i); if (matcher.matches(info, info.intent.getComponent())) { if (matcher.matches(info, info.componentName)) { info.isDisabled = op.apply(info.isDisabled); modified.add(info); } Loading
src/com/android/launcher3/AppInfo.java +0 −20 Original line number Diff line number Diff line Loading @@ -52,11 +52,6 @@ public class AppInfo extends ItemInfo { public ComponentName componentName; static final int DOWNLOADED_FLAG = 1; static final int UPDATED_SYSTEM_APP_FLAG = 2; int flags = 0; /** * {@see ShortcutInfo#isDisabled} */ Loading Loading @@ -88,7 +83,6 @@ public class AppInfo extends ItemInfo { IconCache iconCache, boolean quietModeEnabled) { this.componentName = info.getComponentName(); this.container = ItemInfo.NO_ID; flags = initFlags(info); if (PackageManagerHelper.isAppSuspended(info.getApplicationInfo())) { isDisabled |= ShortcutInfo.FLAG_DISABLED_SUSPENDED; } Loading @@ -101,25 +95,11 @@ public class AppInfo extends ItemInfo { this.user = user; } public static int initFlags(LauncherActivityInfoCompat info) { int appFlags = info.getApplicationInfo().flags; int flags = 0; if ((appFlags & android.content.pm.ApplicationInfo.FLAG_SYSTEM) == 0) { flags |= DOWNLOADED_FLAG; if ((appFlags & android.content.pm.ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0) { flags |= UPDATED_SYSTEM_APP_FLAG; } } return flags; } public AppInfo(AppInfo info) { super(info); componentName = info.componentName; title = Utilities.trim(info.title); intent = new Intent(info.intent); flags = info.flags; isDisabled = info.isDisabled; iconBitmap = info.iconBitmap; } Loading
src/com/android/launcher3/InstallShortcutReceiver.java +2 −1 Original line number Diff line number Diff line Loading @@ -226,7 +226,8 @@ public class InstallShortcutReceiver extends BroadcastReceiver { String packageName = pendingInfo.getTargetPackage(); if (!TextUtils.isEmpty(packageName)) { UserHandleCompat myUserHandle = UserHandleCompat.myUserHandle(); if (!LauncherModel.isValidPackage(context, packageName, myUserHandle)) { if (!LauncherAppsCompat.getInstance(context) .isPackageEnabledForProfile(packageName, myUserHandle)) { if (DBG) Log.d(TAG, "Ignoring shortcut for absent package: " + pendingInfo.launchIntent); continue; Loading
src/com/android/launcher3/LauncherModel.java +9 −64 Original line number Diff line number Diff line Loading @@ -93,7 +93,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.Executor; Loading Loading @@ -145,9 +144,6 @@ public class LauncherModel extends BroadcastReceiver // Entire list of widgets. private final WidgetsModel mBgWidgetsModel; // Maps all launcher activities to the id's of their shortcuts (if they have any). private final MultiHashMap<ComponentKey, String> mBgDeepShortcutMap = new MultiHashMap<>(); private boolean mHasShortcutHostPermission; // Runnable to check if the shortcuts permission has changed. private final Runnable mShortcutPermissionCheckRunnable = new Runnable() { Loading Loading @@ -316,15 +312,7 @@ public class LauncherModel extends BroadcastReceiver ComponentName cn = si.getTargetComponent(); if (si.isPromise() && (cn != null) && packageName.equals(cn.getPackageName())) { if (si.hasStatusFlag(ShortcutInfo.FLAG_AUTOINTALL_ICON)) { // For auto install apps update the icon as well as label. mIconCache.getTitleAndIcon(si, si.promisedIntent, user, si.shouldUseLowResIcon()); } else { // Only update the icon for restored apps. si.updateIcon(mIconCache); } updates.add(si); } } Loading Loading @@ -2647,14 +2635,14 @@ public class LauncherModel extends BroadcastReceiver Log.d(TAG, "loadAndBindDeepShortcuts mDeepShortcutsLoaded=" + mDeepShortcutsLoaded); } if (!mDeepShortcutsLoaded) { mBgDeepShortcutMap.clear(); sBgDataModel.deepShortcutMap.clear(); mHasShortcutHostPermission = mDeepShortcutManager.hasHostPermission(); if (mHasShortcutHostPermission) { for (UserHandleCompat user : mUserManager.getUserProfiles()) { if (mUserManager.isUserUnlocked(user)) { List<ShortcutInfoCompat> shortcuts = mDeepShortcutManager .queryForAllShortcuts(user); updateDeepShortcutMap(null, user, shortcuts); sBgDataModel.updateDeepShortcutMap(null, user, shortcuts); } } } Loading @@ -2678,36 +2666,9 @@ public class LauncherModel extends BroadcastReceiver } } /** * Clear all the shortcuts for the given package, and re-add the new shortcuts. */ private void updateDeepShortcutMap( String packageName, UserHandleCompat user, List<ShortcutInfoCompat> shortcuts) { if (packageName != null) { Iterator<ComponentKey> keysIter = mBgDeepShortcutMap.keySet().iterator(); while (keysIter.hasNext()) { ComponentKey next = keysIter.next(); if (next.componentName.getPackageName().equals(packageName) && next.user.equals(user)) { keysIter.remove(); } } } // Now add the new shortcuts to the map. for (ShortcutInfoCompat shortcut : shortcuts) { boolean shouldShowInContainer = shortcut.isEnabled() && (shortcut.isDeclaredInManifest() || shortcut.isDynamic()); if (shouldShowInContainer) { ComponentKey targetComponent = new ComponentKey(shortcut.getActivity(), shortcut.getUserHandle()); mBgDeepShortcutMap.addToList(targetComponent, shortcut.getId()); } } } public void bindDeepShortcuts() { final MultiHashMap<ComponentKey, String> shortcutMapCopy = mBgDeepShortcutMap.clone(); final MultiHashMap<ComponentKey, String> shortcutMapCopy = sBgDataModel.deepShortcutMap.clone(); Runnable r = new Runnable() { @Override public void run() { Loading Loading @@ -2989,11 +2950,6 @@ public class LauncherModel extends BroadcastReceiver } } // Restore the shortcut. if (appInfo != null) { si.flags = appInfo.flags; } si.intent = si.promisedIntent; si.promisedIntent = null; si.status = ShortcutInfo.DEFAULT; Loading Loading @@ -3221,7 +3177,7 @@ public class LauncherModel extends BroadcastReceiver if (mUpdateIdMap) { // Update the deep shortcut map if the list of ids has changed for an activity. updateDeepShortcutMap(mPackageName, mUser, mShortcuts); sBgDataModel.updateDeepShortcutMap(mPackageName, mUser, mShortcuts); bindDeepShortcuts(); } } Loading Loading @@ -3289,7 +3245,7 @@ public class LauncherModel extends BroadcastReceiver } // Remove shortcut id map for that user Iterator<ComponentKey> keysIter = mBgDeepShortcutMap.keySet().iterator(); Iterator<ComponentKey> keysIter = sBgDataModel.deepShortcutMap.keySet().iterator(); while (keysIter.hasNext()) { if (keysIter.next().user.equals(mUser)) { keysIter.remove(); Loading @@ -3297,7 +3253,8 @@ public class LauncherModel extends BroadcastReceiver } if (isUserUnlocked) { updateDeepShortcutMap(null, mUser, mDeepShortcutManager.queryForAllShortcuts(mUser)); sBgDataModel.updateDeepShortcutMap( null, mUser, mDeepShortcutManager.queryForAllShortcuts(mUser)); } bindDeepShortcuts(); } Loading Loading @@ -3338,15 +3295,6 @@ public class LauncherModel extends BroadcastReceiver return !launcherApps.isPackageEnabledForProfile(packageName, user); } public static boolean isValidPackage(Context context, String packageName, UserHandleCompat user) { if (packageName == null) { return false; } final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context); return launcherApps.isPackageEnabledForProfile(packageName, user); } /** * Make an ShortcutInfo object for a restored application or shortcut item that points * to a package that is not yet installed on the system. Loading Loading @@ -3454,9 +3402,6 @@ public class LauncherModel extends BroadcastReceiver info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; info.user = user; info.contentDescription = mUserManager.getBadgedLabelForUser(info.title, info.user); if (lai != null) { info.flags = AppInfo.initFlags(lai); } return info; } Loading
src/com/android/launcher3/LauncherProvider.java +1 −1 Original line number Diff line number Diff line Loading @@ -1014,7 +1014,7 @@ public class LauncherProvider extends ContentProvider { public void checkId(String table, ContentValues values) { long id = values.getAsLong(LauncherSettings.BaseLauncherColumns._ID); if (table == WorkspaceScreens.TABLE_NAME) { if (WorkspaceScreens.TABLE_NAME.equals(table)) { mMaxScreenId = Math.max(id, mMaxScreenId); } else { mMaxItemId = Math.max(id, mMaxItemId); Loading