ShortcutInfo renamed to WorkspaceItemInfo

Will get rid of ShortcutInfoCompat in a follow up cl

Change-Id: I7d7d9c938635f59b216290ba28bea9d0e0721a7d
This commit is contained in:
Sunny Goyal
2019-03-27 16:03:06 -07:00
parent 1f457ae87f
commit 9589916418
53 changed files with 317 additions and 329 deletions

View File

@@ -19,7 +19,6 @@ package com.android.launcher3.model;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED;
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import static com.android.launcher3.model.LoaderResults.filterCurrentWorkspaceItems;
import android.appwidget.AppWidgetProviderInfo;
@@ -49,7 +48,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AppWidgetManagerCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
@@ -335,7 +334,7 @@ public class LoaderTask implements Runnable {
unlockedUsers.put(serialNo, userUnlocked);
}
ShortcutInfo info;
WorkspaceItemInfo info;
LauncherAppWidgetInfo appWidgetInfo;
Intent intent;
String targetPkg;
@@ -360,7 +359,7 @@ public class LoaderTask implements Runnable {
}
int disabledState = quietMode.get(c.serialNumber) ?
ShortcutInfo.FLAG_DISABLED_QUIET_USER : 0;
WorkspaceItemInfo.FLAG_DISABLED_QUIET_USER : 0;
ComponentName cn = intent.getComponent();
targetPkg = cn == null ? intent.getPackage() : cn.getPackageName();
@@ -420,11 +419,11 @@ public class LoaderTask implements Runnable {
// installed later.
FileLog.d(TAG, "package not yet restored: " + targetPkg);
if (c.hasRestoreFlag(ShortcutInfo.FLAG_RESTORE_STARTED)) {
if (c.hasRestoreFlag(WorkspaceItemInfo.FLAG_RESTORE_STARTED)) {
// Restore has started once.
} else if (installingPkgs.containsKey(targetPkg)) {
// App restore has started. Update the flag
c.restoreFlag |= ShortcutInfo.FLAG_RESTORE_STARTED;
c.restoreFlag |= WorkspaceItemInfo.FLAG_RESTORE_STARTED;
c.updater().put(LauncherSettings.Favorites.RESTORED,
c.restoreFlag).commit();
} else {
@@ -433,7 +432,7 @@ public class LoaderTask implements Runnable {
}
} else if (pmHelper.isAppOnSdcard(targetPkg, c.user)) {
// Package is present but not available.
disabledState |= ShortcutInfo.FLAG_DISABLED_NOT_AVAILABLE;
disabledState |= WorkspaceItemInfo.FLAG_DISABLED_NOT_AVAILABLE;
// Add the icon on the workspace anyway.
allowMissingTarget = true;
} else if (!isSdCardReady) {
@@ -450,7 +449,7 @@ public class LoaderTask implements Runnable {
}
}
if ((c.restoreFlag & ShortcutInfo.FLAG_SUPPORTS_WEB_UI) != 0) {
if ((c.restoreFlag & WorkspaceItemInfo.FLAG_SUPPORTS_WEB_UI) != 0) {
validTarget = false;
}
@@ -481,8 +480,8 @@ public class LoaderTask implements Runnable {
c.markDeleted("Pinned shortcut not found");
continue;
}
info = new ShortcutInfo(pinnedShortcut, context);
final ShortcutInfo finalInfo = info;
info = new WorkspaceItemInfo(pinnedShortcut, context);
final WorkspaceItemInfo finalInfo = info;
LauncherIcons li = LauncherIcons.obtain(context);
// If the pinned deep shortcut is no longer published,
@@ -499,11 +498,11 @@ public class LoaderTask implements Runnable {
intent = info.intent;
} else {
// Create a shortcut info in disabled mode for now.
info = c.loadSimpleShortcut();
info = c.loadSimpleWorkspaceItem();
info.runtimeStatusFlags |= FLAG_DISABLED_LOCKED_USER;
}
} else { // item type == ITEM_TYPE_SHORTCUT
info = c.loadSimpleShortcut();
info = c.loadSimpleWorkspaceItem();
// Shortcuts are only available on the primary profile
if (!TextUtils.isEmpty(targetPkg)
@@ -539,7 +538,7 @@ public class LoaderTask implements Runnable {
if (c.restoreFlag != 0 && !TextUtils.isEmpty(targetPkg)) {
SessionInfo si = installingPkgs.get(targetPkg);
if (si == null) {
info.status &= ~ShortcutInfo.FLAG_INSTALL_SESSION_ACTIVE;
info.status &= ~WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE;
} else {
info.setInstallProgress((int) (si.getProgress() * 100));
}
@@ -547,7 +546,7 @@ public class LoaderTask implements Runnable {
c.checkAndAddItem(info, mBgDataModel);
} else {
throw new RuntimeException("Unexpected null ShortcutInfo");
throw new RuntimeException("Unexpected null WorkspaceItemInfo");
}
break;
@@ -755,7 +754,7 @@ public class LoaderTask implements Runnable {
// Ranks are the source of truth for folder items, so cellX and cellY can be ignored
// for now. Database will be updated once user manually modifies folder.
for (int rank = 0; rank < size; ++rank) {
ShortcutInfo info = folder.contents.get(rank);
WorkspaceItemInfo info = folder.contents.get(rank);
info.rank = rank;
if (info.usingLowResIcon()
@@ -782,8 +781,8 @@ public class LoaderTask implements Runnable {
HashSet<String> packagesToIgnore = new HashSet<>();
synchronized (mBgDataModel) {
for (ItemInfo info : mBgDataModel.itemsIdMap) {
if (info instanceof ShortcutInfo) {
ShortcutInfo si = (ShortcutInfo) info;
if (info instanceof WorkspaceItemInfo) {
WorkspaceItemInfo si = (WorkspaceItemInfo) info;
if (si.isPromise() && si.getTargetComponent() != null) {
packagesToIgnore.add(si.getTargetComponent().getPackageName());
}