diff options
Diffstat (limited to 'src')
14 files changed, 66 insertions, 171 deletions
diff --git a/src/com/android/launcher3/AllAppsList.java b/src/com/android/launcher3/AllAppsList.java index 2bf014ad5..9cce9b188 100644 --- a/src/com/android/launcher3/AllAppsList.java +++ b/src/com/android/launcher3/AllAppsList.java @@ -18,9 +18,9 @@ package com.android.launcher3; import android.content.ComponentName; import android.content.Context; +import android.content.pm.LauncherActivityInfo; import android.os.UserHandle; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.util.FlagOp; import com.android.launcher3.util.ItemInfoMatcher; @@ -65,7 +65,7 @@ public class AllAppsList { * * If the app is already in the list, doesn't add it. */ - public void add(AppInfo info, LauncherActivityInfoCompat activityInfo) { + public void add(AppInfo info, LauncherActivityInfo activityInfo) { if (!mAppFilter.shouldShowApp(info.componentName)) { return; } @@ -99,10 +99,10 @@ public class AllAppsList { */ public void addPackage(Context context, String packageName, UserHandle user) { final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context); - final List<LauncherActivityInfoCompat> matches = launcherApps.getActivityList(packageName, + final List<LauncherActivityInfo> matches = launcherApps.getActivityList(packageName, user); - for (LauncherActivityInfoCompat info : matches) { + for (LauncherActivityInfo info : matches) { add(new AppInfo(context, info, user), info); } } @@ -150,7 +150,7 @@ public class AllAppsList { */ public void updatePackage(Context context, String packageName, UserHandle user) { final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context); - final List<LauncherActivityInfoCompat> matches = launcherApps.getActivityList(packageName, + final List<LauncherActivityInfo> matches = launcherApps.getActivityList(packageName, user); if (matches.size() > 0) { // Find disabled/removed activities and remove them from data and add them @@ -168,7 +168,7 @@ public class AllAppsList { // Find enabled activities and add them to the adapter // Also updates existing activities with new labels/icons - for (final LauncherActivityInfoCompat info : matches) { + for (final LauncherActivityInfo info : matches) { AppInfo applicationInfo = findApplicationInfoLocked( info.getComponentName().getPackageName(), user, info.getComponentName().getClassName()); @@ -197,9 +197,9 @@ public class AllAppsList { /** * Returns whether <em>apps</em> contains <em>component</em>. */ - private static boolean findActivity(List<LauncherActivityInfoCompat> apps, + private static boolean findActivity(List<LauncherActivityInfo> apps, ComponentName component) { - for (LauncherActivityInfoCompat info : apps) { + for (LauncherActivityInfo info : apps) { if (info.getComponentName().equals(component)) { return true; } diff --git a/src/com/android/launcher3/AppInfo.java b/src/com/android/launcher3/AppInfo.java index 9b23df391..6bec997a8 100644 --- a/src/com/android/launcher3/AppInfo.java +++ b/src/com/android/launcher3/AppInfo.java @@ -19,10 +19,10 @@ package com.android.launcher3; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.LauncherActivityInfo; import android.os.UserHandle; import android.util.Log; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.PackageManagerHelper; @@ -58,11 +58,11 @@ public class AppInfo extends ItemInfoWithIcon { /** * Must not hold the Context. */ - public AppInfo(Context context, LauncherActivityInfoCompat info, UserHandle user) { + public AppInfo(Context context, LauncherActivityInfo info, UserHandle user) { this(context, info, user, UserManagerCompat.getInstance(context).isQuietModeEnabled(user)); } - public AppInfo(Context context, LauncherActivityInfoCompat info, UserHandle user, + public AppInfo(Context context, LauncherActivityInfo info, UserHandle user, boolean quietModeEnabled) { this.componentName = info.getComponentName(); this.container = ItemInfo.NO_ID; @@ -110,7 +110,7 @@ public class AppInfo extends ItemInfoWithIcon { return new ComponentKey(componentName, user); } - public static Intent makeLaunchIntent(Context context, LauncherActivityInfoCompat info, + public static Intent makeLaunchIntent(Context context, LauncherActivityInfo info, UserHandle user) { long serialNumber = UserManagerCompat.getInstance(context).getSerialNumberForUser(user); return new Intent(Intent.ACTION_MAIN) diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java index 0c0c53dad..6535d65a4 100644 --- a/src/com/android/launcher3/IconCache.java +++ b/src/com/android/launcher3/IconCache.java @@ -22,6 +22,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; +import android.content.pm.LauncherActivityInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; @@ -45,7 +46,6 @@ import android.support.annotation.NonNull; import android.text.TextUtils; import android.util.Log; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.config.FeatureFlags; @@ -226,7 +226,7 @@ public class IconCache { PackageInfo info = mPackageManager.getPackageInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES); long userSerial = mUserManager.getSerialNumberForUser(user); - for (LauncherActivityInfoCompat app : mLauncherApps.getActivityList(packageName, user)) { + for (LauncherActivityInfo app : mLauncherApps.getActivityList(packageName, user)) { addIconToDBAndMemCache(app, info, userSerial, false /*replace existing*/); } } catch (NameNotFoundException e) { @@ -253,7 +253,7 @@ public class IconCache { mIconProvider.updateSystemStateString(); for (UserHandle user : mUserManager.getUserProfiles()) { // Query for the set of apps - final List<LauncherActivityInfoCompat> apps = mLauncherApps.getActivityList(null, user); + final List<LauncherActivityInfo> apps = mLauncherApps.getActivityList(null, user); // Fail if we don't have any apps // TODO: Fix this. Only fail for the current user. if (apps == null || apps.isEmpty()) { @@ -272,7 +272,7 @@ public class IconCache { * the DB and are updated. * @return The set of packages for which icons have updated. */ - private void updateDBIcons(UserHandle user, List<LauncherActivityInfoCompat> apps, + private void updateDBIcons(UserHandle user, List<LauncherActivityInfo> apps, Set<String> ignorePackages) { long userSerial = mUserManager.getSerialNumberForUser(user); PackageManager pm = mContext.getPackageManager(); @@ -281,13 +281,13 @@ public class IconCache { pkgInfoMap.put(info.packageName, info); } - HashMap<ComponentName, LauncherActivityInfoCompat> componentMap = new HashMap<>(); - for (LauncherActivityInfoCompat app : apps) { + HashMap<ComponentName, LauncherActivityInfo> componentMap = new HashMap<>(); + for (LauncherActivityInfo app : apps) { componentMap.put(app.getComponentName(), app); } HashSet<Integer> itemsToRemove = new HashSet<Integer>(); - Stack<LauncherActivityInfoCompat> appsToUpdate = new Stack<>(); + Stack<LauncherActivityInfo> appsToUpdate = new Stack<>(); Cursor c = null; try { @@ -322,7 +322,7 @@ public class IconCache { long updateTime = c.getLong(indexLastUpdate); int version = c.getInt(indexVersion); - LauncherActivityInfoCompat app = componentMap.remove(component); + LauncherActivityInfo app = componentMap.remove(component); if (version == info.versionCode && updateTime == info.lastUpdateTime && TextUtils.equals(c.getString(systemStateIndex), mIconProvider.getIconSystemState(info.packageName))) { @@ -350,7 +350,7 @@ public class IconCache { // Insert remaining apps. if (!componentMap.isEmpty() || !appsToUpdate.isEmpty()) { - Stack<LauncherActivityInfoCompat> appsToAdd = new Stack<>(); + Stack<LauncherActivityInfo> appsToAdd = new Stack<>(); appsToAdd.addAll(componentMap.values()); new SerializedIconUpdateTask(userSerial, pkgInfoMap, appsToAdd, appsToUpdate).scheduleNext(); @@ -363,7 +363,7 @@ public class IconCache { * the memory. This is useful then the previous bitmap was created using * old data. */ - @Thunk synchronized void addIconToDBAndMemCache(LauncherActivityInfoCompat app, + @Thunk synchronized void addIconToDBAndMemCache(LauncherActivityInfo app, PackageInfo info, long userSerial, boolean replaceExisting) { final ComponentKey key = new ComponentKey(app.getComponentName(), app.getUser()); CacheEntry entry = null; @@ -436,7 +436,7 @@ public class IconCache { */ public synchronized void updateTitleAndIcon(AppInfo application) { CacheEntry entry = cacheLocked(application.componentName, - Provider.<LauncherActivityInfoCompat>of(null), + Provider.<LauncherActivityInfo>of(null), application.user, false, application.usingLowResIcon); if (entry.icon != null && !isDefaultIcon(entry.icon, application.user)) { applyCacheEntry(entry, application); @@ -447,7 +447,7 @@ public class IconCache { * Fill in {@param info} with the icon and label for {@param activityInfo} */ public synchronized void getTitleAndIcon(ItemInfoWithIcon info, - LauncherActivityInfoCompat activityInfo, boolean useLowResIcon) { + LauncherActivityInfo activityInfo, boolean useLowResIcon) { // If we already have activity info, no need to use package icon getTitleAndIcon(info, Provider.of(activityInfo), false, useLowResIcon); } @@ -475,7 +475,7 @@ public class IconCache { */ private synchronized void getTitleAndIcon( @NonNull ItemInfoWithIcon infoInOut, - @NonNull Provider<LauncherActivityInfoCompat> activityInfoProvider, + @NonNull Provider<LauncherActivityInfo> activityInfoProvider, boolean usePkgIcon, boolean useLowResIcon) { CacheEntry entry = cacheLocked(infoInOut.getTargetComponent(), activityInfoProvider, infoInOut.user, usePkgIcon, useLowResIcon); @@ -516,7 +516,7 @@ public class IconCache { */ protected CacheEntry cacheLocked( @NonNull ComponentName componentName, - @NonNull Provider<LauncherActivityInfoCompat> infoProvider, + @NonNull Provider<LauncherActivityInfo> infoProvider, UserHandle user, boolean usePackageIcon, boolean useLowResIcon) { Preconditions.assertWorkerThread(); ComponentKey cacheKey = new ComponentKey(componentName, user); @@ -526,7 +526,7 @@ public class IconCache { mCache.put(cacheKey, entry); // Check the DB first. - LauncherActivityInfoCompat info = null; + LauncherActivityInfo info = null; boolean providerFetchedOnce = false; if (!getEntryFromDB(cacheKey, entry, useLowResIcon) || DEBUG_IGNORE_CACHE) { @@ -704,19 +704,19 @@ public class IconCache { /** * A runnable that updates invalid icons and adds missing icons in the DB for the provided - * LauncherActivityInfoCompat list. Items are updated/added one at a time, so that the + * LauncherActivityInfo list. Items are updated/added one at a time, so that the * worker thread doesn't get blocked. */ @Thunk class SerializedIconUpdateTask implements Runnable { private final long mUserSerial; private final HashMap<String, PackageInfo> mPkgInfoMap; - private final Stack<LauncherActivityInfoCompat> mAppsToAdd; - private final Stack<LauncherActivityInfoCompat> mAppsToUpdate; + private final Stack<LauncherActivityInfo> mAppsToAdd; + private final Stack<LauncherActivityInfo> mAppsToUpdate; private final HashSet<String> mUpdatedPackages = new HashSet<String>(); @Thunk SerializedIconUpdateTask(long userSerial, HashMap<String, PackageInfo> pkgInfoMap, - Stack<LauncherActivityInfoCompat> appsToAdd, - Stack<LauncherActivityInfoCompat> appsToUpdate) { + Stack<LauncherActivityInfo> appsToAdd, + Stack<LauncherActivityInfo> appsToUpdate) { mUserSerial = userSerial; mPkgInfoMap = pkgInfoMap; mAppsToAdd = appsToAdd; @@ -726,7 +726,7 @@ public class IconCache { @Override public void run() { if (!mAppsToUpdate.isEmpty()) { - LauncherActivityInfoCompat app = mAppsToUpdate.pop(); + LauncherActivityInfo app = mAppsToUpdate.pop(); String pkg = app.getComponentName().getPackageName(); PackageInfo info = mPkgInfoMap.get(pkg); addIconToDBAndMemCache(app, info, mUserSerial, true /*replace existing*/); @@ -741,7 +741,7 @@ public class IconCache { // Let it run one more time. scheduleNext(); } else if (!mAppsToAdd.isEmpty()) { - LauncherActivityInfoCompat app = mAppsToAdd.pop(); + LauncherActivityInfo app = mAppsToAdd.pop(); PackageInfo info = mPkgInfoMap.get(app.getComponentName().getPackageName()); // We do not check the mPkgInfoMap when generating the mAppsToAdd. Although every // app should have package info, this is not guaranteed by the api @@ -843,7 +843,7 @@ public class IconCache { } } - private class ActivityInfoProvider extends Provider<LauncherActivityInfoCompat> { + private class ActivityInfoProvider extends Provider<LauncherActivityInfo> { private final Intent mIntent; private final UserHandle mUser; @@ -854,7 +854,7 @@ public class IconCache { } @Override - public LauncherActivityInfoCompat get() { + public LauncherActivityInfo get() { return mLauncherApps.resolveActivity(mIntent, mUser); } } diff --git a/src/com/android/launcher3/IconProvider.java b/src/com/android/launcher3/IconProvider.java index 005bbaa02..a5d399013 100644 --- a/src/com/android/launcher3/IconProvider.java +++ b/src/com/android/launcher3/IconProvider.java @@ -1,9 +1,8 @@ package com.android.launcher3; +import android.content.pm.LauncherActivityInfo; import android.graphics.drawable.Drawable; -import com.android.launcher3.compat.LauncherActivityInfoCompat; - import java.util.Locale; public class IconProvider { @@ -26,7 +25,7 @@ public class IconProvider { } - public Drawable getIcon(LauncherActivityInfoCompat info, int iconDpi) { + public Drawable getIcon(LauncherActivityInfo info, int iconDpi) { return info.getIcon(iconDpi); } } diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java index 09b33297e..ad10523ef 100644 --- a/src/com/android/launcher3/InstallShortcutReceiver.java +++ b/src/com/android/launcher3/InstallShortcutReceiver.java @@ -23,6 +23,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.ActivityInfo; +import android.content.pm.LauncherActivityInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -34,7 +35,6 @@ import android.text.TextUtils; import android.util.Base64; import android.util.Log; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.graphics.LauncherIcons; @@ -285,7 +285,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { private static class PendingInstallShortcutInfo { - final LauncherActivityInfoCompat activityInfo; + final LauncherActivityInfo activityInfo; final ShortcutInfoCompat shortcutInfo; final AppWidgetProviderInfo providerInfo; @@ -315,7 +315,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { /** * Initializes a PendingInstallShortcutInfo to represent a launcher target. */ - public PendingInstallShortcutInfo(LauncherActivityInfoCompat info, Context context) { + public PendingInstallShortcutInfo(LauncherActivityInfo info, Context context) { activityInfo = info; shortcutInfo = null; providerInfo = null; @@ -489,7 +489,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { try { Decoder decoder = new Decoder(encoded, context); if (decoder.optBoolean(APP_SHORTCUT_TYPE_KEY)) { - LauncherActivityInfoCompat info = LauncherAppsCompat.getInstance(context) + LauncherActivityInfo info = LauncherAppsCompat.getInstance(context) .resolveActivity(decoder.launcherIntent, decoder.user); return info == null ? null : new PendingInstallShortcutInfo(info, context); } else if (decoder.optBoolean(DEEPSHORTCUT_TYPE_KEY)) { @@ -571,7 +571,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver { return original; } - LauncherActivityInfoCompat info = LauncherAppsCompat.getInstance(original.mContext) + LauncherActivityInfo info = LauncherAppsCompat.getInstance(original.mContext) .resolveActivity(original.launchIntent, original.user); if (info == null) { return original; diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index af22ab749..0907c8cad 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -25,6 +25,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; +import android.content.pm.LauncherActivityInfo; import android.content.pm.PackageManager; import android.net.Uri; import android.os.Handler; @@ -40,7 +41,6 @@ import android.util.LongSparseArray; import android.util.MutableInt; import com.android.launcher3.compat.AppWidgetManagerCompat; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.PackageInstallerCompat; import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo; @@ -2015,7 +2015,7 @@ public class LauncherModel extends BroadcastReceiver for (UserHandle user : profiles) { // Query for the set of apps final long qiaTime = DEBUG_LOADERS ? SystemClock.uptimeMillis() : 0; - final List<LauncherActivityInfoCompat> apps = mLauncherApps.getActivityList(null, user); + final List<LauncherActivityInfo> apps = mLauncherApps.getActivityList(null, user); if (DEBUG_LOADERS) { Log.d(TAG, "getActivityList took " + (SystemClock.uptimeMillis()-qiaTime) + "ms for user " + user); @@ -2029,7 +2029,7 @@ public class LauncherModel extends BroadcastReceiver boolean quietMode = mUserManager.isQuietModeEnabled(user); // Create the ApplicationInfos for (int i = 0; i < apps.size(); i++) { - LauncherActivityInfoCompat app = apps.get(i); + LauncherActivityInfo app = apps.get(i); // This builds the icon bitmaps. mBgAllAppsList.add(new AppInfo(mContext, app, user, quietMode), app); } diff --git a/src/com/android/launcher3/UninstallDropTarget.java b/src/com/android/launcher3/UninstallDropTarget.java index 73a9f6417..e68a5b030 100644 --- a/src/com/android/launcher3/UninstallDropTarget.java +++ b/src/com/android/launcher3/UninstallDropTarget.java @@ -4,6 +4,7 @@ import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; +import android.content.pm.LauncherActivityInfo; import android.net.Uri; import android.os.Bundle; import android.os.UserHandle; @@ -11,7 +12,6 @@ import android.os.UserManager; import android.util.AttributeSet; import android.widget.Toast; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherAppsCompat; public class UninstallDropTarget extends ButtonDropTarget { @@ -69,7 +69,7 @@ public class UninstallDropTarget extends ButtonDropTarget { } } if (intent != null) { - LauncherActivityInfoCompat info = LauncherAppsCompat.getInstance(context) + LauncherActivityInfo info = LauncherAppsCompat.getInstance(context) .resolveActivity(intent, user); if (info != null && (info.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 0) { diff --git a/src/com/android/launcher3/compat/LauncherActivityInfoCompat.java b/src/com/android/launcher3/compat/LauncherActivityInfoCompat.java deleted file mode 100644 index 830b60acc..000000000 --- a/src/com/android/launcher3/compat/LauncherActivityInfoCompat.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3.compat; - -import android.content.ComponentName; -import android.content.pm.ApplicationInfo; -import android.graphics.drawable.Drawable; -import android.os.UserHandle; - -public abstract class LauncherActivityInfoCompat { - - LauncherActivityInfoCompat() { - } - - public abstract ComponentName getComponentName(); - public abstract UserHandle getUser(); - public abstract CharSequence getLabel(); - public abstract Drawable getIcon(int density); - public abstract ApplicationInfo getApplicationInfo(); - public abstract long getFirstInstallTime(); -} diff --git a/src/com/android/launcher3/compat/LauncherActivityInfoCompatVL.java b/src/com/android/launcher3/compat/LauncherActivityInfoCompatVL.java deleted file mode 100644 index c3b959273..000000000 --- a/src/com/android/launcher3/compat/LauncherActivityInfoCompatVL.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2014 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3.compat; - -import android.content.ComponentName; -import android.content.pm.ApplicationInfo; -import android.content.pm.LauncherActivityInfo; -import android.graphics.drawable.Drawable; -import android.os.UserHandle; - -public class LauncherActivityInfoCompatVL extends LauncherActivityInfoCompat { - private LauncherActivityInfo mLauncherActivityInfo; - - LauncherActivityInfoCompatVL(LauncherActivityInfo launcherActivityInfo) { - super(); - mLauncherActivityInfo = launcherActivityInfo; - } - - public ComponentName getComponentName() { - return mLauncherActivityInfo.getComponentName(); - } - - public UserHandle getUser() { - return mLauncherActivityInfo.getUser(); - } - - public CharSequence getLabel() { - return mLauncherActivityInfo.getLabel(); - } - - public Drawable getIcon(int density) { - return mLauncherActivityInfo.getIcon(density); - } - - public ApplicationInfo getApplicationInfo() { - return mLauncherActivityInfo.getApplicationInfo(); - } - - public long getFirstInstallTime() { - return mLauncherActivityInfo.getFirstInstallTime(); - } -} diff --git a/src/com/android/launcher3/compat/LauncherAppsCompat.java b/src/com/android/launcher3/compat/LauncherAppsCompat.java index 73ab36c8a..5c6eef8c6 100644 --- a/src/com/android/launcher3/compat/LauncherAppsCompat.java +++ b/src/com/android/launcher3/compat/LauncherAppsCompat.java @@ -19,6 +19,7 @@ package com.android.launcher3.compat; import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.LauncherActivityInfo; import android.graphics.Rect; import android.os.Bundle; import android.os.UserHandle; @@ -56,9 +57,9 @@ public abstract class LauncherAppsCompat { } } - public abstract List<LauncherActivityInfoCompat> getActivityList(String packageName, + public abstract List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user); - public abstract LauncherActivityInfoCompat resolveActivity(Intent intent, + public abstract LauncherActivityInfo resolveActivity(Intent intent, UserHandle user); public abstract void startActivityForProfile(ComponentName component, UserHandle user, Rect sourceBounds, Bundle opts); diff --git a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java index 60f9fabf0..e2739c10e 100644 --- a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java +++ b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java @@ -29,7 +29,6 @@ import android.os.UserHandle; import com.android.launcher3.shortcuts.ShortcutInfoCompat; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -45,26 +44,13 @@ public class LauncherAppsCompatVL extends LauncherAppsCompat { } @Override - public List<LauncherActivityInfoCompat> getActivityList(String packageName, UserHandle user) { - List<LauncherActivityInfo> list = mLauncherApps.getActivityList(packageName, user); - if (list.size() == 0) { - return Collections.emptyList(); - } - ArrayList<LauncherActivityInfoCompat> compatList = new ArrayList<>(list.size()); - for (LauncherActivityInfo info : list) { - compatList.add(new LauncherActivityInfoCompatVL(info)); - } - return compatList; + public List<LauncherActivityInfo> getActivityList(String packageName, UserHandle user) { + return mLauncherApps.getActivityList(packageName, user); } @Override - public LauncherActivityInfoCompat resolveActivity(Intent intent, UserHandle user) { - LauncherActivityInfo activity = mLauncherApps.resolveActivity(intent, user); - if (activity != null) { - return new LauncherActivityInfoCompatVL(activity); - } else { - return null; - } + public LauncherActivityInfo resolveActivity(Intent intent, UserHandle user) { + return mLauncherApps.resolveActivity(intent, user); } @Override diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java index 0dfb1c7ac..43e1bd611 100644 --- a/src/com/android/launcher3/model/LoaderCursor.java +++ b/src/com/android/launcher3/model/LoaderCursor.java @@ -21,6 +21,7 @@ import android.content.ContentValues; import android.content.Context; import android.content.Intent; import android.content.Intent.ShortcutIconResource; +import android.content.pm.LauncherActivityInfo; import android.database.Cursor; import android.database.CursorWrapper; import android.graphics.Bitmap; @@ -39,7 +40,6 @@ import com.android.launcher3.LauncherSettings; import com.android.launcher3.ShortcutInfo; import com.android.launcher3.Utilities; import com.android.launcher3.Workspace; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.config.FeatureFlags; @@ -234,7 +234,7 @@ public class LoaderCursor extends CursorWrapper { Intent newIntent = new Intent(Intent.ACTION_MAIN, null); newIntent.addCategory(Intent.CATEGORY_LAUNCHER); newIntent.setComponent(componentName); - LauncherActivityInfoCompat lai = LauncherAppsCompat.getInstance(mContext) + LauncherActivityInfo lai = LauncherAppsCompat.getInstance(mContext) .resolveActivity(newIntent, user); if ((lai == null) && !allowMissingTarget) { Log.d(TAG, "Missing activity found in getShortcutInfo: " + componentName); diff --git a/src/com/android/launcher3/util/CachedPackageTracker.java b/src/com/android/launcher3/util/CachedPackageTracker.java index ab5f44ff2..314b4c0ed 100644 --- a/src/com/android/launcher3/util/CachedPackageTracker.java +++ b/src/com/android/launcher3/util/CachedPackageTracker.java @@ -18,10 +18,10 @@ package com.android.launcher3.util; import android.content.Context; import android.content.SharedPreferences; +import android.content.pm.LauncherActivityInfo; import android.os.UserHandle; import com.android.launcher3.Utilities; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.LauncherAppsCompat.OnAppsChangedCallbackCompat; import com.android.launcher3.compat.UserManagerCompat; @@ -55,7 +55,7 @@ public abstract class CachedPackageTracker implements OnAppsChangedCallbackCompa * Checks the list of user apps, and generates package event accordingly. * {@see #onLauncherAppsAdded}, {@see #onLauncherPackageRemoved} */ - public void processUserApps(List<LauncherActivityInfoCompat> apps, UserHandle user) { + public void processUserApps(List<LauncherActivityInfo> apps, UserHandle user) { String prefKey = INSTALLED_PACKAGES_PREFIX + mUserManager.getSerialNumberForUser(user); HashSet<String> oldPackageSet = new HashSet<>(); final boolean userAppsExisted = getUserApps(oldPackageSet, prefKey); @@ -64,7 +64,7 @@ public abstract class CachedPackageTracker implements OnAppsChangedCallbackCompa HashSet<String> newPackageSet = new HashSet<>(); ArrayList<LauncherActivityInstallInfo> packagesAdded = new ArrayList<>(); - for (LauncherActivityInfoCompat info : apps) { + for (LauncherActivityInfo info : apps) { String packageName = info.getComponentName().getPackageName(); newPackageSet.add(packageName); packagesRemoved.remove(packageName); @@ -123,10 +123,10 @@ public abstract class CachedPackageTracker implements OnAppsChangedCallbackCompa HashSet<String> packageSet = new HashSet<>(); final boolean userAppsExisted = getUserApps(packageSet, prefKey); if (!packageSet.contains(packageName)) { - List<LauncherActivityInfoCompat> activities = + List<LauncherActivityInfo> activities = mLauncherApps.getActivityList(packageName, user); if (!activities.isEmpty()) { - LauncherActivityInfoCompat activityInfo = activities.get(0); + LauncherActivityInfo activityInfo = activities.get(0); packageSet.add(packageName); mPrefs.edit().putStringSet(prefKey, packageSet).apply(); @@ -172,10 +172,10 @@ public abstract class CachedPackageTracker implements OnAppsChangedCallbackCompa public static class LauncherActivityInstallInfo implements Comparable<LauncherActivityInstallInfo> { - public final LauncherActivityInfoCompat info; + public final LauncherActivityInfo info; public final long installTime; - public LauncherActivityInstallInfo(LauncherActivityInfoCompat info, long installTime) { + public LauncherActivityInstallInfo(LauncherActivityInfo info, long installTime) { this.info = info; this.installTime = installTime; } diff --git a/src/com/android/launcher3/util/ManagedProfileHeuristic.java b/src/com/android/launcher3/util/ManagedProfileHeuristic.java index 76378d154..af61554d0 100644 --- a/src/com/android/launcher3/util/ManagedProfileHeuristic.java +++ b/src/com/android/launcher3/util/ManagedProfileHeuristic.java @@ -18,6 +18,7 @@ package com.android.launcher3.util; import android.content.Context; import android.content.SharedPreferences; +import android.content.pm.LauncherActivityInfo; import android.os.Process; import android.os.UserHandle; @@ -31,7 +32,6 @@ import com.android.launcher3.LauncherModel; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; import com.android.launcher3.ShortcutInfo; -import com.android.launcher3.compat.LauncherActivityInfoCompat; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.shortcuts.ShortcutInfoCompat; @@ -92,7 +92,7 @@ public class ManagedProfileHeuristic { } } - public void processUserApps(List<LauncherActivityInfoCompat> apps) { + public void processUserApps(List<LauncherActivityInfo> apps) { Preconditions.assertWorkerThread(); new ManagedProfilePackageHandler().processUserApps(apps, mUser); } |