Merge "Setup infrastructure (multi-db support) for the new grid migration algorithm" into ub-launcher3-master
diff --git a/Android.mk b/Android.mk
index a099ada..66ccae0 100644
--- a/Android.mk
+++ b/Android.mk
@@ -144,7 +144,7 @@
LOCAL_AAPT2_ONLY := true
LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_JAVA_LIBRARIES := SystemUISharedLibLauncherWrapper launcherprotosnano
+LOCAL_STATIC_JAVA_LIBRARIES := SystemUISharedLib launcherprotosnano
ifneq (,$(wildcard frameworks/base))
LOCAL_PRIVATE_PLATFORM_APIS := true
else
@@ -213,7 +213,7 @@
LOCAL_USE_AAPT2 := true
LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_JAVA_LIBRARIES := SystemUISharedLibLauncherWrapper launcherprotosnano
+LOCAL_STATIC_JAVA_LIBRARIES := SystemUISharedLib launcherprotosnano
ifneq (,$(wildcard frameworks/base))
LOCAL_PRIVATE_PLATFORM_APIS := true
else
diff --git a/go/src/com/android/launcher3/model/WidgetsModel.java b/go/src/com/android/launcher3/model/WidgetsModel.java
index 7269b41..7690b9d 100644
--- a/go/src/com/android/launcher3/model/WidgetsModel.java
+++ b/go/src/com/android/launcher3/model/WidgetsModel.java
@@ -22,7 +22,7 @@
import androidx.annotation.Nullable;
import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.icons.ComponentWithLabel;
+import com.android.launcher3.icons.ComponentWithLabelAndIcon;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.widget.WidgetListRowEntry;
@@ -59,7 +59,7 @@
* @param packageUser If null, all widgets and shortcuts are updated and returned, otherwise
* only widgets and shortcuts associated with the package/user are.
*/
- public List<ComponentWithLabel> update(LauncherAppState app,
+ public List<ComponentWithLabelAndIcon> update(LauncherAppState app,
@Nullable PackageUserKey packageUser) {
return Collections.emptyList();
}
diff --git a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
index bce4e0f..31a923e 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/BaseIconFactory.java
@@ -350,6 +350,17 @@
iconDpi);
}
+ /**
+ * Badges the provided source with the badge info
+ */
+ public BitmapInfo badgeBitmap(Bitmap source, BitmapInfo badgeInfo) {
+ Bitmap icon = BitmapRenderer.createHardwareBitmap(mIconBitmapSize, mIconBitmapSize, (c) -> {
+ getShadowGenerator().recreateIcon(source, c);
+ badgeWithDrawable(c, new FixedSizeBitmapDrawable(badgeInfo.icon));
+ });
+ return BitmapInfo.of(icon, badgeInfo.color);
+ }
+
private int extractColor(Bitmap bitmap) {
return mDisableColorExtractor ? 0 : mColorExtractor.findDominantColorByHue(bitmap);
}
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
index e807791..4c634cb 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
@@ -281,7 +281,8 @@
ContentValues values = newContentValues(entry.bitmap, entry.title.toString(),
componentName.getPackageName(), cachingLogic.getKeywords(object, mLocaleList));
- addIconToDB(values, componentName, info, userSerial);
+ addIconToDB(values, componentName, info, userSerial,
+ cachingLogic.getLastUpdatedTime(object, info));
}
/**
@@ -289,10 +290,10 @@
* @param values {@link ContentValues} containing icon & title
*/
private void addIconToDB(ContentValues values, ComponentName key,
- PackageInfo info, long userSerial) {
+ PackageInfo info, long userSerial, long lastUpdateTime) {
values.put(IconDB.COLUMN_COMPONENT, key.flattenToString());
values.put(IconDB.COLUMN_USER, userSerial);
- values.put(IconDB.COLUMN_LAST_UPDATED, info.lastUpdateTime);
+ values.put(IconDB.COLUMN_LAST_UPDATED, lastUpdateTime);
values.put(IconDB.COLUMN_VERSION, info.versionCode);
mIconDb.insertOrReplace(values);
}
@@ -362,7 +363,8 @@
}
if (object != null) {
entry.title = cachingLogic.getLabel(object);
- entry.contentDescription = mPackageManager.getUserBadgedLabel(entry.title, user);
+ entry.contentDescription = mPackageManager.getUserBadgedLabel(
+ cachingLogic.getDescription(object, entry.title), user);
}
}
}
@@ -449,7 +451,8 @@
// package updates.
ContentValues values = newContentValues(
iconInfo, entry.title.toString(), packageName, null);
- addIconToDB(values, cacheKey.componentName, info, getSerialNumberForUser(user));
+ addIconToDB(values, cacheKey.componentName, info, getSerialNumberForUser(user),
+ info.lastUpdateTime);
} catch (NameNotFoundException e) {
if (DEBUG) Log.d(TAG, "Application not installed " + packageName);
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java b/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java
index a89ede7..c12e9dc 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/CachingLogic.java
@@ -34,6 +34,10 @@
CharSequence getLabel(T object);
+ default CharSequence getDescription(T object, CharSequence fallback) {
+ return fallback;
+ }
+
@NonNull
BitmapInfo loadIcon(Context context, T object);
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java b/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java
index bcdbce5..aec1cdd 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/IconCacheUpdateHandler.java
@@ -24,6 +24,7 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.text.TextUtils;
+import android.util.ArrayMap;
import android.util.Log;
import android.util.SparseBooleanArray;
@@ -61,7 +62,7 @@
private final HashMap<String, PackageInfo> mPkgInfoMap;
private final BaseIconCache mIconCache;
- private final HashMap<UserHandle, Set<String>> mPackagesToIgnore = new HashMap<>();
+ private final ArrayMap<UserHandle, Set<String>> mPackagesToIgnore = new ArrayMap<>();
private final SparseBooleanArray mItemsToDelete = new SparseBooleanArray();
private boolean mFilterMode = MODE_SET_INVALID_ITEMS;
@@ -77,8 +78,16 @@
createPackageInfoMap();
}
- public void setPackagesToIgnore(UserHandle userHandle, Set<String> packages) {
- mPackagesToIgnore.put(userHandle, packages);
+ /**
+ * Sets a package to ignore for processing
+ */
+ public void addPackagesToIgnore(UserHandle userHandle, String packageName) {
+ Set<String> packages = mPackagesToIgnore.get(userHandle);
+ if (packages == null) {
+ packages = new HashSet<>();
+ mPackagesToIgnore.put(userHandle, packages);
+ }
+ packages.add(packageName);
}
private void createPackageInfoMap() {
@@ -181,6 +190,7 @@
}
continue;
}
+
if (app == null) {
if (mFilterMode == MODE_SET_INVALID_ITEMS) {
mIconCache.remove(component, user);
@@ -263,6 +273,7 @@
T app = mAppsToUpdate.pop();
String pkg = mCachingLogic.getComponent(app).getPackageName();
PackageInfo info = mPkgInfoMap.get(pkg);
+
mIconCache.addIconToDBAndMemCache(
app, mCachingLogic, info, mUserSerial, true /*replace existing*/);
mUpdatedPackages.add(pkg);
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java
index 76972af..54f58e2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/DynamicItemCache.java
@@ -43,7 +43,6 @@
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.allapps.AllAppsStore;
import com.android.launcher3.icons.IconCache;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.util.InstantAppResolver;
@@ -170,14 +169,7 @@
List<ShortcutInfo> details = shortcutKey.buildRequest(mContext).query(ShortcutRequest.ALL);
if (!details.isEmpty()) {
WorkspaceItemInfo si = new WorkspaceItemInfo(details.get(0), mContext);
- try (LauncherIcons li = LauncherIcons.obtain(mContext)) {
- si.bitmap = li.createShortcutIcon(details.get(0), true /* badged */, null);
- } catch (Exception e) {
- if (DEBUG) {
- Log.e(TAG, "Error loading shortcut icon for " + shortcutKey.toString());
- }
- return null;
- }
+ mIconCache.getShortcutIcon(si, details.get(0));
return si;
}
if (DEBUG) {
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index bb66ae1..48a2f32 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.uioverrides.states;
-import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
-
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
@@ -39,7 +37,7 @@
}
protected BackgroundAppState(int id, int logContainer) {
- super(id, logContainer, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
+ super(id, logContainer, STATE_FLAGS);
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
index 9c78af9..644cfcb 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -17,7 +17,6 @@
import static android.view.View.VISIBLE;
-import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
@@ -33,6 +32,7 @@
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.states.RotationHelper.REQUEST_ROTATE;
+import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import android.graphics.Rect;
import android.view.View;
@@ -67,15 +67,22 @@
| FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_DISABLE_ACCESSIBILITY;
public OverviewState(int id) {
- this(id, OVERVIEW_TRANSITION_MS, STATE_FLAGS);
+ this(id, STATE_FLAGS);
}
- protected OverviewState(int id, int transitionDuration, int stateFlags) {
- this(id, ContainerType.TASKSWITCHER, transitionDuration, stateFlags);
+ protected OverviewState(int id, int stateFlags) {
+ this(id, ContainerType.TASKSWITCHER, stateFlags);
}
- protected OverviewState(int id, int logContainer, int transitionDuration, int stateFlags) {
- super(id, logContainer, transitionDuration, stateFlags);
+ protected OverviewState(int id, int logContainer, int stateFlags) {
+ super(id, logContainer, stateFlags);
+ }
+
+ @Override
+ public int getTransitionDuration(Launcher launcher) {
+ // In no-button mode, overview comes in all the way from the left, so give it more time.
+ boolean isNoButtonMode = SysUINavigationMode.INSTANCE.get(launcher).getMode() == NO_BUTTON;
+ return isNoButtonMode && ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250;
}
@Override
@@ -206,7 +213,7 @@
public void prepareForAtomicAnimation(Launcher launcher, LauncherState fromState,
AnimatorSetBuilder builder) {
if ((fromState == NORMAL || fromState == HINT_STATE) && this == OVERVIEW) {
- if (SysUINavigationMode.getMode(launcher) == SysUINavigationMode.Mode.NO_BUTTON) {
+ if (SysUINavigationMode.getMode(launcher) == NO_BUTTON) {
builder.setInterpolator(ANIM_WORKSPACE_SCALE,
fromState == NORMAL ? ACCEL : OVERSHOOT_1_2);
builder.setInterpolator(ANIM_WORKSPACE_TRANSLATE, ACCEL);
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
index 2ac2d2d..34fc3e4 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java
@@ -109,7 +109,7 @@
// Normally we compute the duration based on the velocity and distance to the given
// state, but since the hint state tracks the entire screen without a clear endpoint, we
// need to manually set the duration to a reasonable value.
- animator.setDuration(HINT_STATE.transitionDuration);
+ animator.setDuration(HINT_STATE.getTransitionDuration(mLauncher));
}
}
@@ -173,7 +173,7 @@
// StaggeredWorkspaceAnim doesn't animate overview, so we handle it here.
stateManager.cancelAnimation();
AnimatorSetBuilder builder = new AnimatorSetBuilder();
- long duration = OVERVIEW.transitionDuration;
+ long duration = OVERVIEW.getTransitionDuration(mLauncher);
AnimatorSet anim = stateManager.createAtomicAnimation(
stateManager.getState(), NORMAL, builder,
ATOMIC_OVERVIEW_PEEK_COMPONENT, duration);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
index 1b60404..f0516ac 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
@@ -75,7 +75,6 @@
import com.android.quickstep.util.ActiveGestureLog;
import com.android.quickstep.util.AppWindowAnimationHelper.TargetAlphaProvider;
import com.android.quickstep.util.RectFSpringAnim;
-import com.android.quickstep.util.SharedApiCompat;
import com.android.quickstep.util.ShelfPeekAnim;
import com.android.quickstep.util.ShelfPeekAnim.ShelfAnimState;
import com.android.quickstep.views.LiveTileOverlay;
@@ -1142,8 +1141,7 @@
final int runningTaskId = mGestureState.getRunningTaskId();
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
if (mRecentsAnimationController != null) {
- SharedApiCompat.setWillFinishToHome(mRecentsAnimationController.getController(),
- true /* willFinishToHome */);
+ mRecentsAnimationController.getController().setWillFinishToHome(true);
// Update the screenshot of the task
if (mTaskSnapshot == null) {
mTaskSnapshot = mRecentsAnimationController.screenshotTask(runningTaskId);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java
index c4733bd..fc50660 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/OverviewCommandHelper.java
@@ -74,6 +74,10 @@
@BinderThread
public void onOverviewShown(boolean triggeredFromAltTab) {
+ if (triggeredFromAltTab) {
+ ActivityManagerWrapper.getInstance()
+ .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
+ }
MAIN_EXECUTOR.execute(new ShowRecentsCommand(triggeredFromAltTab));
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index 85a9545..e88a8a4 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.uioverrides.states;
-import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import com.android.launcher3.AbstractFloatingView;
@@ -40,7 +39,12 @@
};
public AllAppsState(int id) {
- super(id, ContainerType.ALLAPPS, ALL_APPS_TRANSITION_MS, STATE_FLAGS);
+ super(id, ContainerType.ALLAPPS, STATE_FLAGS);
+ }
+
+ @Override
+ public int getTransitionDuration(Launcher launcher) {
+ return 320;
}
@Override
diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java
index 3c6537a..101bb07 100644
--- a/quickstep/src/com/android/quickstep/SystemUiProxy.java
+++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java
@@ -29,7 +29,6 @@
import android.view.MotionEvent;
import com.android.launcher3.util.MainThreadInitializedObject;
-import com.android.quickstep.util.SharedApiCompat;
import com.android.systemui.shared.recents.ISystemUiProxy;
/**
@@ -278,7 +277,7 @@
mLastShelfVisible = visible;
mLastShelfHeight = shelfHeight;
try {
- SharedApiCompat.setShelfHeight(mSystemUiProxy, visible, shelfHeight);
+ mSystemUiProxy.setShelfHeight(visible, shelfHeight);
} catch (RemoteException e) {
Log.w(TAG, "Failed call setShelfHeight visible: " + visible
+ " height: " + shelfHeight, e);
diff --git a/src/com/android/launcher3/InstallShortcutReceiver.java b/src/com/android/launcher3/InstallShortcutReceiver.java
index 3eb02b3..a5142d8 100644
--- a/src/com/android/launcher3/InstallShortcutReceiver.java
+++ b/src/com/android/launcher3/InstallShortcutReceiver.java
@@ -17,7 +17,6 @@
package com.android.launcher3;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
-import static com.android.launcher3.util.ShortcutUtil.fetchAndUpdateShortcutIconAsync;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
@@ -44,7 +43,6 @@
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.GraphicsUtils;
import com.android.launcher3.icons.LauncherIcons;
@@ -61,7 +59,6 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -491,13 +488,8 @@
return Pair.create(si, null);
} else if (shortcutInfo != null) {
WorkspaceItemInfo itemInfo = new WorkspaceItemInfo(shortcutInfo, mContext);
- if (FeatureFlags.ENABLE_DEEP_SHORTCUT_ICON_CACHE.get()) {
- fetchAndUpdateShortcutIconAsync(mContext, itemInfo, shortcutInfo, true);
- } else {
- LauncherIcons li = LauncherIcons.obtain(mContext);
- itemInfo.bitmap = li.createShortcutIcon(shortcutInfo);
- li.recycle();
- }
+ LauncherAppState.getInstance(mContext).getIconCache().getShortcutIcon(
+ itemInfo, shortcutInfo);
return Pair.create(itemInfo, shortcutInfo);
} else if (providerInfo != null) {
LauncherAppWidgetProviderInfo info = LauncherAppWidgetProviderInfo
diff --git a/src/com/android/launcher3/LauncherAnimUtils.java b/src/com/android/launcher3/LauncherAnimUtils.java
index cdfd257..32e9c14 100644
--- a/src/com/android/launcher3/LauncherAnimUtils.java
+++ b/src/com/android/launcher3/LauncherAnimUtils.java
@@ -16,8 +16,6 @@
package com.android.launcher3;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
-
import android.graphics.drawable.Drawable;
import android.util.FloatProperty;
import android.util.Property;
@@ -29,11 +27,7 @@
* Durations for various state animations. These are not defined in resources to allow
* easier access from static classes and enums
*/
- public static final int ALL_APPS_TRANSITION_MS = 320;
- public static final int OVERVIEW_TRANSITION_MS = ENABLE_OVERVIEW_ACTIONS.get() ? 380 : 250;
- public static final int SPRING_LOADED_TRANSITION_MS = 150;
public static final int SPRING_LOADED_EXIT_DELAY = 500;
- public static final int HINT_TRANSITION_MS = 80;
// The progress of an animation to all apps must be at least this far along to snap to all apps.
public static final float MIN_PROGRESS_TO_ALL_APPS = 0.5f;
diff --git a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
index 228c07e..56cce78 100644
--- a/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
+++ b/src/com/android/launcher3/LauncherAppWidgetProviderInfo.java
@@ -7,10 +7,12 @@
import android.content.pm.PackageManager;
import android.graphics.Point;
import android.graphics.Rect;
+import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.UserHandle;
-import com.android.launcher3.icons.ComponentWithLabel;
+import com.android.launcher3.icons.ComponentWithLabelAndIcon;
+import com.android.launcher3.icons.IconCache;
/**
* This class is a thin wrapper around the framework AppWidgetProviderInfo class. This class affords
@@ -19,7 +21,7 @@
* as opposed to a widget instance, and so should not be confused with {@link LauncherAppWidgetInfo}
*/
public class LauncherAppWidgetProviderInfo extends AppWidgetProviderInfo
- implements ComponentWithLabel {
+ implements ComponentWithLabelAndIcon {
public static final String CLS_CUSTOM_WIDGET_PREFIX = "#custom-widget-";
@@ -111,4 +113,9 @@
public final UserHandle getUser() {
return getProfile();
}
+
+ @Override
+ public Drawable getFullResIcon(IconCache cache) {
+ return cache.getFullResIcon(provider.getPackageName(), icon);
+ }
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 04a7ecd..efe85c7 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -37,7 +37,6 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.icons.IconCache;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.logging.FileLog;
import com.android.launcher3.model.AddWorkspaceItemsTask;
import com.android.launcher3.model.AllAppsList;
@@ -573,9 +572,7 @@
public void updateAndBindWorkspaceItem(WorkspaceItemInfo si, ShortcutInfo info) {
updateAndBindWorkspaceItem(() -> {
si.updateFromDeepShortcutInfo(info, mApp.getContext());
- LauncherIcons li = LauncherIcons.obtain(mApp.getContext());
- si.bitmap = li.createShortcutIcon(info);
- li.recycle();
+ mApp.getIconCache().getShortcutIcon(si, info);
return si;
});
}
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 8b80cba..7e06099 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -56,7 +56,7 @@
/**
* Base state for various states used for the Launcher
*/
-public class LauncherState {
+public abstract class LauncherState {
/**
@@ -97,9 +97,15 @@
* TODO: Create a separate class for NORMAL state.
*/
public static final LauncherState NORMAL = new LauncherState(NORMAL_STATE_ORDINAL,
- ContainerType.WORKSPACE, 0,
+ ContainerType.WORKSPACE,
FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_HIDE_BACK_BUTTON |
- FLAG_HAS_SYS_UI_SCRIM);
+ FLAG_HAS_SYS_UI_SCRIM) {
+ @Override
+ public int getTransitionDuration(Launcher launcher) {
+ // Arbitrary duration, when going to NORMAL we use the state we're coming from instead.
+ return 0;
+ }
+ };
/**
* Various Launcher states arranged in the increasing order of UI layers
@@ -147,8 +153,6 @@
*/
public final boolean hasWorkspacePageBackground;
- public final int transitionDuration;
-
/**
* True if the state allows workspace icons to be dragged.
*/
@@ -178,9 +182,8 @@
public final boolean hasSysUiScrim;
- public LauncherState(int id, int containerType, int transitionDuration, int flags) {
+ public LauncherState(int id, int containerType, int flags) {
this.containerType = containerType;
- this.transitionDuration = transitionDuration;
this.hasWorkspacePageBackground = (flags & FLAG_PAGE_BACKGROUNDS) != 0;
this.hasMultipleVisiblePages = (flags & FLAG_MULTI_PAGE) != 0;
@@ -203,6 +206,12 @@
return Arrays.copyOf(sAllStates, sAllStates.length);
}
+ /**
+ * @return How long the animation to this state should take (or from this state to NORMAL).
+ * @param launcher
+ */
+ public abstract int getTransitionDuration(Launcher launcher);
+
public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
return new ScaleAndTranslation(1, 0, 0);
}
diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java
index daf270b..195e69b 100644
--- a/src/com/android/launcher3/LauncherStateManager.java
+++ b/src/com/android/launcher3/LauncherStateManager.java
@@ -284,7 +284,9 @@
Runnable onCompleteRunnable) {
// Since state NORMAL can be reached from multiple states, just assume that the
// transition plays in reverse and use the same duration as previous state.
- mConfig.duration = state == NORMAL ? fromState.transitionDuration : state.transitionDuration;
+ mConfig.duration = state == NORMAL
+ ? fromState.getTransitionDuration(mLauncher)
+ : state.getTransitionDuration(mLauncher);
AnimatorSetBuilder builder = new AnimatorSetBuilder();
prepareForAtomicAnimation(fromState, state, builder);
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 7f443b6..e0e4cc0 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -584,9 +584,8 @@
return new FixedSizeEmptyDrawable(iconSize);
}
ShortcutInfo si = (ShortcutInfo) obj;
- LauncherIcons li = LauncherIcons.obtain(appState.getContext());
- Bitmap badge = li.getShortcutInfoBadge(si, appState.getIconCache()).bitmap.icon;
- li.recycle();
+ Bitmap badge = LauncherAppState.getInstance(appState.getContext())
+ .getIconCache().getShortcutInfoBadge(si).icon;
float badgeSize = LauncherIcons.getBadgeSizeForIconSize(iconSize);
float insetFraction = (iconSize - badgeSize) / iconSize;
return new InsetDrawable(new FastBitmapDrawable(badge),
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index b53889a..b725002 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -16,12 +16,11 @@
package com.android.launcher3;
-import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY;
-import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.NORMAL;
+import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY;
@@ -1350,7 +1349,7 @@
}
public void snapToPageFromOverView(int whichPage) {
- snapToPage(whichPage, OVERVIEW_TRANSITION_MS, Interpolators.ZOOM_IN);
+ snapToPage(whichPage, OVERVIEW.getTransitionDuration(mLauncher), Interpolators.ZOOM_IN);
}
private void onStartStateTransition(LauncherState state) {
@@ -1915,7 +1914,8 @@
// Animate the item to its original position, while simultaneously exiting
// spring-loaded mode so the page meets the icon where it was picked up.
mLauncher.getDragController().animateDragViewToOriginalPosition(
- onCompleteRunnable, cell, SPRING_LOADED_TRANSITION_MS);
+ onCompleteRunnable, cell,
+ SPRING_LOADED.getTransitionDuration(mLauncher));
mLauncher.getStateManager().goToState(NORMAL);
mLauncher.getDropTargetBar().onDragEnd();
parent.onDropChild(cell);
diff --git a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
index 09062a4..f71cfb8 100644
--- a/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
+++ b/src/com/android/launcher3/dragndrop/PinShortcutRequestActivityInfo.java
@@ -29,9 +29,11 @@
import android.os.Process;
import com.android.launcher3.FastBitmapDrawable;
+import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
+import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.icons.IconCache;
@@ -86,7 +88,7 @@
// Total duration for the drop animation to complete.
long duration = mContext.getResources().getInteger(R.integer.config_dropAnimMaxDuration) +
LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY +
- LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS;
+ LauncherState.SPRING_LOADED.getTransitionDuration(Launcher.getLauncher(mContext));
// Delay the actual accept() call until the drop animation is complete.
return PinRequestHelper.createWorkspaceItemFromPinItemRequest(
mContext, mRequest, duration);
diff --git a/src/com/android/launcher3/icons/ComponentWithLabel.java b/src/com/android/launcher3/icons/ComponentWithLabel.java
index f7ee5f9..372c591 100644
--- a/src/com/android/launcher3/icons/ComponentWithLabel.java
+++ b/src/com/android/launcher3/icons/ComponentWithLabel.java
@@ -31,7 +31,7 @@
CharSequence getLabel(PackageManager pm);
- class ComponentCachingLogic implements CachingLogic<ComponentWithLabel> {
+ class ComponentCachingLogic<T extends ComponentWithLabel> implements CachingLogic<T> {
private final PackageManager mPackageManager;
private final boolean mAddToMemCache;
@@ -42,22 +42,22 @@
}
@Override
- public ComponentName getComponent(ComponentWithLabel object) {
+ public ComponentName getComponent(T object) {
return object.getComponent();
}
@Override
- public UserHandle getUser(ComponentWithLabel object) {
+ public UserHandle getUser(T object) {
return object.getUser();
}
@Override
- public CharSequence getLabel(ComponentWithLabel object) {
+ public CharSequence getLabel(T object) {
return object.getLabel(mPackageManager);
}
@Override
- public BitmapInfo loadIcon(Context context, ComponentWithLabel object) {
+ public BitmapInfo loadIcon(Context context, T object) {
return BitmapInfo.LOW_RES_INFO;
}
diff --git a/src/com/android/launcher3/icons/ComponentWithLabelAndIcon.java b/src/com/android/launcher3/icons/ComponentWithLabelAndIcon.java
new file mode 100644
index 0000000..248a57d
--- /dev/null
+++ b/src/com/android/launcher3/icons/ComponentWithLabelAndIcon.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2020 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.icons;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+
+import androidx.annotation.NonNull;
+
+import com.android.launcher3.LauncherAppState;
+
+/**
+ * Extension of ComponentWithLabel to also support loading icons
+ */
+public interface ComponentWithLabelAndIcon extends ComponentWithLabel {
+
+ /**
+ * Provide an icon for this object
+ */
+ Drawable getFullResIcon(IconCache cache);
+
+ class ComponentWithIconCachingLogic extends ComponentCachingLogic<ComponentWithLabelAndIcon> {
+
+ public ComponentWithIconCachingLogic(Context context, boolean addToMemCache) {
+ super(context, addToMemCache);
+ }
+
+ @NonNull
+ @Override
+ public BitmapInfo loadIcon(Context context, ComponentWithLabelAndIcon object) {
+ Drawable d = object.getFullResIcon(LauncherAppState.getInstance(context)
+ .getIconCache());
+ if (d == null) {
+ return super.loadIcon(context, object);
+ }
+ try (LauncherIcons li = LauncherIcons.obtain(context)) {
+ return li.createBadgedIconBitmap(d, object.getUser(), 0);
+ }
+ }
+ }
+}
diff --git a/src/com/android/launcher3/icons/IconCache.java b/src/com/android/launcher3/icons/IconCache.java
index 69b8125..804acc3 100644
--- a/src/com/android/launcher3/icons/IconCache.java
+++ b/src/com/android/launcher3/icons/IconCache.java
@@ -19,6 +19,7 @@
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
@@ -56,6 +57,7 @@
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.Preconditions;
+import java.util.function.Predicate;
import java.util.function.Supplier;
/**
@@ -65,6 +67,9 @@
private static final String TAG = "Launcher.IconCache";
+ private final Predicate<ItemInfoWithIcon> mIsUsingFallbackIconCheck = w -> w.bitmap != null
+ && w.bitmap.isNullOrLowRes() && !isDefaultIcon(w.bitmap, w.user);
+
private final CachingLogic<ComponentWithLabel> mComponentWithLabelCachingLogic;
private final CachingLogic<LauncherActivityInfo> mLauncherActivityInfoCachingLogic;
private final CachingLogic<ShortcutInfo> mShortcutCachingLogic;
@@ -180,6 +185,77 @@
}
/**
+ * Fill in {@param info} with the icon for {@param si}
+ */
+ public void getShortcutIcon(ItemInfoWithIcon info, ShortcutInfo si) {
+ getShortcutIcon(info, si, true, mIsUsingFallbackIconCheck);
+ }
+
+ /**
+ * Fill in {@param info} with an unbadged icon for {@param si}
+ */
+ public void getUnbadgedShortcutIcon(ItemInfoWithIcon info, ShortcutInfo si) {
+ getShortcutIcon(info, si, false, mIsUsingFallbackIconCheck);
+ }
+
+ /**
+ * Fill in {@param info} with the icon and label for {@param si}. If the icon is not
+ * available, and fallback check returns true, it keeps the old icon.
+ */
+ public <T extends ItemInfoWithIcon> void getShortcutIcon(T info, ShortcutInfo si,
+ @NonNull Predicate<T> fallbackIconCheck) {
+ getShortcutIcon(info, si, true /* use badged */, fallbackIconCheck);
+ }
+
+ private synchronized <T extends ItemInfoWithIcon> void getShortcutIcon(T info, ShortcutInfo si,
+ boolean useBadged, @NonNull Predicate<T> fallbackIconCheck) {
+ BitmapInfo bitmapInfo;
+ if (FeatureFlags.ENABLE_DEEP_SHORTCUT_ICON_CACHE.get()) {
+ bitmapInfo = cacheLocked(ShortcutKey.fromInfo(si).componentName, si.getUserHandle(),
+ () -> si, mShortcutCachingLogic, false, false).bitmap;
+ } else {
+ // If caching is disabled, load the full icon
+ bitmapInfo = mShortcutCachingLogic.loadIcon(mContext, si);
+ }
+ if (bitmapInfo.isNullOrLowRes()) {
+ bitmapInfo = getDefaultIcon(si.getUserHandle());
+ }
+
+ if (isDefaultIcon(bitmapInfo, si.getUserHandle()) && fallbackIconCheck.test(info)) {
+ return;
+ }
+ info.bitmap = bitmapInfo;
+ if (useBadged) {
+ BitmapInfo badgeInfo = getShortcutInfoBadge(si);
+ try (LauncherIcons li = LauncherIcons.obtain(mContext)) {
+ info.bitmap = li.badgeBitmap(info.bitmap.icon, badgeInfo);
+ }
+ }
+ }
+
+ /**
+ * Returns the badging info for the shortcut
+ */
+ public BitmapInfo getShortcutInfoBadge(ShortcutInfo shortcutInfo) {
+ ComponentName cn = shortcutInfo.getActivity();
+ if (cn != null) {
+ // Get the app info for the source activity.
+ AppInfo appInfo = new AppInfo();
+ appInfo.user = shortcutInfo.getUserHandle();
+ appInfo.componentName = cn;
+ appInfo.intent = new Intent(Intent.ACTION_MAIN)
+ .addCategory(Intent.CATEGORY_LAUNCHER)
+ .setComponent(cn);
+ getTitleAndIcon(appInfo, false);
+ return appInfo.bitmap;
+ } else {
+ PackageItemInfo pkgInfo = new PackageItemInfo(shortcutInfo.getPackage());
+ getTitleAndIconForApp(pkgInfo, false);
+ return pkgInfo.bitmap;
+ }
+ }
+
+ /**
* Fill in info with the icon and label for deep shortcut.
*/
public synchronized CacheEntry getDeepShortcutTitleAndIcon(ShortcutInfo info) {
diff --git a/src/com/android/launcher3/icons/LauncherIcons.java b/src/com/android/launcher3/icons/LauncherIcons.java
index e67d244..cbd7c53 100644
--- a/src/com/android/launcher3/icons/LauncherIcons.java
+++ b/src/com/android/launcher3/icons/LauncherIcons.java
@@ -16,28 +16,11 @@
package com.android.launcher3.icons;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
-import android.content.pm.ShortcutInfo;
-import android.graphics.Bitmap;
-import android.graphics.drawable.Drawable;
-import android.os.Process;
-import androidx.annotation.Nullable;
-import androidx.annotation.WorkerThread;
-
-import com.android.launcher3.AppInfo;
-import com.android.launcher3.FastBitmapDrawable;
import com.android.launcher3.InvariantDeviceProfile;
-import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.IconShape;
-import com.android.launcher3.model.PackageItemInfo;
-import com.android.launcher3.util.Themes;
-
-import java.util.function.Supplier;
/**
* Wrapper class to provide access to {@link BaseIconFactory} and also to provide pool of this class
@@ -111,114 +94,4 @@
public void close() {
recycle();
}
-
- // below methods should also migrate to BaseIconFactory
- public BitmapInfo createShortcutIcon(ShortcutInfo shortcutInfo) {
- return createShortcutIcon(shortcutInfo, true /* badged */);
- }
-
- public BitmapInfo createShortcutIcon(ShortcutInfo shortcutInfo, boolean badged) {
- return createShortcutIcon(shortcutInfo, badged, null);
- }
-
- public BitmapInfo createShortcutIcon(ShortcutInfo shortcutInfo, boolean badged,
- @Nullable Supplier<ItemInfoWithIcon> fallbackIconProvider) {
- if (FeatureFlags.ENABLE_DEEP_SHORTCUT_ICON_CACHE.get()) {
- return createShortcutIconCached(shortcutInfo, badged, true, fallbackIconProvider);
- } else {
- return createShortcutIconLegacy(shortcutInfo, badged, fallbackIconProvider);
- }
- }
-
- public BitmapInfo createShortcutIconLegacy(ShortcutInfo shortcutInfo, boolean badged,
- @Nullable Supplier<ItemInfoWithIcon> fallbackIconProvider) {
- Drawable unbadgedDrawable = ShortcutCachingLogic.getIcon(
- mContext, shortcutInfo, mFillResIconDpi);
- IconCache cache = LauncherAppState.getInstance(mContext).getIconCache();
- final Bitmap unbadgedBitmap;
- if (unbadgedDrawable != null) {
- unbadgedBitmap = createScaledBitmapWithoutShadow(unbadgedDrawable, 0);
- } else {
- if (fallbackIconProvider != null) {
- // Fallback icons are already badged and with appropriate shadow
- ItemInfoWithIcon fullIcon = fallbackIconProvider.get();
- if (fullIcon != null && fullIcon.bitmap != null) {
- return fullIcon.bitmap;
- }
- }
- unbadgedBitmap = cache.getDefaultIcon(Process.myUserHandle()).icon;
- }
-
- if (!badged) {
- return BitmapInfo.of(unbadgedBitmap, Themes.getColorAccent(mContext));
- }
-
- final Bitmap unbadgedfinal = unbadgedBitmap;
- final ItemInfoWithIcon badge = getShortcutInfoBadge(shortcutInfo, cache);
-
- Bitmap icon = BitmapRenderer.createHardwareBitmap(mIconBitmapSize, mIconBitmapSize, (c) -> {
- getShadowGenerator().recreateIcon(unbadgedfinal, c);
- badgeWithDrawable(c, new FastBitmapDrawable(badge.bitmap));
- });
- return BitmapInfo.of(icon, badge.bitmap.color);
- }
-
- @WorkerThread
- public BitmapInfo createShortcutIconCached(ShortcutInfo shortcutInfo, boolean badged,
- boolean useCache, @Nullable Supplier<ItemInfoWithIcon> fallbackIconProvider) {
- IconCache cache = LauncherAppState.getInstance(mContext).getIconCache();
- final BitmapInfo bitmapInfo;
- if (useCache) {
- bitmapInfo = cache.getDeepShortcutTitleAndIcon(shortcutInfo).bitmap;
- } else {
- bitmapInfo = new ShortcutCachingLogic().loadIcon(mContext, shortcutInfo);
- }
- final Bitmap unbadgedBitmap;
- if (bitmapInfo.icon != null) {
- unbadgedBitmap = bitmapInfo.icon;
- } else {
- if (fallbackIconProvider != null) {
- // Fallback icons are already badged and with appropriate shadow
- ItemInfoWithIcon fullIcon = fallbackIconProvider.get();
- if (fullIcon != null && fullIcon.bitmap != null) {
- return fullIcon.bitmap;
- }
- }
- unbadgedBitmap = cache.getDefaultIcon(Process.myUserHandle()).icon;
- }
-
- if (!badged) {
- return BitmapInfo.of(unbadgedBitmap, Themes.getColorAccent(mContext));
- }
-
- final Bitmap unbadgedfinal = unbadgedBitmap;
- final ItemInfoWithIcon badge = getShortcutInfoBadge(shortcutInfo, cache);
-
- Bitmap icon = BitmapRenderer.createHardwareBitmap(mIconBitmapSize, mIconBitmapSize, (c) -> {
- getShadowGenerator().recreateIcon(unbadgedfinal, c);
- badgeWithDrawable(c, new FastBitmapDrawable(badge.bitmap));
- });
- return BitmapInfo.of(icon, badge.bitmap.color);
- }
-
- public ItemInfoWithIcon getShortcutInfoBadge(ShortcutInfo shortcutInfo, IconCache cache) {
- ComponentName cn = shortcutInfo.getActivity();
- String badgePkg = shortcutInfo.getPackage();
- boolean hasBadgePkgSet = !badgePkg.equals(shortcutInfo.getPackage());
- if (cn != null && !hasBadgePkgSet) {
- // Get the app info for the source activity.
- AppInfo appInfo = new AppInfo();
- appInfo.user = shortcutInfo.getUserHandle();
- appInfo.componentName = cn;
- appInfo.intent = new Intent(Intent.ACTION_MAIN)
- .addCategory(Intent.CATEGORY_LAUNCHER)
- .setComponent(cn);
- cache.getTitleAndIcon(appInfo, false);
- return appInfo;
- } else {
- PackageItemInfo pkgInfo = new PackageItemInfo(badgePkg);
- cache.getTitleAndIconForApp(pkgInfo, false);
- return pkgInfo;
- }
- }
}
diff --git a/src/com/android/launcher3/icons/ShortcutCachingLogic.java b/src/com/android/launcher3/icons/ShortcutCachingLogic.java
index b856dd1..d7eed06 100644
--- a/src/com/android/launcher3/icons/ShortcutCachingLogic.java
+++ b/src/com/android/launcher3/icons/ShortcutCachingLogic.java
@@ -25,6 +25,7 @@
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.Drawable;
import android.os.UserHandle;
+import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.NonNull;
@@ -57,6 +58,12 @@
return info.getShortLabel();
}
+ @Override
+ public CharSequence getDescription(ShortcutInfo object, CharSequence fallback) {
+ CharSequence label = object.getLongLabel();
+ return TextUtils.isEmpty(label) ? fallback : label;
+ }
+
@NonNull
@Override
public BitmapInfo loadIcon(Context context, ShortcutInfo info) {
diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java
index 95268d0..4961432 100644
--- a/src/com/android/launcher3/model/LoaderCursor.java
+++ b/src/com/android/launcher3/model/LoaderCursor.java
@@ -16,6 +16,8 @@
package com.android.launcher3.model;
+import static android.graphics.BitmapFactory.decodeByteArray;
+
import android.content.ComponentName;
import android.content.ContentValues;
import android.content.Context;
@@ -26,7 +28,6 @@
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.database.CursorWrapper;
-import android.graphics.BitmapFactory;
import android.os.UserHandle;
import android.provider.BaseColumns;
import android.text.TextUtils;
@@ -166,37 +167,30 @@
*/
protected boolean loadIcon(WorkspaceItemInfo info) {
try (LauncherIcons li = LauncherIcons.obtain(mContext)) {
- return loadIcon(info, li);
- }
- }
-
- /**
- * Loads the icon from the cursor and updates the {@param info} if the icon is an app resource.
- */
- protected boolean loadIcon(WorkspaceItemInfo info, LauncherIcons li) {
- if (itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
- String packageName = getString(iconPackageIndex);
- String resourceName = getString(iconResourceIndex);
- if (!TextUtils.isEmpty(packageName) || !TextUtils.isEmpty(resourceName)) {
- info.iconResource = new ShortcutIconResource();
- info.iconResource.packageName = packageName;
- info.iconResource.resourceName = resourceName;
- BitmapInfo iconInfo = li.createIconBitmap(info.iconResource);
- if (iconInfo != null) {
- info.bitmap = iconInfo;
- return true;
+ if (itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) {
+ String packageName = getString(iconPackageIndex);
+ String resourceName = getString(iconResourceIndex);
+ if (!TextUtils.isEmpty(packageName) || !TextUtils.isEmpty(resourceName)) {
+ info.iconResource = new ShortcutIconResource();
+ info.iconResource.packageName = packageName;
+ info.iconResource.resourceName = resourceName;
+ BitmapInfo iconInfo = li.createIconBitmap(info.iconResource);
+ if (iconInfo != null) {
+ info.bitmap = iconInfo;
+ return true;
+ }
}
}
- }
- // Failed to load from resource, try loading from DB.
- byte[] data = getBlob(iconIndex);
- try {
- info.bitmap = li.createIconBitmap(BitmapFactory.decodeByteArray(data, 0, data.length));
- return true;
- } catch (Exception e) {
- Log.e(TAG, "Failed to decode byte array for info " + info, e);
- return false;
+ // Failed to load from resource, try loading from DB.
+ byte[] data = getBlob(iconIndex);
+ try {
+ info.bitmap = li.createIconBitmap(decodeByteArray(data, 0, data.length));
+ return true;
+ } catch (Exception e) {
+ Log.e(TAG, "Failed to decode byte array for info " + info, e);
+ return false;
+ }
}
}
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index ec23f98..8dc7a3a 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -36,7 +36,6 @@
import android.content.pm.PackageInstaller;
import android.content.pm.PackageInstaller.SessionInfo;
import android.content.pm.ShortcutInfo;
-import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
@@ -51,7 +50,6 @@
import com.android.launcher3.FolderInfo;
import com.android.launcher3.InstallShortcutReceiver;
import com.android.launcher3.ItemInfo;
-import com.android.launcher3.ItemInfoWithIcon;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherAppWidgetInfo;
import com.android.launcher3.LauncherModel;
@@ -62,11 +60,10 @@
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderGridOrganizer;
import com.android.launcher3.folder.FolderNameProvider;
-import com.android.launcher3.icons.ComponentWithLabel;
-import com.android.launcher3.icons.ComponentWithLabel.ComponentCachingLogic;
+import com.android.launcher3.icons.ComponentWithLabelAndIcon;
+import com.android.launcher3.icons.ComponentWithLabelAndIcon.ComponentWithIconCachingLogic;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.icons.LauncherActivityCachingLogic;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.icons.ShortcutCachingLogic;
import com.android.launcher3.icons.cache.IconCacheUpdateHandler;
import com.android.launcher3.logging.FileLog;
@@ -95,7 +92,6 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.CancellationException;
-import java.util.function.Supplier;
/**
* Runnable for the thread that loads the contents of the launcher:
@@ -264,7 +260,8 @@
verifyNotStopped();
// fourth step
- List<ComponentWithLabel> allWidgetsList = mBgDataModel.widgetsModel.update(mApp, null);
+ List<ComponentWithLabelAndIcon> allWidgetsList =
+ mBgDataModel.widgetsModel.update(mApp, null);
logger.addSplit("load widgets");
verifyNotStopped();
@@ -272,8 +269,9 @@
logger.addSplit("bindWidgets");
verifyNotStopped();
- updateHandler.updateIcons(allWidgetsList, new ComponentCachingLogic(
- mApp.getContext(), true), mApp.getModel()::onWidgetLabelsUpdated);
+ updateHandler.updateIcons(allWidgetsList,
+ new ComponentWithIconCachingLogic(mApp.getContext(), true),
+ mApp.getModel()::onWidgetLabelsUpdated);
logger.addSplit("save widgets in icon cache");
// fifth step
@@ -547,17 +545,10 @@
continue;
}
info = new WorkspaceItemInfo(pinnedShortcut, context);
- final WorkspaceItemInfo finalInfo = info;
-
- LauncherIcons li = LauncherIcons.obtain(context);
// If the pinned deep shortcut is no longer published,
// use the last saved icon instead of the default.
- Supplier<ItemInfoWithIcon> fallbackIconProvider = () ->
- c.loadIcon(finalInfo, li) ? finalInfo : null;
- info.bitmap = li.createShortcutIcon(
- pinnedShortcut, true /* badged */,
- fallbackIconProvider);
- li.recycle();
+ mIconCache.getShortcutIcon(info, pinnedShortcut, c::loadIcon);
+
if (pmHelper.isAppSuspended(
pinnedShortcut.getPackage(), info.user)) {
info.runtimeStatusFlags |= FLAG_DISABLED_SUSPENDED;
@@ -857,23 +848,23 @@
private void setIgnorePackages(IconCacheUpdateHandler updateHandler) {
// Ignore packages which have a promise icon.
- HashSet<String> packagesToIgnore = new HashSet<>();
synchronized (mBgDataModel) {
for (ItemInfo info : mBgDataModel.itemsIdMap) {
if (info instanceof WorkspaceItemInfo) {
WorkspaceItemInfo si = (WorkspaceItemInfo) info;
if (si.isPromise() && si.getTargetComponent() != null) {
- packagesToIgnore.add(si.getTargetComponent().getPackageName());
+ updateHandler.addPackagesToIgnore(
+ si.user, si.getTargetComponent().getPackageName());
}
} else if (info instanceof LauncherAppWidgetInfo) {
LauncherAppWidgetInfo lawi = (LauncherAppWidgetInfo) info;
if (lawi.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY)) {
- packagesToIgnore.add(lawi.providerName.getPackageName());
+ updateHandler.addPackagesToIgnore(
+ lawi.user, lawi.providerName.getPackageName());
}
}
}
}
- updateHandler.setPackagesToIgnore(Process.myUserHandle(), packagesToIgnore);
}
private List<LauncherActivityInfo> loadAllApps() {
diff --git a/src/com/android/launcher3/model/ShortcutsChangedTask.java b/src/com/android/launcher3/model/ShortcutsChangedTask.java
index b0e7a69..3f79ad0 100644
--- a/src/com/android/launcher3/model/ShortcutsChangedTask.java
+++ b/src/com/android/launcher3/model/ShortcutsChangedTask.java
@@ -23,7 +23,6 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.WorkspaceItemInfo;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -89,12 +88,7 @@
}
for (final WorkspaceItemInfo workspaceItemInfo : workspaceItemInfos) {
workspaceItemInfo.updateFromDeepShortcutInfo(fullDetails, context);
- // If the shortcut is pinned but no longer has an icon in the system,
- // keep the current icon instead of reverting to the default icon.
- LauncherIcons li = LauncherIcons.obtain(context);
- workspaceItemInfo.bitmap = li.createShortcutIcon(
- fullDetails, true, () -> workspaceItemInfo);
- li.recycle();
+ app.getIconCache().getShortcutIcon(workspaceItemInfo, fullDetails);
updatedWorkspaceItemInfos.add(workspaceItemInfo);
}
}
diff --git a/src/com/android/launcher3/model/UserLockStateChangedTask.java b/src/com/android/launcher3/model/UserLockStateChangedTask.java
index d527423..a3adc82 100644
--- a/src/com/android/launcher3/model/UserLockStateChangedTask.java
+++ b/src/com/android/launcher3/model/UserLockStateChangedTask.java
@@ -26,7 +26,6 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.WorkspaceItemInfo;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.shortcuts.ShortcutRequest;
import com.android.launcher3.shortcuts.ShortcutRequest.QueryResult;
@@ -89,11 +88,7 @@
}
si.runtimeStatusFlags &= ~FLAG_DISABLED_LOCKED_USER;
si.updateFromDeepShortcutInfo(shortcut, context);
- // If the shortcut is pinned but no longer has an icon in the system,
- // keep the current icon instead of reverting to the default icon.
- LauncherIcons li = LauncherIcons.obtain(context);
- si.bitmap = li.createShortcutIcon(shortcut, true, () -> si);
- li.recycle();
+ app.getIconCache().getShortcutIcon(si, shortcut);
} else {
si.runtimeStatusFlags |= FLAG_DISABLED_LOCKED_USER;
}
diff --git a/src/com/android/launcher3/pm/PinRequestHelper.java b/src/com/android/launcher3/pm/PinRequestHelper.java
index a15399d..74a5a31 100644
--- a/src/com/android/launcher3/pm/PinRequestHelper.java
+++ b/src/com/android/launcher3/pm/PinRequestHelper.java
@@ -17,7 +17,6 @@
package com.android.launcher3.pm;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
-import static com.android.launcher3.util.ShortcutUtil.fetchAndUpdateShortcutIconAsync;
import android.annotation.TargetApi;
import android.content.Context;
@@ -32,8 +31,7 @@
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.WorkspaceItemInfo;
-import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.icons.LauncherIcons;
+import com.android.launcher3.icons.ShortcutCachingLogic;
public class PinRequestHelper {
@@ -82,16 +80,10 @@
ShortcutInfo si = request.getShortcutInfo();
WorkspaceItemInfo info = new WorkspaceItemInfo(si, context);
- // Apply the unbadged icon and fetch the actual icon asynchronously.
- if (FeatureFlags.ENABLE_DEEP_SHORTCUT_ICON_CACHE.get()) {
- fetchAndUpdateShortcutIconAsync(context, info, si, false);
- } else {
- LauncherIcons li = LauncherIcons.obtain(context);
- info.bitmap = li.createShortcutIcon(si, false /* badged */);
- li.recycle();
- LauncherAppState.getInstance(context).getModel()
- .updateAndBindWorkspaceItem(info, si);
- }
+ // Apply the unbadged icon synchronously using the caching logic directly and
+ // fetch the actual icon asynchronously.
+ info.bitmap = new ShortcutCachingLogic().loadIcon(context, si);
+ LauncherAppState.getInstance(context).getModel().updateAndBindWorkspaceItem(info, si);
return info;
} else {
return null;
diff --git a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java
index b563171..ac0e065 100644
--- a/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java
+++ b/src/com/android/launcher3/pm/ShortcutConfigActivityInfo.java
@@ -41,7 +41,7 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.WorkspaceItemInfo;
-import com.android.launcher3.icons.ComponentWithLabel;
+import com.android.launcher3.icons.ComponentWithLabelAndIcon;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.util.PackageUserKey;
@@ -51,7 +51,7 @@
/**
* Wrapper class for representing a shortcut configure activity.
*/
-public abstract class ShortcutConfigActivityInfo implements ComponentWithLabel {
+public abstract class ShortcutConfigActivityInfo implements ComponentWithLabelAndIcon {
private static final String TAG = "SCActivityInfo";
@@ -77,6 +77,7 @@
return LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
}
+ @Override
public abstract Drawable getFullResIcon(IconCache cache);
/**
diff --git a/src/com/android/launcher3/popup/PopupPopulator.java b/src/com/android/launcher3/popup/PopupPopulator.java
index 9faeb40..fdcf04f 100644
--- a/src/com/android/launcher3/popup/PopupPopulator.java
+++ b/src/com/android/launcher3/popup/PopupPopulator.java
@@ -26,8 +26,9 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.ItemInfo;
+import com.android.launcher3.LauncherAppState;
import com.android.launcher3.WorkspaceItemInfo;
-import com.android.launcher3.icons.LauncherIcons;
+import com.android.launcher3.icons.IconCache;
import com.android.launcher3.notification.NotificationInfo;
import com.android.launcher3.notification.NotificationKeyData;
import com.android.launcher3.notification.NotificationListener;
@@ -153,13 +154,11 @@
String shortcutIdToDeDupe = notificationKeys.isEmpty() ? null
: notificationKeys.get(0).shortcutId;
shortcuts = PopupPopulator.sortAndFilterShortcuts(shortcuts, shortcutIdToDeDupe);
+ IconCache cache = LauncherAppState.getInstance(launcher).getIconCache();
for (int i = 0; i < shortcuts.size() && i < shortcutViews.size(); i++) {
final ShortcutInfo shortcut = shortcuts.get(i);
final WorkspaceItemInfo si = new WorkspaceItemInfo(shortcut, launcher);
- // Use unbadged icon for the menu.
- LauncherIcons li = LauncherIcons.obtain(launcher);
- si.bitmap = li.createShortcutIcon(shortcut, false /* badged */);
- li.recycle();
+ cache.getUnbadgedShortcutIcon(si, shortcut);
si.rank = i;
final DeepShortcutView view = shortcutViews.get(i);
diff --git a/src/com/android/launcher3/states/HintState.java b/src/com/android/launcher3/states/HintState.java
index cb56097..290dbb6 100644
--- a/src/com/android/launcher3/states/HintState.java
+++ b/src/com/android/launcher3/states/HintState.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.states;
-import static com.android.launcher3.LauncherAnimUtils.HINT_TRANSITION_MS;
-
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Workspace;
@@ -31,7 +29,12 @@
| FLAG_HAS_SYS_UI_SCRIM;
public HintState(int id) {
- super(id, ContainerType.DEFAULT_CONTAINERTYPE, HINT_TRANSITION_MS, STATE_FLAGS);
+ super(id, ContainerType.DEFAULT_CONTAINERTYPE, STATE_FLAGS);
+ }
+
+ @Override
+ public int getTransitionDuration(Launcher launcher) {
+ return 80;
}
@Override
diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java
index be3e6c9..97c67c5 100644
--- a/src/com/android/launcher3/states/SpringLoadedState.java
+++ b/src/com/android/launcher3/states/SpringLoadedState.java
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.states;
-import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_TRANSITION_MS;
import static com.android.launcher3.states.RotationHelper.REQUEST_LOCK;
import android.graphics.Rect;
@@ -37,7 +36,12 @@
FLAG_DISABLE_PAGE_CLIPPING | FLAG_PAGE_BACKGROUNDS | FLAG_HIDE_BACK_BUTTON;
public SpringLoadedState(int id) {
- super(id, ContainerType.OVERVIEW, SPRING_LOADED_TRANSITION_MS, STATE_FLAGS);
+ super(id, ContainerType.OVERVIEW, STATE_FLAGS);
+ }
+
+ @Override
+ public int getTransitionDuration(Launcher launcher) {
+ return 150;
}
@Override
diff --git a/src/com/android/launcher3/util/ShortcutUtil.java b/src/com/android/launcher3/util/ShortcutUtil.java
index a03b743..49c97da 100644
--- a/src/com/android/launcher3/util/ShortcutUtil.java
+++ b/src/com/android/launcher3/util/ShortcutUtil.java
@@ -15,19 +15,10 @@
*/
package com.android.launcher3.util;
-import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
-
-import android.content.Context;
-import android.content.pm.ShortcutInfo;
-
-import androidx.annotation.NonNull;
-
import com.android.launcher3.ItemInfo;
-import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.Utilities;
import com.android.launcher3.WorkspaceItemInfo;
-import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.shortcuts.ShortcutKey;
@@ -70,21 +61,6 @@
&& info instanceof WorkspaceItemInfo;
}
- /**
- * Fetch the shortcut icon in background, then update the UI.
- */
- public static void fetchAndUpdateShortcutIconAsync(
- @NonNull Context context, @NonNull WorkspaceItemInfo info, @NonNull ShortcutInfo si,
- boolean badged) {
- MODEL_EXECUTOR.execute(() -> {
- try (LauncherIcons li = LauncherIcons.obtain(context)) {
- info.bitmap = li.createShortcutIcon(si, badged, null);
- LauncherAppState.getInstance(context).getModel()
- .updateAndBindWorkspaceItem(info, si);
- }
- });
- }
-
private static boolean isActive(ItemInfo info) {
boolean isLoading = info instanceof WorkspaceItemInfo
&& ((WorkspaceItemInfo) info).hasPromiseIconUi();
diff --git a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java
index 22c0874..5ebf8d3 100644
--- a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java
+++ b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java
@@ -21,7 +21,7 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AlphabeticIndexCompat;
import com.android.launcher3.config.FeatureFlags;
-import com.android.launcher3.icons.ComponentWithLabel;
+import com.android.launcher3.icons.ComponentWithLabelAndIcon;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.pm.ShortcutConfigActivityInfo;
import com.android.launcher3.util.MultiHashMap;
@@ -85,12 +85,13 @@
* @param packageUser If null, all widgets and shortcuts are updated and returned, otherwise
* only widgets and shortcuts associated with the package/user are.
*/
- public List<ComponentWithLabel> update(LauncherAppState app, @Nullable PackageUserKey packageUser) {
+ public List<ComponentWithLabelAndIcon> update(
+ LauncherAppState app, @Nullable PackageUserKey packageUser) {
Preconditions.assertWorkerThread();
Context context = app.getContext();
final ArrayList<WidgetItem> widgetsAndShortcuts = new ArrayList<>();
- List<ComponentWithLabel> updatedItems = new ArrayList<>();
+ List<ComponentWithLabelAndIcon> updatedItems = new ArrayList<>();
try {
InvariantDeviceProfile idp = app.getInvariantDeviceProfile();
PackageManager pm = app.getContext().getPackageManager();
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
index 7006d77..a56801f 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -15,7 +15,6 @@
*/
package com.android.launcher3.uioverrides.states;
-import static com.android.launcher3.LauncherAnimUtils.ALL_APPS_TRANSITION_MS;
import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
@@ -42,7 +41,12 @@
};
public AllAppsState(int id) {
- super(id, ContainerType.ALLAPPS, ALL_APPS_TRANSITION_MS, STATE_FLAGS);
+ super(id, ContainerType.ALLAPPS, STATE_FLAGS);
+ }
+
+ @Override
+ public int getTransitionDuration(Launcher context) {
+ return 320;
}
@Override
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
index aeba788..e20b2ca 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -15,8 +15,7 @@
*/
package com.android.launcher3.uioverrides.states;
-import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
-
+import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -26,7 +25,12 @@
public class OverviewState extends LauncherState {
public OverviewState(int id) {
- super(id, ContainerType.WORKSPACE, OVERVIEW_TRANSITION_MS, FLAG_DISABLE_RESTORE);
+ super(id, ContainerType.WORKSPACE, FLAG_DISABLE_RESTORE);
+ }
+
+ @Override
+ public int getTransitionDuration(Launcher context) {
+ return 250;
}
public static OverviewState newBackgroundState(int id) {
diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
index 9b9b2d6..4b1a067 100644
--- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
@@ -71,6 +71,7 @@
@Test
@PortraitLandscape
+ @Ignore // b/148867106
public void testWidgetConfig() throws Throwable {
runTest(true);
}
diff --git a/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java b/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java
index d6dfdd9..6445501 100644
--- a/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java
+++ b/tests/src/com/android/launcher3/util/rule/FailureInvestigator.java
@@ -55,7 +55,7 @@
private static final ExceptionMatch[] EXCEPTION_MATCHES = {
new ExceptionMatch(
"java.lang.AssertionError: http://go/tapl : Tests are broken by a "
- + "non-Launcher system error: Phone is locked",
+ + "non-Launcher system error: (Phone is locked|Screen is empty)",
new LogcatMatch[]{
new LogcatMatch(
"BroadcastQueue: Can't deliver broadcast to com.android"
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 4089897..83e1b38 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -341,7 +341,8 @@
public void checkForAnomaly() {
final String anomalyMessage = getAnomalyMessage();
if (anomalyMessage != null) {
- String message = "Tests are broken by a non-Launcher system error: " + anomalyMessage;
+ String message = "http://go/tapl : Tests are broken by a non-Launcher system error: "
+ + anomalyMessage;
log("Hierarchy dump for: " + message);
dumpViewHierarchy();