summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/BaseContainerView.java2
-rw-r--r--src/com/android/launcher3/Launcher.java189
-rw-r--r--src/com/android/launcher3/LauncherModel.java19
-rw-r--r--src/com/android/launcher3/LauncherRootView.java29
-rw-r--r--src/com/android/launcher3/LauncherStateTransitionAnimation.java24
-rw-r--r--src/com/android/launcher3/UninstallDropTarget.java20
-rw-r--r--src/com/android/launcher3/WorkspaceStateTransitionAnimation.java10
-rw-r--r--src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java4
-rw-r--r--src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java2
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java69
-rw-r--r--src/com/android/launcher3/allapps/AlphabeticalAppsList.java13
-rw-r--r--src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java3
-rw-r--r--src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java6
-rw-r--r--src/com/android/launcher3/config/BaseFlags.java1
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java2
-rw-r--r--src/com/android/launcher3/graphics/IconNormalizer.java18
-rw-r--r--src/com/android/launcher3/model/AddWorkspaceItemsTask.java2
-rw-r--r--src/com/android/launcher3/model/BaseModelUpdateTask.java26
-rw-r--r--src/com/android/launcher3/model/CacheDataUpdatedTask.java2
-rw-r--r--src/com/android/launcher3/model/LoaderResults.java39
-rw-r--r--src/com/android/launcher3/model/PackageUpdatedTask.java68
-rw-r--r--src/com/android/launcher3/model/ShortcutsChangedTask.java37
-rw-r--r--src/com/android/launcher3/model/UserLockStateChangedTask.java16
-rw-r--r--src/com/android/launcher3/util/ItemInfoMatcher.java37
-rw-r--r--src/com/android/launcher3/util/RunnableWithId.java36
-rw-r--r--src/com/android/launcher3/util/SystemUiController.java3
-rw-r--r--tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java2
-rw-r--r--tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java2
28 files changed, 294 insertions, 387 deletions
diff --git a/src/com/android/launcher3/BaseContainerView.java b/src/com/android/launcher3/BaseContainerView.java
index c55a5860e..82175b721 100644
--- a/src/com/android/launcher3/BaseContainerView.java
+++ b/src/com/android/launcher3/BaseContainerView.java
@@ -62,7 +62,7 @@ public abstract class BaseContainerView extends FrameLayout
public BaseContainerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && this instanceof AllAppsContainerView) {
+ if (this instanceof AllAppsContainerView) {
mBaseDrawable = new ColorDrawable();
} else {
TypedArray a = context.obtainStyledAttributes(attrs,
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 615ec4716..8492a7985 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -119,6 +119,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType;
import com.android.launcher3.util.ActivityResultInfo;
+import com.android.launcher3.util.RunnableWithId;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.MultiHashMap;
@@ -146,6 +147,9 @@ import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
+import static com.android.launcher3.util.RunnableWithId.RUNNABLE_ID_BIND_APPS;
+import static com.android.launcher3.util.RunnableWithId.RUNNABLE_ID_BIND_WIDGETS;
+
/**
* Default launcher application.
*/
@@ -246,7 +250,6 @@ public class Launcher extends BaseActivity
// Main container view and the model for the widget tray screen.
@Thunk WidgetsContainerView mWidgetsView;
- @Thunk MultiHashMap<PackageItemInfo, WidgetItem> mAllWidgets;
// We set the state in both onCreate and then onNewIntent in some cases, which causes both
// scroll issues (because the workspace may not have been measured yet) and extra work.
@@ -1307,9 +1310,7 @@ public class Launcher extends BaseActivity
mDragController.addDropTarget(mWorkspace);
mDropTargetBar.setup(mDragController);
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
- mAllAppsController.setupViews(mAppsView, mHotseat, mWorkspace);
- }
+ mAllAppsController.setupViews(mAppsView, mHotseat, mWorkspace);
if (TestingUtils.MEMORY_DUMP_ENABLED) {
TestingUtils.addWeightWatcher(this);
@@ -2277,7 +2278,7 @@ public class Launcher extends BaseActivity
if (v instanceof FolderIcon) {
onClickFolderIcon(v);
}
- } else if ((FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && v instanceof PageIndicator) ||
+ } else if ((v instanceof PageIndicator) ||
(v == mAllAppsButton && mAllAppsButton != null)) {
onClickAllAppsButton(v);
} else if (tag instanceof AppInfo) {
@@ -3113,12 +3114,12 @@ public class Launcher extends BaseActivity
*
* @return {@code true} if we are currently paused. The caller might be able to skip some work
*/
- @Thunk boolean waitUntilResume(Runnable run, boolean deletePreviousRunnables) {
+ @Thunk boolean waitUntilResume(Runnable run) {
if (mPaused) {
if (LOGD) Log.d(TAG, "Deferring update until onResume");
- if (deletePreviousRunnables) {
- while (mBindOnResumeCallbacks.remove(run)) {
- }
+ if (run instanceof RunnableWithId) {
+ // Remove any runnables which have the same id
+ while (mBindOnResumeCallbacks.remove(run)) { }
}
mBindOnResumeCallbacks.add(run);
return true;
@@ -3127,10 +3128,6 @@ public class Launcher extends BaseActivity
}
}
- private boolean waitUntilResume(Runnable run) {
- return waitUntilResume(run, false);
- }
-
public void addOnResumeCallback(Runnable run) {
mOnResumeCallbacks.add(run);
}
@@ -3249,13 +3246,13 @@ public class Launcher extends BaseActivity
}
}
+ @Override
public void bindAppsAdded(final ArrayList<Long> newScreens,
final ArrayList<ItemInfo> addNotAnimated,
- final ArrayList<ItemInfo> addAnimated,
- final ArrayList<AppInfo> addedApps) {
+ final ArrayList<ItemInfo> addAnimated) {
Runnable r = new Runnable() {
public void run() {
- bindAppsAdded(newScreens, addNotAnimated, addAnimated, addedApps);
+ bindAppsAdded(newScreens, addNotAnimated, addAnimated);
}
};
if (waitUntilResume(r)) {
@@ -3270,20 +3267,14 @@ public class Launcher extends BaseActivity
// We add the items without animation on non-visible pages, and with
// animations on the new page (which we will try and snap to).
if (addNotAnimated != null && !addNotAnimated.isEmpty()) {
- bindItems(addNotAnimated, 0,
- addNotAnimated.size(), false);
+ bindItems(addNotAnimated, false);
}
if (addAnimated != null && !addAnimated.isEmpty()) {
- bindItems(addAnimated, 0,
- addAnimated.size(), true);
+ bindItems(addAnimated, true);
}
// Remove the extra empty screen
mWorkspace.removeExtraEmptyScreen(false, false);
-
- if (addedApps != null && mAppsView != null) {
- mAppsView.addApps(addedApps);
- }
}
/**
@@ -3292,11 +3283,10 @@ public class Launcher extends BaseActivity
* Implementation of the method from LauncherModel.Callbacks.
*/
@Override
- public void bindItems(final ArrayList<ItemInfo> items, final int start, final int end,
- final boolean forceAnimateIcons) {
+ public void bindItems(final List<ItemInfo> items, final boolean forceAnimateIcons) {
Runnable r = new Runnable() {
public void run() {
- bindItems(items, start, end, forceAnimateIcons);
+ bindItems(items, forceAnimateIcons);
}
};
if (waitUntilResume(r)) {
@@ -3309,7 +3299,8 @@ public class Launcher extends BaseActivity
final boolean animateIcons = forceAnimateIcons && canRunNewAppsAnimation();
Workspace workspace = mWorkspace;
long newItemsScreenId = -1;
- for (int i = start; i < end; i++) {
+ int end = items.size();
+ for (int i = 0; i < end; i++) {
final ItemInfo item = items.get(i);
// Short circuit if we are loading dock items for a configuration which has no dock
@@ -3334,19 +3325,10 @@ public class Launcher extends BaseActivity
break;
}
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET: {
- LauncherAppWidgetInfo info = (LauncherAppWidgetInfo) item;
- if (mIsSafeModeEnabled) {
- view = new PendingAppWidgetHostView(this, info, mIconCache, true);
- } else {
- LauncherAppWidgetProviderInfo providerInfo =
- mAppWidgetManager.getLauncherAppWidgetInfo(info.appWidgetId);
- if (providerInfo == null) {
- deleteWidgetInfo(info);
- continue;
- }
- view = mAppWidgetHost.createView(this, info.appWidgetId, providerInfo);
+ view = inflateAppWidget((LauncherAppWidgetInfo) item);
+ if (view == null) {
+ continue;
}
- prepareAppWidget((AppWidgetHostView) view, info);
break;
}
default:
@@ -3416,26 +3398,21 @@ public class Launcher extends BaseActivity
/**
* Add the views for a widget to the workspace.
- *
- * Implementation of the method from LauncherModel.Callbacks.
*/
- public void bindAppWidget(final LauncherAppWidgetInfo item) {
- Runnable r = new Runnable() {
- public void run() {
- bindAppWidget(item);
- }
- };
- if (waitUntilResume(r)) {
- return;
+ public void bindAppWidget(LauncherAppWidgetInfo item) {
+ View view = inflateAppWidget(item);
+ if (view != null) {
+ mWorkspace.addInScreen(view, item);
+ mWorkspace.requestLayout();
}
+ }
+ private View inflateAppWidget(LauncherAppWidgetInfo item) {
if (mIsSafeModeEnabled) {
PendingAppWidgetHostView view =
new PendingAppWidgetHostView(this, item, mIconCache, true);
prepareAppWidget(view, item);
- mWorkspace.addInScreen(view, item);
- mWorkspace.requestLayout();
- return;
+ return view;
}
final long start = DEBUG_WIDGETS ? SystemClock.uptimeMillis() : 0;
@@ -3465,7 +3442,7 @@ public class Launcher extends BaseActivity
+ ", as the provider is null");
}
getModelWriter().deleteItemFromDatabase(item);
- return;
+ return null;
}
// If we do not have a valid id, try to bind an id.
@@ -3533,7 +3510,7 @@ public class Launcher extends BaseActivity
if (appWidgetInfo == null) {
FileLog.e(TAG, "Removing invalid widget: id=" + item.appWidgetId);
deleteWidgetInfo(item);
- return;
+ return null;
}
item.minSpanX = appWidgetInfo.minSpanX;
@@ -3543,13 +3520,12 @@ public class Launcher extends BaseActivity
view = new PendingAppWidgetHostView(this, item, mIconCache, false);
}
prepareAppWidget(view, item);
- mWorkspace.addInScreen(view, item);
- mWorkspace.requestLayout();
if (DEBUG_WIDGETS) {
Log.d(TAG, "bound widget id="+item.appWidgetId+" in "
+ (SystemClock.uptimeMillis()-start) + "ms");
}
+ return view;
}
/**
@@ -3685,25 +3661,17 @@ public class Launcher extends BaseActivity
}
/**
- * A runnable that we can dequeue and re-enqueue when all applications are bound (to prevent
- * multiple calls to bind the same list.)
- */
- @Thunk ArrayList<AppInfo> mTmpAppsList;
- private final Runnable mBindAllApplicationsRunnable = new Runnable() {
- public void run() {
- bindAllApplications(mTmpAppsList);
- mTmpAppsList = null;
- }
- };
-
- /**
* Add the icons for all apps.
*
* Implementation of the method from LauncherModel.Callbacks.
*/
public void bindAllApplications(final ArrayList<AppInfo> apps) {
- if (waitUntilResume(mBindAllApplicationsRunnable, true)) {
- mTmpAppsList = apps;
+ Runnable r = new RunnableWithId(RUNNABLE_ID_BIND_APPS) {
+ public void run() {
+ bindAllApplications(apps);
+ }
+ };
+ if (waitUntilResume(r)) {
return;
}
@@ -3711,10 +3679,10 @@ public class Launcher extends BaseActivity
Executor pendingExecutor = getPendingExecutor();
if (pendingExecutor != null && mState != State.APPS) {
// Wait until the fade in animation has finished before setting all apps list.
- mTmpAppsList = apps;
- pendingExecutor.execute(mBindAllApplicationsRunnable);
+ pendingExecutor.execute(r);
return;
}
+
mAppsView.setApps(apps);
}
if (mLauncherCallbacks != null) {
@@ -3744,10 +3712,10 @@ public class Launcher extends BaseActivity
*
* Implementation of the method from LauncherModel.Callbacks.
*/
- public void bindAppsUpdated(final ArrayList<AppInfo> apps) {
+ public void bindAppsAddedOrUpdated(final ArrayList<AppInfo> apps) {
Runnable r = new Runnable() {
public void run() {
- bindAppsUpdated(apps);
+ bindAppsAddedOrUpdated(apps);
}
};
if (waitUntilResume(r)) {
@@ -3755,7 +3723,7 @@ public class Launcher extends BaseActivity
}
if (mAppsView != null) {
- mAppsView.updateApps(apps);
+ mAppsView.addOrUpdateApps(apps);
}
}
@@ -3793,16 +3761,12 @@ public class Launcher extends BaseActivity
* Implementation of the method from LauncherModel.Callbacks.
*
* @param updated list of shortcuts which have changed.
- * @param removed list of shortcuts which were deleted in the background. This can happen when
- * an app gets removed from the system or some of its components are no longer
- * available.
*/
@Override
- public void bindShortcutsChanged(final ArrayList<ShortcutInfo> updated,
- final ArrayList<ShortcutInfo> removed, final UserHandle user) {
+ public void bindShortcutsChanged(final ArrayList<ShortcutInfo> updated, final UserHandle user) {
Runnable r = new Runnable() {
public void run() {
- bindShortcutsChanged(updated, removed, user);
+ bindShortcutsChanged(updated, user);
}
};
if (waitUntilResume(r)) {
@@ -3812,31 +3776,6 @@ public class Launcher extends BaseActivity
if (!updated.isEmpty()) {
mWorkspace.updateShortcuts(updated);
}
-
- if (!removed.isEmpty()) {
- HashSet<ComponentName> removedComponents = new HashSet<>();
- HashSet<ShortcutKey> removedDeepShortcuts = new HashSet<>();
-
- for (ShortcutInfo si : removed) {
- if (si.itemType == Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
- removedDeepShortcuts.add(ShortcutKey.fromItemInfo(si));
- } else {
- removedComponents.add(si.getTargetComponent());
- }
- }
-
- if (!removedComponents.isEmpty()) {
- ItemInfoMatcher matcher = ItemInfoMatcher.ofComponents(removedComponents, user);
- mWorkspace.removeItemsByMatcher(matcher);
- mDragController.onAppsRemoved(matcher);
- }
-
- if (!removedDeepShortcuts.isEmpty()) {
- ItemInfoMatcher matcher = ItemInfoMatcher.ofShortcutKeys(removedDeepShortcuts);
- mWorkspace.removeItemsByMatcher(matcher);
- mDragController.onAppsRemoved(matcher);
- }
- }
}
/**
@@ -3866,28 +3805,17 @@ public class Launcher extends BaseActivity
* package-removal should clear all items by package name.
*/
@Override
- public void bindWorkspaceComponentsRemoved(
- final HashSet<String> packageNames, final HashSet<ComponentName> components,
- final UserHandle user) {
+ public void bindWorkspaceComponentsRemoved(final ItemInfoMatcher matcher) {
Runnable r = new Runnable() {
public void run() {
- bindWorkspaceComponentsRemoved(packageNames, components, user);
+ bindWorkspaceComponentsRemoved(matcher);
}
};
if (waitUntilResume(r)) {
return;
}
- if (!packageNames.isEmpty()) {
- ItemInfoMatcher matcher = ItemInfoMatcher.ofPackages(packageNames, user);
- mWorkspace.removeItemsByMatcher(matcher);
- mDragController.onAppsRemoved(matcher);
-
- }
- if (!components.isEmpty()) {
- ItemInfoMatcher matcher = ItemInfoMatcher.ofComponents(components, user);
- mWorkspace.removeItemsByMatcher(matcher);
- mDragController.onAppsRemoved(matcher);
- }
+ mWorkspace.removeItemsByMatcher(matcher);
+ mDragController.onAppsRemoved(matcher);
}
@Override
@@ -3908,28 +3836,25 @@ public class Launcher extends BaseActivity
}
}
- private final Runnable mBindAllWidgetsRunnable = new Runnable() {
+ @Override
+ public void bindAllWidgets(final MultiHashMap<PackageItemInfo, WidgetItem> allWidgets) {
+ Runnable r = new RunnableWithId(RUNNABLE_ID_BIND_WIDGETS) {
+ @Override
public void run() {
- bindAllWidgets(mAllWidgets);
+ bindAllWidgets(allWidgets);
}
};
-
- @Override
- public void bindAllWidgets(MultiHashMap<PackageItemInfo, WidgetItem> allWidgets) {
- if (waitUntilResume(mBindAllWidgetsRunnable, true)) {
- mAllWidgets = allWidgets;
+ if (waitUntilResume(r)) {
return;
}
if (mWidgetsView != null && allWidgets != null) {
Executor pendingExecutor = getPendingExecutor();
if (pendingExecutor != null && mState != State.WIDGETS) {
- mAllWidgets = allWidgets;
- pendingExecutor.execute(mBindAllWidgetsRunnable);
+ pendingExecutor.execute(r);
return;
}
mWidgetsView.setWidgets(allWidgets);
- mAllWidgets = null;
}
AbstractFloatingView topView = AbstractFloatingView.getTopOpenView(this);
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 100774866..a906b00f1 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -56,6 +56,7 @@ import com.android.launcher3.provider.LauncherDbUtils;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.MultiHashMap;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.Preconditions;
@@ -138,26 +139,20 @@ public class LauncherModel extends BroadcastReceiver
public int getCurrentWorkspaceScreen();
public void clearPendingBinds();
public void startBinding();
- public void bindItems(ArrayList<ItemInfo> shortcuts, int start, int end,
- boolean forceAnimateIcons);
+ public void bindItems(List<ItemInfo> shortcuts, boolean forceAnimateIcons);
public void bindScreens(ArrayList<Long> orderedScreenIds);
public void finishFirstPageBind(ViewOnDrawExecutor executor);
public void finishBindingItems();
- public void bindAppWidget(LauncherAppWidgetInfo info);
public void bindAllApplications(ArrayList<AppInfo> apps);
+ public void bindAppsAddedOrUpdated(ArrayList<AppInfo> apps);
public void bindAppsAdded(ArrayList<Long> newScreens,
ArrayList<ItemInfo> addNotAnimated,
- ArrayList<ItemInfo> addAnimated,
- ArrayList<AppInfo> addedApps);
- public void bindAppsUpdated(ArrayList<AppInfo> apps);
+ ArrayList<ItemInfo> addAnimated);
public void bindPromiseAppProgressUpdated(PromiseAppInfo app);
- public void bindShortcutsChanged(ArrayList<ShortcutInfo> updated,
- ArrayList<ShortcutInfo> removed, UserHandle user);
+ public void bindShortcutsChanged(ArrayList<ShortcutInfo> updated, UserHandle user);
public void bindWidgetsRestored(ArrayList<LauncherAppWidgetInfo> widgets);
public void bindRestoreItemsChange(HashSet<ItemInfo> updates);
- public void bindWorkspaceComponentsRemoved(
- HashSet<String> packageNames, HashSet<ComponentName> components,
- UserHandle user);
+ public void bindWorkspaceComponentsRemoved(ItemInfoMatcher matcher);
public void bindAppInfosRemoved(ArrayList<AppInfo> appInfos);
public void bindAllWidgets(MultiHashMap<PackageItemInfo, WidgetItem> widgets);
public void onPageBoundSynchronously(int page);
@@ -537,7 +532,7 @@ public class LauncherModel extends BroadcastReceiver
scheduleCallbackTask(new CallbackTask() {
@Override
public void execute(Callbacks callbacks) {
- callbacks.bindAppsAdded(null, null, null, arrayList);
+ callbacks.bindAppsAddedOrUpdated(arrayList);
}
});
}
diff --git a/src/com/android/launcher3/LauncherRootView.java b/src/com/android/launcher3/LauncherRootView.java
index 643d48adf..a81432363 100644
--- a/src/com/android/launcher3/LauncherRootView.java
+++ b/src/com/android/launcher3/LauncherRootView.java
@@ -11,6 +11,9 @@ import android.util.AttributeSet;
import android.view.View;
import android.view.ViewDebug;
+import static com.android.launcher3.util.SystemUiController.FLAG_DARK_NAV;
+import static com.android.launcher3.util.SystemUiController.UI_STATE_ROOT_VIEW;
+
public class LauncherRootView extends InsettableFrameLayout {
private final Paint mOpaquePaint;
@@ -44,20 +47,28 @@ public class LauncherRootView extends InsettableFrameLayout {
@TargetApi(23)
@Override
protected boolean fitSystemWindows(Rect insets) {
- boolean rawInsetsChanged = !mInsets.equals(insets);
mDrawSideInsetBar = (insets.right > 0 || insets.left > 0) &&
(!Utilities.ATLEAST_MARSHMALLOW ||
- getContext().getSystemService(ActivityManager.class).isLowRamDevice());
- mRightInsetBarWidth = insets.right;
- mLeftInsetBarWidth = insets.left;
- setInsets(mDrawSideInsetBar ? new Rect(0, insets.top, 0, insets.bottom) : insets);
+ getContext().getSystemService(ActivityManager.class).isLowRamDevice());
+ if (mDrawSideInsetBar) {
+ mLeftInsetBarWidth = insets.left;
+ mRightInsetBarWidth = insets.right;
+ insets = new Rect(0, insets.top, 0, insets.bottom);
+ } else {
+ mLeftInsetBarWidth = mRightInsetBarWidth = 0;
+ }
+ Launcher.getLauncher(getContext()).getSystemUiController().updateUiState(
+ UI_STATE_ROOT_VIEW, mDrawSideInsetBar ? FLAG_DARK_NAV : 0);
+
+ boolean rawInsetsChanged = !mInsets.equals(insets);
+ setInsets(insets);
- if (mAlignedView != null && mDrawSideInsetBar) {
+ if (mAlignedView != null) {
// Apply margins on aligned view to handle left/right insets.
MarginLayoutParams lp = (MarginLayoutParams) mAlignedView.getLayoutParams();
- if (lp.leftMargin != insets.left || lp.rightMargin != insets.right) {
- lp.leftMargin = insets.left;
- lp.rightMargin = insets.right;
+ if (lp.leftMargin != mLeftInsetBarWidth || lp.rightMargin != mRightInsetBarWidth) {
+ lp.leftMargin = mLeftInsetBarWidth;
+ lp.rightMargin = mRightInsetBarWidth;
mAlignedView.setLayoutParams(lp);
}
}
diff --git a/src/com/android/launcher3/LauncherStateTransitionAnimation.java b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
index 9ff61ec98..e2474900d 100644
--- a/src/com/android/launcher3/LauncherStateTransitionAnimation.java
+++ b/src/com/android/launcher3/LauncherStateTransitionAnimation.java
@@ -80,13 +80,11 @@ import com.android.launcher3.widget.WidgetsContainerView;
public class LauncherStateTransitionAnimation {
/**
- * animation used for all apps and widget tray when
- *{@link FeatureFlags#LAUNCHER3_ALL_APPS_PULL_UP} is {@code false}
+ * animation used for the widget tray
*/
public static final int CIRCULAR_REVEAL = 0;
/**
- * animation used for all apps and not widget tray when
- *{@link FeatureFlags#LAUNCHER3_ALL_APPS_PULL_UP} is {@code true}
+ * animation used for all apps tray
*/
public static final int PULLUP = 1;
@@ -154,13 +152,9 @@ public class LauncherStateTransitionAnimation {
mLauncher.getUserEventDispatcher().resetElapsedContainerMillis();
}
};
- int animType = CIRCULAR_REVEAL;
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
- animType = PULLUP;
- }
// Only animate the search bar if animating from spring loaded mode back to all apps
startAnimationToOverlay(
- Workspace.State.NORMAL_HIDDEN, buttonView, toView, animated, animType, cb);
+ Workspace.State.NORMAL_HIDDEN, buttonView, toView, animated, PULLUP, cb);
}
/**
@@ -193,12 +187,8 @@ public class LauncherStateTransitionAnimation {
if (fromState == Launcher.State.APPS || fromState == Launcher.State.APPS_SPRING_LOADED
|| mAllAppsController.isTransitioning()) {
- int animType = CIRCULAR_REVEAL;
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
- animType = PULLUP;
- }
startAnimationToWorkspaceFromAllApps(fromWorkspaceState, toWorkspaceState,
- animated, animType, onCompleteRunnable);
+ animated, PULLUP, onCompleteRunnable);
} else if (fromState == Launcher.State.WIDGETS ||
fromState == Launcher.State.WIDGETS_SPRING_LOADED) {
startAnimationToWorkspaceFromWidgets(fromWorkspaceState, toWorkspaceState,
@@ -235,8 +225,7 @@ public class LauncherStateTransitionAnimation {
playCommonTransitionAnimations(toWorkspaceState,
animated, initialized, animation, layerViews);
if (!animated || !initialized) {
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
- toWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
+ if (toWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
mAllAppsController.finishPullUp();
}
toView.setTranslationX(0.0f);
@@ -527,8 +516,7 @@ public class LauncherStateTransitionAnimation {
playCommonTransitionAnimations(toWorkspaceState,
animated, initialized, animation, layerViews);
if (!animated || !initialized) {
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
- fromWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
+ if (fromWorkspaceState == Workspace.State.NORMAL_HIDDEN) {
mAllAppsController.finishPullDown();
}
fromView.setVisibility(View.GONE);
diff --git a/src/com/android/launcher3/UninstallDropTarget.java b/src/com/android/launcher3/UninstallDropTarget.java
index 45c14d6bb..e15cf9f50 100644
--- a/src/com/android/launcher3/UninstallDropTarget.java
+++ b/src/com/android/launcher3/UninstallDropTarget.java
@@ -42,7 +42,7 @@ public class UninstallDropTarget extends ButtonDropTarget {
return supportsDrop(getContext(), info);
}
- public static boolean supportsDrop(Context context, Object info) {
+ public static boolean supportsDrop(Context context, ItemInfo info) {
UserManager userManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
Bundle restrictions = userManager.getUserRestrictions();
if (restrictions.getBoolean(UserManager.DISALLOW_APPS_CONTROL, false)
@@ -56,21 +56,13 @@ public class UninstallDropTarget extends ButtonDropTarget {
/**
* @return the component name that should be uninstalled or null.
*/
- private static ComponentName getUninstallTarget(Context context, Object item) {
+ private static ComponentName getUninstallTarget(Context context, ItemInfo item) {
Intent intent = null;
UserHandle user = null;
- if (item instanceof AppInfo) {
- AppInfo info = (AppInfo) item;
- intent = info.intent;
- user = info.user;
- } else if (item instanceof ShortcutInfo) {
- ShortcutInfo info = (ShortcutInfo) item;
- if (info.itemType == LauncherSettings.BaseLauncherColumns.ITEM_TYPE_APPLICATION) {
- // Do not use restore/target intent here as we cannot uninstall an app which is
- // being installed/restored.
- intent = info.intent;
- user = info.user;
- }
+ if (item != null &&
+ item.itemType == LauncherSettings.BaseLauncherColumns.ITEM_TYPE_APPLICATION) {
+ intent = item.getIntent();
+ user = item.user;
}
if (intent != null) {
LauncherActivityInfo info = LauncherAppsCompat.getInstance(context)
diff --git a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
index 76772dce4..a105a7303 100644
--- a/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
+++ b/src/com/android/launcher3/WorkspaceStateTransitionAnimation.java
@@ -273,9 +273,8 @@ public class WorkspaceStateTransitionAnimation {
float finalBackgroundAlpha = (states.stateIsSpringLoaded || states.stateIsOverview) ?
1.0f : 0f;
float finalHotseatAlpha = (states.stateIsNormal || states.stateIsSpringLoaded ||
- (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && states.stateIsNormalHidden)) ? 1f : 0f;
- float finalQsbAlpha = (states.stateIsNormal ||
- (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && states.stateIsNormalHidden)) ? 1f : 0f;
+ states.stateIsNormalHidden) ? 1f : 0f;
+ float finalQsbAlpha = (states.stateIsNormal || states.stateIsNormalHidden) ? 1f : 0f;
float finalWorkspaceTranslationY = 0;
if (states.stateIsOverview || states.stateIsOverviewHidden) {
@@ -312,8 +311,7 @@ public class WorkspaceStateTransitionAnimation {
if (states.stateIsOverviewHidden) {
finalAlpha = 0f;
} else if(states.stateIsNormalHidden) {
- finalAlpha = (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
- i == mWorkspace.getNextPage()) ? 1 : 0;
+ finalAlpha = (i == mWorkspace.getNextPage()) ? 1 : 0;
} else if (states.stateIsNormal && mWorkspaceFadeInAdjacentScreens) {
finalAlpha = (i == toPage || i < customPageCount) ? 1f : 0f;
} else {
@@ -322,7 +320,7 @@ public class WorkspaceStateTransitionAnimation {
// If we are animating to/from the small state, then hide the side pages and fade the
// current page in
- if (!FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && !mWorkspace.isSwitchingState()) {
+ if (!FeatureFlags.NO_ALL_APPS_ICON && !mWorkspace.isSwitchingState()) {
if (states.workspaceToAllApps || states.allAppsToWorkspace) {
boolean isCurrentPage = (i == toPage);
if (states.allAppsToWorkspace && isCurrentPage) {
diff --git a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
index 34335330b..a0ad07aeb 100644
--- a/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/LauncherAccessibilityDelegate.java
@@ -173,7 +173,7 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
ArrayList<ItemInfo> itemList = new ArrayList<>();
itemList.add(info);
- mLauncher.bindItems(itemList, 0, itemList.size(), true);
+ mLauncher.bindItems(itemList, true);
} else if (item instanceof PendingAddItemInfo) {
PendingAddItemInfo info = (PendingAddItemInfo) item;
Workspace workspace = mLauncher.getWorkspace();
@@ -205,7 +205,7 @@ public class LauncherAccessibilityDelegate extends AccessibilityDelegate impleme
public void run() {
ArrayList<ItemInfo> itemList = new ArrayList<>();
itemList.add(item);
- mLauncher.bindItems(itemList, 0, itemList.size(), true);
+ mLauncher.bindItems(itemList, true);
announceConfirmation(R.string.item_moved);
}
});
diff --git a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
index b7c500fa6..5b7353aa1 100644
--- a/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
+++ b/src/com/android/launcher3/accessibility/ShortcutMenuAccessibilityDelegate.java
@@ -73,7 +73,7 @@ public class ShortcutMenuAccessibilityDelegate extends LauncherAccessibilityDele
screenId, coordinates[0], coordinates[1]);
ArrayList<ItemInfo> itemList = new ArrayList<>();
itemList.add(info);
- mLauncher.bindItems(itemList, 0, itemList.size(), true);
+ mLauncher.bindItems(itemList, true);
AbstractFloatingView.closeAllOpenViews(mLauncher);
announceConfirmation(R.string.item_added_to_workspace);
}
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index ede3bea72..97a87c16c 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -102,18 +102,14 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
@Override
protected void updateBackground(
int paddingLeft, int paddingTop, int paddingRight, int paddingBottom) {
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
- if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
- getRevealView().setBackground(new InsetDrawable(mBaseDrawable,
- paddingLeft, paddingTop, paddingRight, paddingBottom));
- getContentView().setBackground(
- new InsetDrawable(new ColorDrawable(Color.TRANSPARENT),
- paddingLeft, paddingTop, paddingRight, paddingBottom));
- } else {
- getRevealView().setBackground(mBaseDrawable);
- }
+ if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
+ getRevealView().setBackground(new InsetDrawable(mBaseDrawable,
+ paddingLeft, paddingTop, paddingRight, paddingBottom));
+ getContentView().setBackground(
+ new InsetDrawable(new ColorDrawable(Color.TRANSPARENT),
+ paddingLeft, paddingTop, paddingRight, paddingBottom));
} else {
- super.updateBackground(paddingLeft, paddingTop, paddingRight, paddingBottom);
+ getRevealView().setBackground(mBaseDrawable);
}
}
@@ -132,18 +128,10 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
}
/**
- * Adds new apps to the list.
- */
- public void addApps(List<AppInfo> apps) {
- mApps.addApps(apps);
- mSearchUiManager.refreshSearchResult();
- }
-
- /**
- * Updates existing apps in the list
+ * Adds or updates existing apps in the list
*/
- public void updateApps(List<AppInfo> apps) {
- mApps.updateApps(apps);
+ public void addOrUpdateApps(List<AppInfo> apps) {
+ mApps.addOrUpdateApps(apps);
mSearchUiManager.refreshSearchResult();
}
@@ -224,8 +212,8 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
mAppsRecyclerView.setLayoutManager(mLayoutManager);
mAppsRecyclerView.setAdapter(mAdapter);
mAppsRecyclerView.setHasFixedSize(true);
- // Removes the animation that can occur when updating the predicted apps in place.
- mAppsRecyclerView.getItemAnimator().setChangeDuration(0);
+ // No animations will occur when changes occur to the items in this RecyclerView.
+ mAppsRecyclerView.setItemAnimator(null);
if (FeatureFlags.LAUNCHER3_PHYSICS) {
mAppsRecyclerView.setSpringAnimationHandler(mSpringAnimationHandler);
}
@@ -240,11 +228,9 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
mAppsRecyclerView.preMeasureViews(mAdapter);
mAdapter.setIconFocusListener(focusedItemDecorator.getFocusListener());
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
- getRevealView().setVisibility(View.VISIBLE);
- getContentView().setVisibility(View.VISIBLE);
- getContentView().setBackground(null);
- }
+ getRevealView().setVisibility(View.VISIBLE);
+ getContentView().setVisibility(View.VISIBLE);
+ getContentView().setBackground(null);
}
public SearchUiManager getSearchUiManager() {
@@ -262,32 +248,15 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
// Update the number of items in the grid before we measure the view
grid.updateAppsViewNumCols();
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
- if (mNumAppsPerRow != grid.inv.numColumns ||
- mNumPredictedAppsPerRow != grid.inv.numColumns) {
- mNumAppsPerRow = grid.inv.numColumns;
- mNumPredictedAppsPerRow = grid.inv.numColumns;
-
- mAppsRecyclerView.setNumAppsPerRow(grid, mNumAppsPerRow);
- mAdapter.setNumAppsPerRow(mNumAppsPerRow);
- mApps.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow);
- }
- super.onMeasure(widthMeasureSpec, heightMeasureSpec);
- return;
- }
-
- // --- remove START when {@code FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP} is enabled. ---
- if (mNumAppsPerRow != grid.allAppsNumCols ||
- mNumPredictedAppsPerRow != grid.allAppsNumPredictiveCols) {
- mNumAppsPerRow = grid.allAppsNumCols;
- mNumPredictedAppsPerRow = grid.allAppsNumPredictiveCols;
+ if (mNumAppsPerRow != grid.inv.numColumns ||
+ mNumPredictedAppsPerRow != grid.inv.numColumns) {
+ mNumAppsPerRow = grid.inv.numColumns;
+ mNumPredictedAppsPerRow = grid.inv.numColumns;
mAppsRecyclerView.setNumAppsPerRow(grid, mNumAppsPerRow);
mAdapter.setNumAppsPerRow(mNumAppsPerRow);
mApps.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow);
}
-
- // --- remove END when {@code FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP} is enabled. ---
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
diff --git a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
index 43b56a4bb..5e7a5cac5 100644
--- a/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
+++ b/src/com/android/launcher3/allapps/AlphabeticalAppsList.java
@@ -374,20 +374,13 @@ public class AlphabeticalAppsList {
*/
public void setApps(List<AppInfo> apps) {
mComponentToAppMap.clear();
- addApps(apps);
+ addOrUpdateApps(apps);
}
/**
- * Adds new apps to the list.
+ * Adds or updates existing apps in the list
*/
- public void addApps(List<AppInfo> apps) {
- updateApps(apps);
- }
-
- /**
- * Updates existing apps in the list
- */
- public void updateApps(List<AppInfo> apps) {
+ public void addOrUpdateApps(List<AppInfo> apps) {
for (AppInfo app : apps) {
mComponentToAppMap.put(app.toComponentKey(), app);
}
diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
index 39e208874..d50455171 100644
--- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
+++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java
@@ -108,8 +108,7 @@ public class AppsSearchContainerLayout extends FrameLayout
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP &&
- !mLauncher.getDeviceProfile().isVerticalBarLayout()) {
+ if (!mLauncher.getDeviceProfile().isVerticalBarLayout()) {
getLayoutParams().height = mLauncher.getDragLayer().getInsets().top + mMinHeight;
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
diff --git a/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java b/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java
index 6233fabb2..fe5ff2a8c 100644
--- a/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java
+++ b/src/com/android/launcher3/compat/WallpaperManagerCompatVOMR1.java
@@ -20,6 +20,7 @@ import android.app.WallpaperManager;
import android.content.Context;
import android.graphics.Color;
import android.os.Build;
+import android.os.Handler;
import android.support.annotation.Nullable;
import android.util.Log;
@@ -48,8 +49,7 @@ public class WallpaperManagerCompatVOMR1 extends WallpaperManagerCompat {
mOCLClass = Class.forName("android.app.WallpaperManager$OnColorsChangedListener");
mAddOCLMethod = WallpaperManager.class.getDeclaredMethod(
- "addOnColorsChangedListener", mOCLClass);
-
+ "addOnColorsChangedListener", mOCLClass, Handler.class);
mWCGetMethod = WallpaperManager.class.getDeclaredMethod("getWallpaperColors", int.class);
Class wallpaperColorsClass = mWCGetMethod.getReturnType();
mWCGetPrimaryColorMethod = wallpaperColorsClass.getDeclaredMethod("getPrimaryColor");
@@ -89,7 +89,7 @@ public class WallpaperManagerCompatVOMR1 extends WallpaperManagerCompat {
}
});
try {
- mAddOCLMethod.invoke(mWm, onChangeListener);
+ mAddOCLMethod.invoke(mWm, onChangeListener, null);
} catch (Exception e) {
Log.e(TAG, "Error calling wallpaper API", e);
}
diff --git a/src/com/android/launcher3/config/BaseFlags.java b/src/com/android/launcher3/config/BaseFlags.java
index a2d84354d..6a4cbcbf0 100644
--- a/src/com/android/launcher3/config/BaseFlags.java
+++ b/src/com/android/launcher3/config/BaseFlags.java
@@ -34,7 +34,6 @@ abstract class BaseFlags {
public static boolean LAUNCHER3_DISABLE_ICON_NORMALIZATION = false;
public static boolean LAUNCHER3_LEGACY_FOLDER_ICON = false;
public static boolean LAUNCHER3_DISABLE_PINCH_TO_OVERVIEW = false;
- public static boolean LAUNCHER3_ALL_APPS_PULL_UP = true;
public static boolean LAUNCHER3_NEW_FOLDER_ANIMATION = true;
// When enabled allows to use any point on the fast scrollbar to start dragging.
public static final boolean LAUNCHER3_DIRECT_SCROLL = true;
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index be5f01adb..ee6a0e0b8 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -243,7 +243,7 @@ public class DragLayer extends InsettableFrameLayout {
return true;
}
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP && mAllAppsController.onControllerInterceptTouchEvent(ev)) {
+ if (mAllAppsController.onControllerInterceptTouchEvent(ev)) {
mActiveController = mAllAppsController;
return true;
}
diff --git a/src/com/android/launcher3/graphics/IconNormalizer.java b/src/com/android/launcher3/graphics/IconNormalizer.java
index 34d0b727c..8ed62bcdc 100644
--- a/src/com/android/launcher3/graphics/IconNormalizer.java
+++ b/src/com/android/launcher3/graphics/IconNormalizer.java
@@ -32,10 +32,8 @@ import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;
-
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.Utilities;
-
import java.io.File;
import java.io.FileOutputStream;
import java.nio.ByteBuffer;
@@ -84,12 +82,12 @@ public class IconNormalizer {
private final Rect mBounds;
private final Matrix mMatrix;
- private Paint mPaintIcon;
- private Canvas mCanvasARGB;
+ private final Paint mPaintIcon;
+ private final Canvas mCanvasARGB;
- private File mDir;
+ private final File mDir;
private int mFileId;
- private Random mRandom;
+ private final Random mRandom;
private IconNormalizer(Context context) {
// Use twice the icon size as maximum size to avoid scaling down twice.
@@ -122,7 +120,6 @@ public class IconNormalizer {
mPaintMaskShapeOutline.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mMatrix = new Matrix();
- int[] mPixels = new int[mMaxSize * mMaxSize];
mAdaptiveIconScale = SCALE_NOT_INITIALIZED;
mDir = context.getExternalFilesDir(null);
@@ -174,7 +171,8 @@ public class IconNormalizer {
boolean isTrans = isTransparentBitmap(mBitmapARGB);
if (DEBUG) {
- final File afterFile = new File(mDir, "isShape" + mFileId + "_after_" + isTrans + ".png");
+ final File afterFile = new File(mDir,
+ "isShape" + mFileId + "_after_" + isTrans + ".png");
try {
mBitmapARGB.compress(Bitmap.CompressFormat.PNG, 100,
new FileOutputStream(afterFile));
@@ -210,7 +208,9 @@ public class IconNormalizer {
float percentageDiffPixels = ((float) sum) / (mBounds.width() * mBounds.height());
boolean transparentImage = percentageDiffPixels < PIXEL_DIFF_PERCENTAGE_THRESHOLD;
if (DEBUG) {
- Log.d(TAG, "Total # pixel that is different (id="+ mFileId + "):" + percentageDiffPixels + "="+ sum + "/" + mBounds.width() * mBounds.height());
+ Log.d(TAG,
+ "Total # pixel that is different (id=" + mFileId + "):" + percentageDiffPixels
+ + "=" + sum + "/" + mBounds.width() * mBounds.height());
}
return transparentImage;
}
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index 68012c4ba..42926fa3e 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -158,7 +158,7 @@ public class AddWorkspaceItemsTask extends BaseModelUpdateTask {
}
}
callbacks.bindAppsAdded(addedWorkspaceScreensFinal,
- addNotAnimated, addAnimated, null);
+ addNotAnimated, addAnimated);
}
});
}
diff --git a/src/com/android/launcher3/model/BaseModelUpdateTask.java b/src/com/android/launcher3/model/BaseModelUpdateTask.java
index 9b4510fca..d5b5aa7cf 100644
--- a/src/com/android/launcher3/model/BaseModelUpdateTask.java
+++ b/src/com/android/launcher3/model/BaseModelUpdateTask.java
@@ -26,6 +26,7 @@ import com.android.launcher3.LauncherModel.CallbackTask;
import com.android.launcher3.LauncherModel.Callbacks;
import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.MultiHashMap;
import java.util.ArrayList;
@@ -94,19 +95,12 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
public void bindUpdatedShortcuts(
- ArrayList<ShortcutInfo> updatedShortcuts, UserHandle user) {
- bindUpdatedShortcuts(updatedShortcuts, new ArrayList<ShortcutInfo>(), user);
- }
-
- public void bindUpdatedShortcuts(
- final ArrayList<ShortcutInfo> updatedShortcuts,
- final ArrayList<ShortcutInfo> removedShortcuts,
- final UserHandle user) {
- if (!updatedShortcuts.isEmpty() || !removedShortcuts.isEmpty()) {
+ final ArrayList<ShortcutInfo> updatedShortcuts, final UserHandle user) {
+ if (!updatedShortcuts.isEmpty()) {
scheduleCallbackTask(new CallbackTask() {
@Override
public void execute(Callbacks callbacks) {
- callbacks.bindShortcutsChanged(updatedShortcuts, removedShortcuts, user);
+ callbacks.bindShortcutsChanged(updatedShortcuts, user);
}
});
}
@@ -132,4 +126,16 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
}
});
}
+
+ public void deleteAndBindComponentsRemoved(final ItemInfoMatcher matcher) {
+ getModelWriter().deleteItemsFromDatabase(matcher);
+
+ // Call the components-removed callback
+ scheduleCallbackTask(new CallbackTask() {
+ @Override
+ public void execute(Callbacks callbacks) {
+ callbacks.bindWorkspaceComponentsRemoved(matcher);
+ }
+ });
+ }
}
diff --git a/src/com/android/launcher3/model/CacheDataUpdatedTask.java b/src/com/android/launcher3/model/CacheDataUpdatedTask.java
index 8597e1048..7a27741c3 100644
--- a/src/com/android/launcher3/model/CacheDataUpdatedTask.java
+++ b/src/com/android/launcher3/model/CacheDataUpdatedTask.java
@@ -77,7 +77,7 @@ public class CacheDataUpdatedTask extends BaseModelUpdateTask {
scheduleCallbackTask(new CallbackTask() {
@Override
public void execute(Callbacks callbacks) {
- callbacks.bindAppsUpdated(updatedApps);
+ callbacks.bindAppsAddedOrUpdated(updatedApps);
}
});
}
diff --git a/src/com/android/launcher3/model/LoaderResults.java b/src/com/android/launcher3/model/LoaderResults.java
index 0df8b6fee..b7a6b68e8 100644
--- a/src/com/android/launcher3/model/LoaderResults.java
+++ b/src/com/android/launcher3/model/LoaderResults.java
@@ -122,7 +122,7 @@ public class LoaderResults {
filterCurrentWorkspaceItems(currentScreenId, workspaceItems, currentWorkspaceItems,
otherWorkspaceItems);
- filterCurrentAppWidgets(currentScreenId, appWidgets, currentAppWidgets,
+ filterCurrentWorkspaceItems(currentScreenId, appWidgets, currentAppWidgets,
otherAppWidgets);
sortWorkspaceItemsSpatially(currentWorkspaceItems);
sortWorkspaceItemsSpatially(otherWorkspaceItems);
@@ -208,12 +208,12 @@ public class LoaderResults {
/** Filters the set of items who are directly or indirectly (via another container) on the
* specified screen. */
- private void filterCurrentWorkspaceItems(long currentScreenId,
- ArrayList<ItemInfo> allWorkspaceItems,
- ArrayList<ItemInfo> currentScreenItems,
- ArrayList<ItemInfo> otherScreenItems) {
+ private <T extends ItemInfo> void filterCurrentWorkspaceItems(long currentScreenId,
+ ArrayList<T> allWorkspaceItems,
+ ArrayList<T> currentScreenItems,
+ ArrayList<T> otherScreenItems) {
// Purge any null ItemInfos
- Iterator<ItemInfo> iter = allWorkspaceItems.iterator();
+ Iterator<T> iter = allWorkspaceItems.iterator();
while (iter.hasNext()) {
ItemInfo i = iter.next();
if (i == null) {
@@ -224,14 +224,14 @@ public class LoaderResults {
// Order the set of items by their containers first, this allows use to walk through the
// list sequentially, build up a list of containers that are in the specified screen,
// as well as all items in those containers.
- Set<Long> itemsOnScreen = new HashSet<Long>();
+ Set<Long> itemsOnScreen = new HashSet<>();
Collections.sort(allWorkspaceItems, new Comparator<ItemInfo>() {
@Override
public int compare(ItemInfo lhs, ItemInfo rhs) {
return Utilities.longCompare(lhs.container, rhs.container);
}
});
- for (ItemInfo info : allWorkspaceItems) {
+ for (T info : allWorkspaceItems) {
if (info.container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
if (info.screenId == currentScreenId) {
currentScreenItems.add(info);
@@ -253,23 +253,6 @@ public class LoaderResults {
}
}
- /** Filters the set of widgets which are on the specified screen. */
- private void filterCurrentAppWidgets(long currentScreenId,
- ArrayList<LauncherAppWidgetInfo> appWidgets,
- ArrayList<LauncherAppWidgetInfo> currentScreenWidgets,
- ArrayList<LauncherAppWidgetInfo> otherScreenWidgets) {
-
- for (LauncherAppWidgetInfo widget : appWidgets) {
- if (widget == null) continue;
- if (widget.container == LauncherSettings.Favorites.CONTAINER_DESKTOP &&
- widget.screenId == currentScreenId) {
- currentScreenWidgets.add(widget);
- } else {
- otherScreenWidgets.add(widget);
- }
- }
- }
-
/** Sorts the set of items by hotseat, workspace (spatially from top to bottom, left to
* right) */
private void sortWorkspaceItemsSpatially(ArrayList<ItemInfo> workspaceItems) {
@@ -322,7 +305,7 @@ public class LoaderResults {
public void run() {
Callbacks callbacks = mCallbacks.get();
if (callbacks != null) {
- callbacks.bindItems(workspaceItems, start, start+chunkSize, false);
+ callbacks.bindItems(workspaceItems.subList(start, start+chunkSize), false);
}
}
};
@@ -332,12 +315,12 @@ public class LoaderResults {
// Bind the widgets, one at a time
N = appWidgets.size();
for (int i = 0; i < N; i++) {
- final LauncherAppWidgetInfo widget = appWidgets.get(i);
+ final ItemInfo widget = appWidgets.get(i);
final Runnable r = new Runnable() {
public void run() {
Callbacks callbacks = mCallbacks.get();
if (callbacks != null) {
- callbacks.bindAppWidget(widget);
+ callbacks.bindItems(Collections.singletonList(widget), false);
}
}
};
diff --git a/src/com/android/launcher3/model/PackageUpdatedTask.java b/src/com/android/launcher3/model/PackageUpdatedTask.java
index 1b2f8d63f..6c78d5bfc 100644
--- a/src/com/android/launcher3/model/PackageUpdatedTask.java
+++ b/src/com/android/launcher3/model/PackageUpdatedTask.java
@@ -43,6 +43,7 @@ import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.LauncherIcons;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.ItemInfoMatcher;
+import com.android.launcher3.util.LongArrayMap;
import com.android.launcher3.util.PackageManagerHelper;
import com.android.launcher3.util.PackageUserKey;
import java.util.ArrayList;
@@ -147,55 +148,32 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
break;
}
- ArrayList<AppInfo> added = null;
- ArrayList<AppInfo> modified = null;
- final ArrayList<AppInfo> removedApps = new ArrayList<>();
+ final ArrayList<AppInfo> addedOrModified = new ArrayList<>();
+ addedOrModified.addAll(appsList.added);
+ appsList.added.clear();
+ addedOrModified.addAll(appsList.modified);
+ appsList.modified.clear();
- if (appsList.added.size() > 0) {
- added = new ArrayList<>(appsList.added);
- appsList.added.clear();
- }
- if (appsList.modified.size() > 0) {
- modified = new ArrayList<>(appsList.modified);
- appsList.modified.clear();
- }
- if (appsList.removed.size() > 0) {
- removedApps.addAll(appsList.removed);
- appsList.removed.clear();
- }
+ final ArrayList<AppInfo> removedApps = new ArrayList<>(appsList.removed);
+ appsList.removed.clear();
final ArrayMap<ComponentName, AppInfo> addedOrUpdatedApps = new ArrayMap<>();
-
- if (added != null) {
- final ArrayList<AppInfo> addedApps = added;
+ if (!addedOrModified.isEmpty()) {
scheduleCallbackTask(new CallbackTask() {
@Override
public void execute(Callbacks callbacks) {
- callbacks.bindAppsAdded(null, null, null, addedApps);
+ callbacks.bindAppsAddedOrUpdated(addedOrModified);
}
});
- for (AppInfo ai : added) {
+ for (AppInfo ai : addedOrModified) {
addedOrUpdatedApps.put(ai.componentName, ai);
}
}
- if (modified != null) {
- final ArrayList<AppInfo> modifiedFinal = modified;
- for (AppInfo ai : modified) {
- addedOrUpdatedApps.put(ai.componentName, ai);
- }
- scheduleCallbackTask(new CallbackTask() {
- @Override
- public void execute(Callbacks callbacks) {
- callbacks.bindAppsUpdated(modifiedFinal);
- }
- });
- }
-
// Update shortcut infos
if (mOp == OP_ADD || flagOp != FlagOp.NO_OP) {
final ArrayList<ShortcutInfo> updatedShortcuts = new ArrayList<>();
- final ArrayList<ShortcutInfo> removedShortcuts = new ArrayList<>();
+ final LongArrayMap<Boolean> removedShortcuts = new LongArrayMap<>();
final ArrayList<LauncherAppWidgetInfo> widgets = new ArrayList<>();
synchronized (dataModel) {
@@ -236,7 +214,7 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
}
if ((intent == null) || (appInfo == null)) {
- removedShortcuts.add(si);
+ removedShortcuts.put(si.id, true);
continue;
}
si.intent = intent;
@@ -290,9 +268,9 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
}
}
- bindUpdatedShortcuts(updatedShortcuts, removedShortcuts, mUser);
+ bindUpdatedShortcuts(updatedShortcuts, mUser);
if (!removedShortcuts.isEmpty()) {
- getModelWriter().deleteItemsFromDatabase(removedShortcuts);
+ deleteAndBindComponentsRemoved(ItemInfoMatcher.ofItemIds(removedShortcuts, false));
}
if (!widgets.isEmpty()) {
@@ -329,22 +307,12 @@ public class PackageUpdatedTask extends BaseModelUpdateTask {
}
if (!removedPackages.isEmpty() || !removedComponents.isEmpty()) {
- getModelWriter().deleteItemsFromDatabase(
- ItemInfoMatcher.ofPackages(removedPackages, mUser));
- getModelWriter().deleteItemsFromDatabase(
- ItemInfoMatcher.ofComponents(removedComponents, mUser));
+ ItemInfoMatcher removeMatch = ItemInfoMatcher.ofPackages(removedPackages, mUser)
+ .or(ItemInfoMatcher.ofComponents(removedComponents, mUser));
+ deleteAndBindComponentsRemoved(removeMatch);
// Remove any queued items from the install queue
InstallShortcutReceiver.removeFromInstallQueue(context, removedPackages, mUser);
-
- // Call the components-removed callback
- scheduleCallbackTask(new CallbackTask() {
- @Override
- public void execute(Callbacks callbacks) {
- callbacks.bindWorkspaceComponentsRemoved(
- removedPackages, removedComponents, mUser);
- }
- });
}
if (!removedApps.isEmpty()) {
diff --git a/src/com/android/launcher3/model/ShortcutsChangedTask.java b/src/com/android/launcher3/model/ShortcutsChangedTask.java
index 17cc238d4..c1f33a6b2 100644
--- a/src/com/android/launcher3/model/ShortcutsChangedTask.java
+++ b/src/com/android/launcher3/model/ShortcutsChangedTask.java
@@ -26,9 +26,12 @@ import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.graphics.LauncherIcons;
import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
+import com.android.launcher3.shortcuts.ShortcutKey;
+import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.MultiHashMap;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
/**
@@ -56,33 +59,35 @@ public class ShortcutsChangedTask extends BaseModelUpdateTask {
deepShortcutManager.onShortcutsChanged(mShortcuts);
// Find ShortcutInfo's that have changed on the workspace.
- final ArrayList<ShortcutInfo> removedShortcutInfos = new ArrayList<>();
- MultiHashMap<String, ShortcutInfo> idsToWorkspaceShortcutInfos = new MultiHashMap<>();
+ HashSet<ShortcutKey> removedKeys = new HashSet<>();
+ MultiHashMap<ShortcutKey, ShortcutInfo> keyToShortcutInfo = new MultiHashMap<>();
+ HashSet<String> allIds = new HashSet<>();
+
for (ItemInfo itemInfo : dataModel.itemsIdMap) {
if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
ShortcutInfo si = (ShortcutInfo) itemInfo;
- if (si.getIntent().getPackage().equals(mPackageName)
- && si.user.equals(mUser)) {
- idsToWorkspaceShortcutInfos.addToList(si.getDeepShortcutId(), si);
+ if (si.getIntent().getPackage().equals(mPackageName) && si.user.equals(mUser)) {
+ keyToShortcutInfo.addToList(ShortcutKey.fromItemInfo(si), si);
+ allIds.add(si.getDeepShortcutId());
}
}
}
final ArrayList<ShortcutInfo> updatedShortcutInfos = new ArrayList<>();
- if (!idsToWorkspaceShortcutInfos.isEmpty()) {
+ if (!keyToShortcutInfo.isEmpty()) {
// Update the workspace to reflect the changes to updated shortcuts residing on it.
List<ShortcutInfoCompat> shortcuts = deepShortcutManager.queryForFullDetails(
- mPackageName, new ArrayList<>(idsToWorkspaceShortcutInfos.keySet()), mUser);
+ mPackageName, new ArrayList<>(allIds), mUser);
for (ShortcutInfoCompat fullDetails : shortcuts) {
- List<ShortcutInfo> shortcutInfos = idsToWorkspaceShortcutInfos
- .remove(fullDetails.getId());
+ ShortcutKey key = ShortcutKey.fromInfo(fullDetails);
+ List<ShortcutInfo> shortcutInfos = keyToShortcutInfo.remove(key);
if (!fullDetails.isPinned()) {
// The shortcut was previously pinned but is no longer, so remove it from
// the workspace and our pinned shortcut counts.
// Note that we put this check here, after querying for full details,
// because there's a possible race condition between pinning and
// receiving this callback.
- removedShortcutInfos.addAll(shortcutInfos);
+ removedKeys.add(key);
continue;
}
for (final ShortcutInfo shortcutInfo : shortcutInfos) {
@@ -94,16 +99,14 @@ public class ShortcutsChangedTask extends BaseModelUpdateTask {
}
}
- // If there are still entries in idsToWorkspaceShortcutInfos, that means that
+ // If there are still entries in keyToShortcutInfo, that means that
// the corresponding shortcuts weren't passed in onShortcutsChanged(). This
// means they were cleared, so we remove and unpin them now.
- for (String id : idsToWorkspaceShortcutInfos.keySet()) {
- removedShortcutInfos.addAll(idsToWorkspaceShortcutInfos.get(id));
- }
+ removedKeys.addAll(keyToShortcutInfo.keySet());
- bindUpdatedShortcuts(updatedShortcutInfos, removedShortcutInfos, mUser);
- if (!removedShortcutInfos.isEmpty()) {
- getModelWriter().deleteItemsFromDatabase(removedShortcutInfos);
+ bindUpdatedShortcuts(updatedShortcutInfos, mUser);
+ if (!keyToShortcutInfo.isEmpty()) {
+ deleteAndBindComponentsRemoved(ItemInfoMatcher.ofShortcutKeys(removedKeys));
}
if (mUpdateIdMap) {
diff --git a/src/com/android/launcher3/model/UserLockStateChangedTask.java b/src/com/android/launcher3/model/UserLockStateChangedTask.java
index 802771f04..8170f9a67 100644
--- a/src/com/android/launcher3/model/UserLockStateChangedTask.java
+++ b/src/com/android/launcher3/model/UserLockStateChangedTask.java
@@ -29,9 +29,11 @@ import com.android.launcher3.shortcuts.DeepShortcutManager;
import com.android.launcher3.shortcuts.ShortcutInfoCompat;
import com.android.launcher3.shortcuts.ShortcutKey;
import com.android.launcher3.util.ComponentKey;
+import com.android.launcher3.util.ItemInfoMatcher;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -70,17 +72,19 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
// Update the workspace to reflect the changes to updated shortcuts residing on it.
ArrayList<ShortcutInfo> updatedShortcutInfos = new ArrayList<>();
- ArrayList<ShortcutInfo> deletedShortcutInfos = new ArrayList<>();
+ HashSet<ShortcutKey> removedKeys = new HashSet<>();
+
for (ItemInfo itemInfo : dataModel.itemsIdMap) {
if (itemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT
&& mUser.equals(itemInfo.user)) {
ShortcutInfo si = (ShortcutInfo) itemInfo;
if (isUserUnlocked) {
- ShortcutInfoCompat shortcut = pinnedShortcuts.get(ShortcutKey.fromItemInfo(si));
+ ShortcutKey key = ShortcutKey.fromItemInfo(si);
+ ShortcutInfoCompat shortcut = pinnedShortcuts.get(key);
// We couldn't verify the shortcut during loader. If its no longer available
// (probably due to clear data), delete the workspace item as well
if (shortcut == null) {
- deletedShortcutInfos.add(si);
+ removedKeys.add(key);
continue;
}
si.isDisabled &= ~ShortcutInfo.FLAG_DISABLED_LOCKED_USER;
@@ -93,9 +97,9 @@ public class UserLockStateChangedTask extends BaseModelUpdateTask {
updatedShortcutInfos.add(si);
}
}
- bindUpdatedShortcuts(updatedShortcutInfos, deletedShortcutInfos, mUser);
- if (!deletedShortcutInfos.isEmpty()) {
- getModelWriter().deleteItemsFromDatabase(deletedShortcutInfos);
+ bindUpdatedShortcuts(updatedShortcutInfos, mUser);
+ if (!removedKeys.isEmpty()) {
+ deleteAndBindComponentsRemoved(ItemInfoMatcher.ofShortcutKeys(removedKeys));
}
// Remove shortcut id map for that user
diff --git a/src/com/android/launcher3/util/ItemInfoMatcher.java b/src/com/android/launcher3/util/ItemInfoMatcher.java
index 42de28466..18787b6a2 100644
--- a/src/com/android/launcher3/util/ItemInfoMatcher.java
+++ b/src/com/android/launcher3/util/ItemInfoMatcher.java
@@ -18,6 +18,7 @@ package com.android.launcher3.util;
import android.content.ComponentName;
import android.os.UserHandle;
+import android.util.SparseLongArray;
import com.android.launcher3.FolderInfo;
import com.android.launcher3.ItemInfo;
@@ -66,6 +67,32 @@ public abstract class ItemInfoMatcher {
return filtered;
}
+ /**
+ * Returns a new matcher with returns true if either this or {@param matcher} returns true.
+ */
+ public ItemInfoMatcher or(final ItemInfoMatcher matcher) {
+ final ItemInfoMatcher that = this;
+ return new ItemInfoMatcher() {
+ @Override
+ public boolean matches(ItemInfo info, ComponentName cn) {
+ return that.matches(info, cn) || matcher.matches(info, cn);
+ }
+ };
+ }
+
+ /**
+ * Returns a new matcher with returns true if both this and {@param matcher} returns true.
+ */
+ public ItemInfoMatcher and(final ItemInfoMatcher matcher) {
+ final ItemInfoMatcher that = this;
+ return new ItemInfoMatcher() {
+ @Override
+ public boolean matches(ItemInfo info, ComponentName cn) {
+ return that.matches(info, cn) && matcher.matches(info, cn);
+ }
+ };
+ }
+
public static ItemInfoMatcher ofUser(final UserHandle user) {
return new ItemInfoMatcher() {
@Override
@@ -104,4 +131,14 @@ public abstract class ItemInfoMatcher {
}
};
}
+
+ public static ItemInfoMatcher ofItemIds(
+ final LongArrayMap<Boolean> ids, final Boolean matchDefault) {
+ return new ItemInfoMatcher() {
+ @Override
+ public boolean matches(ItemInfo info, ComponentName cn) {
+ return ids.get(info.id, matchDefault);
+ }
+ };
+ }
}
diff --git a/src/com/android/launcher3/util/RunnableWithId.java b/src/com/android/launcher3/util/RunnableWithId.java
new file mode 100644
index 000000000..030eb09ff
--- /dev/null
+++ b/src/com/android/launcher3/util/RunnableWithId.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2017 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.util;
+
+/**
+ * A runnable with an id associated which is used for equality check.
+ */
+public abstract class RunnableWithId implements Runnable {
+
+ public static final int RUNNABLE_ID_BIND_APPS = 1;
+ public static final int RUNNABLE_ID_BIND_WIDGETS = 2;
+
+ public final int id;
+
+ public RunnableWithId(int id) {
+ this.id = id;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return obj instanceof RunnableWithId && ((RunnableWithId) obj).id == id;
+ }
+}
diff --git a/src/com/android/launcher3/util/SystemUiController.java b/src/com/android/launcher3/util/SystemUiController.java
index 6b5b095c7..d7a2625e9 100644
--- a/src/com/android/launcher3/util/SystemUiController.java
+++ b/src/com/android/launcher3/util/SystemUiController.java
@@ -30,6 +30,7 @@ public class SystemUiController {
public static final int UI_STATE_BASE_WINDOW = 0;
public static final int UI_STATE_ALL_APPS = 1;
public static final int UI_STATE_WIDGET_BOTTOM_SHEET = 2;
+ public static final int UI_STATE_ROOT_VIEW = 3;
public static final int FLAG_LIGHT_NAV = 1 << 0;
public static final int FLAG_DARK_NAV = 1 << 1;
@@ -37,7 +38,7 @@ public class SystemUiController {
public static final int FLAG_DARK_STATUS = 1 << 3;
private final Window mWindow;
- private final int[] mStates = new int[3];
+ private final int[] mStates = new int[4];
public SystemUiController(Window window) {
mWindow = window;
diff --git a/tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java b/tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java
index ae15f086f..82f34e43d 100644
--- a/tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java
+++ b/tests/src/com/android/launcher3/model/AddWorkspaceItemsTaskTest.java
@@ -131,7 +131,7 @@ public class AddWorkspaceItemsTaskTest extends BaseModelUpdateTaskTestCase {
// only info2 should be added because info was already added to the workspace
// in setupWorkspaceWithHoles()
verify(callbacks).bindAppsAdded(any(ArrayList.class), notAnimated.capture(),
- animated.capture(), isNull(ArrayList.class));
+ animated.capture());
assertTrue(notAnimated.getValue().isEmpty());
assertEquals(1, animated.getValue().size());
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 7fb5d8521..1be33d2f8 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -103,7 +103,7 @@ public abstract class AbstractLauncherUiTest {
*/
protected UiObject2 openAllApps() {
mDevice.waitForIdle();
- if (FeatureFlags.LAUNCHER3_ALL_APPS_PULL_UP) {
+ if (FeatureFlags.NO_ALL_APPS_ICON) {
// clicking on the page indicator brings up all apps tray on non tablets.
findViewById(R.id.page_indicator).click();
} else {