From 9566a044009bbf5d53b1b8684ace9fd57815cdb3 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 23 Jul 2019 15:22:30 -0700 Subject: [PATCH 01/11] Fix bug where rounded corners were being set despite being disabled. Bug: 138117089 Change-Id: Icb852e2e07d80c45ad3406ef432b89720887fccf --- .../android/launcher3/QuickstepAppTransitionManagerImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java index 44324cb2e4..b60a017dd8 100644 --- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java @@ -32,6 +32,7 @@ import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS; import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION; import static com.android.quickstep.TaskUtils.taskIsATargetWithMode; import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius; +import static com.android.systemui.shared.system.QuickStepContract.supportsRoundedCornersOnWindows; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING; @@ -495,6 +496,8 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans endCrop = windowTargetBounds.height(); } + final float initialWindowRadius = supportsRoundedCornersOnWindows(mLauncher.getResources()) + ? startCrop / 2f : 0f; final float windowRadius = mDeviceProfile.isMultiWindowMode ? 0 : getWindowCornerRadius(mLauncher.getResources()); appAnimator.addUpdateListener(new MultiValueUpdateListener() { @@ -506,7 +509,7 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans alphaDuration, LINEAR); FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, CROP_DURATION, EXAGGERATED_EASE); - FloatProp mWindowRadius = new FloatProp(startCrop / 2f, windowRadius, 0, + FloatProp mWindowRadius = new FloatProp(initialWindowRadius, windowRadius, 0, RADIUS_DURATION, EXAGGERATED_EASE); @Override From 9eb96c5811fb0c9ccc67f3dd740405d4dc61a88a Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 29 Jul 2019 11:27:29 -0700 Subject: [PATCH 02/11] Fixing multi-window DnD getting cancelled when starting a new activity in the middle Bug: 133472746 Change-Id: I868f2bc5f1db4a7fa22df212122317bfef27a282 --- .../launcher3/dragndrop/AddItemActivity.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/com/android/launcher3/dragndrop/AddItemActivity.java b/src/com/android/launcher3/dragndrop/AddItemActivity.java index a72089d7ca..a2dcbf87d7 100644 --- a/src/com/android/launcher3/dragndrop/AddItemActivity.java +++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java @@ -153,16 +153,6 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener PinItemDragListener listener = new PinItemDragListener(mRequest, bounds, img.getBitmap().getWidth(), img.getWidth()); - Intent homeIntent = listener.addToIntent( - new Intent(Intent.ACTION_MAIN) - .addCategory(Intent.CATEGORY_HOME) - .setPackage(getPackageName()) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); - - listener.initWhenReady(); - startActivity(homeIntent, - ActivityOptions.makeCustomAnimation(this, 0, android.R.anim.fade_out).toBundle()); - mFinishOnPause = true; // Start a system drag and drop. We use a transparent bitmap as preview for system drag // as the preview is handled internally by launcher. @@ -179,6 +169,18 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener outShadowTouchPoint.set(SHADOW_SIZE / 2, SHADOW_SIZE / 2); } }, null, View.DRAG_FLAG_GLOBAL); + + + Intent homeIntent = listener.addToIntent( + new Intent(Intent.ACTION_MAIN) + .addCategory(Intent.CATEGORY_HOME) + .setPackage(getPackageName()) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); + + listener.initWhenReady(); + startActivity(homeIntent, + ActivityOptions.makeCustomAnimation(this, 0, android.R.anim.fade_out).toBundle()); + mFinishOnPause = true; return false; } From f462b251e13791945f3939e2ebde5a71c99daac3 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 31 Jul 2019 10:05:16 -0700 Subject: [PATCH 03/11] Tune window/icon alpha for swipe up to home animation. Bug: 136591785 Change-Id: Ib781bc77cfd49b6f4529a609d7025f510e219575 --- .../android/quickstep/BaseSwipeUpHandler.java | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index e3d622f97e..d627a7f14f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -411,15 +411,27 @@ public abstract class BaseSwipeUpHandler= end) { + return 0f; + } + return Utilities.mapToRange(progress, start, end, 1, 0, ACCEL_1_5); + } + @Override public void onUpdate(RectF currentRect, float progress) { homeAnim.setPlayFraction(progress); - float alphaProgress = ACCEL_1_5.getInterpolation(progress); - float windowAlpha = Utilities.boundToRange(Utilities.mapToRange(alphaProgress, 0, - windowAlphaThreshold, 1.5f, 0f, Interpolators.LINEAR), 0, 1); mTransformParams.setProgress(progress) - .setCurrentRectAndTargetAlpha(currentRect, windowAlpha); + .setCurrentRectAndTargetAlpha(currentRect, getWindowAlpha(progress)); if (isFloatingIconView) { mTransformParams.setCornerRadius(endRadius * progress + startRadius * (1f - progress)); @@ -429,7 +441,8 @@ public abstract class BaseSwipeUpHandler Date: Wed, 24 Jul 2019 17:32:08 -0700 Subject: [PATCH 04/11] Add OverviewScrim to show below overview but above workspace - Refactor some basic scrim logic to Scrim class and have WorkspaceAndHotseatScrim and OverviewScrim extend it - Draw OverviewScrim under recents unless predictions are disabled, in which case draw it under hotseat (since that is in recents) - Remove sysui scrim (behind status bar and nav bar) when overview is peeking Bug: 132455160 Change-Id: Ia5d6f54582a4c5a70e3b2d4a98281567edd68519 --- .../uioverrides/states/OverviewPeekState.java | 3 + .../uioverrides/states/OverviewState.java | 8 +- .../FlingAndHoldTouchController.java | 3 + .../util/StaggeredWorkspaceAnim.java | 23 +++-- .../BaseRecentsViewStateController.java | 12 ++- .../quickstep/views/ShelfScrimView.java | 2 +- src/com/android/launcher3/LauncherState.java | 4 + .../launcher3/anim/AnimatorSetBuilder.java | 1 + .../launcher3/dragndrop/DragLayer.java | 33 +++++-- .../launcher3/graphics/OverviewScrim.java | 70 +++++++++++++ src/com/android/launcher3/graphics/Scrim.java | 97 +++++++++++++++++++ .../graphics/WorkspaceAndHotseatScrim.java | 74 ++++---------- .../AbstractStateChangeTouchController.java | 1 + 13 files changed, 252 insertions(+), 79 deletions(-) create mode 100644 src/com/android/launcher3/graphics/OverviewScrim.java create mode 100644 src/com/android/launcher3/graphics/Scrim.java diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java index c954762837..427206a65b 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewPeekState.java @@ -15,7 +15,9 @@ */ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_FADE; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X; +import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_7; @@ -43,6 +45,7 @@ public class OverviewPeekState extends OverviewState { if (this == OVERVIEW_PEEK && fromState == NORMAL) { builder.setInterpolator(ANIM_OVERVIEW_FADE, INSTANT); builder.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_1_7); + builder.setInterpolator(ANIM_OVERVIEW_SCRIM_FADE, FAST_OUT_SLOW_IN); } } } 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 5543860eec..151ceb8347 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 @@ -43,7 +43,6 @@ import com.android.launcher3.R; import com.android.launcher3.Workspace; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorSetBuilder; -import com.android.launcher3.uioverrides.UiFactory; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.SysUINavigationMode; @@ -128,14 +127,15 @@ public class OverviewState extends LauncherState { if (launcher.getDeviceProfile().isVerticalBarLayout()) { return VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON; } else { + boolean hasAllAppsHeaderExtra = launcher.getAppsView() != null + && launcher.getAppsView().getFloatingHeaderView().hasVisibleContent(); return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON | - (launcher.getAppsView().getFloatingHeaderView().hasVisibleContent() - ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS); + (hasAllAppsHeaderExtra ? ALL_APPS_HEADER_EXTRA : HOTSEAT_ICONS); } } @Override - public float getWorkspaceScrimAlpha(Launcher launcher) { + public float getOverviewScrimAlpha(Launcher launcher) { return 0.5f; } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java index f06b8a910f..6142cdfc10 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java @@ -102,6 +102,9 @@ public class FlingAndHoldTouchController extends PortraitStatesTouchController { mPeekAnim.start(); recentsView.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING); + + mLauncher.getDragLayer().getScrim().animateToSysuiMultiplier(isPaused ? 0 : 1, + peekDuration, 0); }); } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 1705c9712a..1069bed592 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -15,6 +15,11 @@ */ package com.android.quickstep.util; +import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; +import static com.android.launcher3.LauncherState.BACKGROUND_APP; +import static com.android.launcher3.LauncherState.NORMAL; +import static com.android.launcher3.anim.Interpolators.LINEAR; + import android.animation.Animator; import android.animation.Animator.AnimatorListener; import android.animation.AnimatorListenerAdapter; @@ -35,15 +40,11 @@ import com.android.launcher3.Workspace; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.anim.SpringObjectAnimator; +import com.android.launcher3.graphics.OverviewScrim; import java.util.ArrayList; import java.util.List; -import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; -import static com.android.launcher3.LauncherState.BACKGROUND_APP; -import static com.android.launcher3.LauncherState.NORMAL; -import static com.android.launcher3.anim.Interpolators.LINEAR; - /** * Creates an animation where all the workspace items are moved into their final location, * staggered row by row from the bottom up. @@ -122,8 +123,8 @@ public class StaggeredWorkspaceAnim { addStaggeredAnimationForView(qsb, grid.inv.numRows + 2, totalRows); } - addWorkspaceScrimAnimationForState(launcher, BACKGROUND_APP, 0); - addWorkspaceScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS); + addScrimAnimationForState(launcher, BACKGROUND_APP, 0); + addScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS); AnimatorListener resetClipListener = new AnimatorListenerAdapter() { int numAnimations = mAnimators.size(); @@ -191,13 +192,17 @@ public class StaggeredWorkspaceAnim { mAnimators.add(alpha); } - private void addWorkspaceScrimAnimationForState(Launcher launcher, LauncherState state, - long duration) { + private void addScrimAnimationForState(Launcher launcher, LauncherState state, long duration) { AnimatorSetBuilder scrimAnimBuilder = new AnimatorSetBuilder(); AnimationConfig scrimAnimConfig = new AnimationConfig(); scrimAnimConfig.duration = duration; PropertySetter scrimPropertySetter = scrimAnimConfig.getPropertySetter(scrimAnimBuilder); launcher.getWorkspace().getStateTransitionAnimation().setScrim(scrimPropertySetter, state); mAnimators.add(scrimAnimBuilder.build()); + Animator fadeOverviewScrim = ObjectAnimator.ofFloat( + launcher.getDragLayer().getOverviewScrim(), OverviewScrim.SCRIM_PROGRESS, + state.getOverviewScrimAlpha(launcher)); + fadeOverviewScrim.setDuration(duration); + mAnimators.add(fadeOverviewScrim); } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index f0204b9ba4..174e49b8d2 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -19,16 +19,20 @@ package com.android.launcher3.uioverrides; 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; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCRIM_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_X; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATE_Y; import static com.android.launcher3.anim.AnimatorSetBuilder.FLAG_DONT_ANIMATE_OVERVIEW; import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT; import static com.android.launcher3.anim.Interpolators.LINEAR; +import static com.android.launcher3.graphics.Scrim.SCRIM_PROGRESS; import android.util.FloatProperty; import android.view.View; import android.view.animation.Interpolator; +import androidx.annotation.NonNull; + import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherState.ScaleAndTranslation; @@ -36,8 +40,7 @@ import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; - -import androidx.annotation.NonNull; +import com.android.launcher3.graphics.OverviewScrim; /** * State handler for recents view. Manages UI changes and animations for recents view based off the @@ -67,6 +70,8 @@ public abstract class BaseRecentsViewStateController mRecentsView.setTranslationX(translationX); mRecentsView.setTranslationY(scaleAndTranslation.translationY); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); + OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim(); + SCRIM_PROGRESS.set(scrim, state.getOverviewScrimAlpha(mLauncher)); } @Override @@ -110,6 +115,9 @@ public abstract class BaseRecentsViewStateController translateYInterpolator); setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, builder.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); + OverviewScrim scrim = mLauncher.getDragLayer().getOverviewScrim(); + setter.setFloat(scrim, SCRIM_PROGRESS, toState.getOverviewScrimAlpha(mLauncher), + builder.getInterpolator(ANIM_OVERVIEW_SCRIM_FADE, LINEAR)); } /** diff --git a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java index 5a2f5c162a..3747f9a8b1 100644 --- a/quickstep/src/com/android/quickstep/views/ShelfScrimView.java +++ b/quickstep/src/com/android/quickstep/views/ShelfScrimView.java @@ -98,7 +98,7 @@ public class ShelfScrimView extends ScrimView implements NavigationModeChangeLis public ShelfScrimView(Context context, AttributeSet attrs) { super(context, attrs); - mMaxScrimAlpha = Math.round(OVERVIEW.getWorkspaceScrimAlpha(mLauncher) * 255); + mMaxScrimAlpha = Math.round(OVERVIEW.getOverviewScrimAlpha(mLauncher) * 255); mEndAlpha = Color.alpha(mEndScrim); mRadius = BOTTOM_CORNER_RADIUS_RATIO * Themes.getDialogCornerRadius(context); diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index dcfd272b47..6e2626b615 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -243,6 +243,10 @@ public class LauncherState { return 0; } + public float getOverviewScrimAlpha(Launcher launcher) { + return 0; + } + public String getDescription(Launcher launcher) { return launcher.getWorkspace().getCurrentPageDescription(); } diff --git a/src/com/android/launcher3/anim/AnimatorSetBuilder.java b/src/com/android/launcher3/anim/AnimatorSetBuilder.java index 52a896eda1..11db25be44 100644 --- a/src/com/android/launcher3/anim/AnimatorSetBuilder.java +++ b/src/com/android/launcher3/anim/AnimatorSetBuilder.java @@ -39,6 +39,7 @@ public class AnimatorSetBuilder { public static final int ANIM_OVERVIEW_TRANSLATE_Y = 8; public static final int ANIM_OVERVIEW_FADE = 9; public static final int ANIM_ALL_APPS_FADE = 10; + public static final int ANIM_OVERVIEW_SCRIM_FADE = 11; public static final int FLAG_DONT_ANIMATE_OVERVIEW = 1 << 0; diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index 6ba015b2e4..b59164ae0a 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -48,12 +48,13 @@ import com.android.launcher3.CellLayout; import com.android.launcher3.DropTargetBar; import com.android.launcher3.Launcher; import com.android.launcher3.R; -import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.ShortcutAndWidgetContainer; import com.android.launcher3.Workspace; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; +import com.android.launcher3.graphics.OverviewScrim; +import com.android.launcher3.graphics.RotationMode; import com.android.launcher3.graphics.WorkspaceAndHotseatScrim; import com.android.launcher3.keyboard.ViewGroupFocusHelper; import com.android.launcher3.uioverrides.UiFactory; @@ -92,7 +93,8 @@ public class DragLayer extends BaseDragLayer { // Related to adjacent page hints private final ViewGroupFocusHelper mFocusIndicatorHelper; - private final WorkspaceAndHotseatScrim mScrim; + private final WorkspaceAndHotseatScrim mWorkspaceScrim; + private final OverviewScrim mOverviewScrim; /** * Used to create a new DragLayer from XML. @@ -108,12 +110,13 @@ public class DragLayer extends BaseDragLayer { setChildrenDrawingOrderEnabled(true); mFocusIndicatorHelper = new ViewGroupFocusHelper(this); - mScrim = new WorkspaceAndHotseatScrim(this); + mWorkspaceScrim = new WorkspaceAndHotseatScrim(this); + mOverviewScrim = new OverviewScrim(this); } public void setup(DragController dragController, Workspace workspace) { mDragController = dragController; - mScrim.setWorkspace(workspace); + mWorkspaceScrim.setWorkspace(workspace); recreateControllers(); } @@ -529,25 +532,39 @@ public class DragLayer extends BaseDragLayer { @Override protected void dispatchDraw(Canvas canvas) { // Draw the background below children. - mScrim.draw(canvas); + mWorkspaceScrim.draw(canvas); + mOverviewScrim.updateCurrentScrimmedView(this); mFocusIndicatorHelper.draw(canvas); super.dispatchDraw(canvas); } + @Override + protected boolean drawChild(Canvas canvas, View child, long drawingTime) { + if (child == mOverviewScrim.getScrimmedView()) { + mOverviewScrim.draw(canvas); + } + return super.drawChild(canvas, child, drawingTime); + } + @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); - mScrim.setSize(w, h); + mWorkspaceScrim.setSize(w, h); } @Override public void setInsets(Rect insets) { super.setInsets(insets); - mScrim.onInsetsChanged(insets); + mWorkspaceScrim.onInsetsChanged(insets); + mOverviewScrim.onInsetsChanged(insets); } public WorkspaceAndHotseatScrim getScrim() { - return mScrim; + return mWorkspaceScrim; + } + + public OverviewScrim getOverviewScrim() { + return mOverviewScrim; } @Override diff --git a/src/com/android/launcher3/graphics/OverviewScrim.java b/src/com/android/launcher3/graphics/OverviewScrim.java new file mode 100644 index 0000000000..d707403ed2 --- /dev/null +++ b/src/com/android/launcher3/graphics/OverviewScrim.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2019 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.graphics; + +import static android.view.View.VISIBLE; + +import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; +import static com.android.launcher3.LauncherState.OVERVIEW; + +import android.graphics.Rect; +import android.view.View; +import android.view.ViewGroup; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +/** + * View scrim which draws behind overview (recent apps). + */ +public class OverviewScrim extends Scrim { + + private @NonNull View mStableScrimmedView; + // Might be higher up if mStableScrimmedView is invisible. + private @Nullable View mCurrentScrimmedView; + + public OverviewScrim(View view) { + super(view); + mStableScrimmedView = mCurrentScrimmedView = mLauncher.getOverviewPanel(); + + onExtractedColorsChanged(mWallpaperColorInfo); + } + + public void onInsetsChanged(Rect insets) { + mStableScrimmedView = (OVERVIEW.getVisibleElements(mLauncher) & HOTSEAT_ICONS) != 0 + ? mLauncher.getHotseat() + : mLauncher.getOverviewPanel(); + } + + public void updateCurrentScrimmedView(ViewGroup root) { + // Find the lowest view that is at or above the view we want to show the scrim behind. + mCurrentScrimmedView = mStableScrimmedView; + int currentIndex = root.indexOfChild(mCurrentScrimmedView); + final int childCount = root.getChildCount(); + while (mCurrentScrimmedView.getVisibility() != VISIBLE && currentIndex < childCount) { + currentIndex++; + mCurrentScrimmedView = root.getChildAt(currentIndex); + } + } + + /** + * @return The view to draw the scrim behind. + */ + public View getScrimmedView() { + return mCurrentScrimmedView; + } +} diff --git a/src/com/android/launcher3/graphics/Scrim.java b/src/com/android/launcher3/graphics/Scrim.java new file mode 100644 index 0000000000..5c14f8d20f --- /dev/null +++ b/src/com/android/launcher3/graphics/Scrim.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2019 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.graphics; + +import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound; + +import android.graphics.Canvas; +import android.util.Property; +import android.view.View; + +import com.android.launcher3.Launcher; +import com.android.launcher3.uioverrides.WallpaperColorInfo; + +/** + * Contains general scrim properties such as wallpaper-extracted color that subclasses can use. + */ +public class Scrim implements View.OnAttachStateChangeListener, + WallpaperColorInfo.OnChangeListener { + + public static Property SCRIM_PROGRESS = + new Property(Float.TYPE, "scrimProgress") { + @Override + public Float get(Scrim scrim) { + return scrim.mScrimProgress; + } + + @Override + public void set(Scrim scrim, Float value) { + scrim.setScrimProgress(value); + } + }; + + protected final Launcher mLauncher; + protected final WallpaperColorInfo mWallpaperColorInfo; + protected final View mRoot; + + protected float mScrimProgress; + protected int mScrimColor; + protected int mScrimAlpha = 0; + + public Scrim(View view) { + mRoot = view; + mLauncher = Launcher.getLauncher(view.getContext()); + mWallpaperColorInfo = WallpaperColorInfo.getInstance(mLauncher); + + view.addOnAttachStateChangeListener(this); + } + + public void draw(Canvas canvas) { + canvas.drawColor(setColorAlphaBound(mScrimColor, mScrimAlpha)); + } + + private void setScrimProgress(float progress) { + if (mScrimProgress != progress) { + mScrimProgress = progress; + mScrimAlpha = Math.round(255 * mScrimProgress); + invalidate(); + } + } + + @Override + public void onViewAttachedToWindow(View view) { + mWallpaperColorInfo.addOnChangeListener(this); + onExtractedColorsChanged(mWallpaperColorInfo); + } + + @Override + public void onViewDetachedFromWindow(View view) { + mWallpaperColorInfo.removeOnChangeListener(this); + } + + @Override + public void onExtractedColorsChanged(WallpaperColorInfo wallpaperColorInfo) { + mScrimColor = wallpaperColorInfo.getMainColor(); + if (mScrimAlpha > 0) { + invalidate(); + } + } + + public void invalidate() { + mRoot.invalidate(); + } +} diff --git a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java index c0aa75f288..6740fa16e5 100644 --- a/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java +++ b/src/com/android/launcher3/graphics/WorkspaceAndHotseatScrim.java @@ -40,34 +40,19 @@ import android.util.DisplayMetrics; import android.util.Property; import android.view.View; +import androidx.core.graphics.ColorUtils; + import com.android.launcher3.CellLayout; -import com.android.launcher3.Launcher; import com.android.launcher3.R; import com.android.launcher3.ResourceUtils; import com.android.launcher3.Workspace; import com.android.launcher3.uioverrides.WallpaperColorInfo; import com.android.launcher3.util.Themes; -import androidx.core.graphics.ColorUtils; - /** * View scrim which draws behind hotseat and workspace */ -public class WorkspaceAndHotseatScrim implements - View.OnAttachStateChangeListener, WallpaperColorInfo.OnChangeListener { - - public static Property SCRIM_PROGRESS = - new Property(Float.TYPE, "scrimProgress") { - @Override - public Float get(WorkspaceAndHotseatScrim scrim) { - return scrim.mScrimProgress; - } - - @Override - public void set(WorkspaceAndHotseatScrim scrim, Float value) { - scrim.setScrimProgress(value); - } - }; +public class WorkspaceAndHotseatScrim extends Scrim { public static Property SYSUI_PROGRESS = new Property(Float.TYPE, "sysUiProgress") { @@ -117,9 +102,6 @@ public class WorkspaceAndHotseatScrim implements private static final int ALPHA_MASK_WIDTH_DP = 2; private final Rect mHighlightRect = new Rect(); - private final Launcher mLauncher; - private final WallpaperColorInfo mWallpaperColorInfo; - private final View mRoot; private Workspace mWorkspace; @@ -132,11 +114,6 @@ public class WorkspaceAndHotseatScrim implements private final Drawable mTopScrim; - private int mFullScrimColor; - - private float mScrimProgress; - private int mScrimAlpha = 0; - private float mSysUiProgress = 1; private boolean mHideSysUiScrim; @@ -144,9 +121,7 @@ public class WorkspaceAndHotseatScrim implements private float mSysUiAnimMultiplier = 1; public WorkspaceAndHotseatScrim(View view) { - mRoot = view; - mLauncher = Launcher.getLauncher(view.getContext()); - mWallpaperColorInfo = WallpaperColorInfo.getInstance(mLauncher); + super(view); mMaskHeight = ResourceUtils.pxFromDp(ALPHA_MASK_BITMAP_DP, view.getResources().getDisplayMetrics()); @@ -154,7 +129,6 @@ public class WorkspaceAndHotseatScrim implements mBottomMask = mTopScrim == null ? null : createDitheredAlphaMask(); mHideSysUiScrim = mTopScrim == null; - view.addOnAttachStateChangeListener(this); onExtractedColorsChanged(mWallpaperColorInfo); } @@ -176,7 +150,7 @@ public class WorkspaceAndHotseatScrim implements canvas.clipRect(mHighlightRect, Region.Op.DIFFERENCE); } - canvas.drawColor(setColorAlphaBound(mFullScrimColor, mScrimAlpha)); + super.draw(canvas); canvas.restore(); } @@ -190,11 +164,8 @@ public class WorkspaceAndHotseatScrim implements mSysUiAnimMultiplier = 0; reapplySysUiAlphaNoInvalidate(); - ObjectAnimator anim = ObjectAnimator.ofFloat(this, SYSUI_ANIM_MULTIPLIER, 1); - anim.setAutoCancel(true); - anim.setDuration(600); - anim.setStartDelay(mLauncher.getWindow().getTransitionBackgroundFadeDuration()); - anim.start(); + animateToSysuiMultiplier(1, 600, + mLauncher.getWindow().getTransitionBackgroundFadeDuration()); mAnimateScrimOnNextDraw = false; } @@ -207,24 +178,24 @@ public class WorkspaceAndHotseatScrim implements } } + public void animateToSysuiMultiplier(float toMultiplier, long duration, + long startDelay) { + ObjectAnimator anim = ObjectAnimator.ofFloat(this, SYSUI_ANIM_MULTIPLIER, toMultiplier); + anim.setAutoCancel(true); + anim.setDuration(duration); + anim.setStartDelay(startDelay); + anim.start(); + } + public void onInsetsChanged(Rect insets) { mDrawTopScrim = mTopScrim != null && insets.top > 0; mDrawBottomScrim = mBottomMask != null && !mLauncher.getDeviceProfile().isVerticalBarLayout(); } - private void setScrimProgress(float progress) { - if (mScrimProgress != progress) { - mScrimProgress = progress; - mScrimAlpha = Math.round(255 * mScrimProgress); - invalidate(); - } - } - @Override public void onViewAttachedToWindow(View view) { - mWallpaperColorInfo.addOnChangeListener(this); - onExtractedColorsChanged(mWallpaperColorInfo); + super.onViewAttachedToWindow(view); if (mTopScrim != null) { IntentFilter filter = new IntentFilter(ACTION_SCREEN_OFF); @@ -235,7 +206,7 @@ public class WorkspaceAndHotseatScrim implements @Override public void onViewDetachedFromWindow(View view) { - mWallpaperColorInfo.removeOnChangeListener(this); + super.onViewDetachedFromWindow(view); if (mTopScrim != null) { mRoot.getContext().unregisterReceiver(mReceiver); } @@ -248,10 +219,7 @@ public class WorkspaceAndHotseatScrim implements mBottomMaskPaint.setColor(ColorUtils.compositeColors(DARK_SCRIM_COLOR, wallpaperColorInfo.getMainColor())); reapplySysUiAlpha(); - mFullScrimColor = wallpaperColorInfo.getMainColor(); - if (mScrimAlpha > 0) { - invalidate(); - } + super.onExtractedColorsChanged(wallpaperColorInfo); } public void setSize(int w, int h) { @@ -291,10 +259,6 @@ public class WorkspaceAndHotseatScrim implements } } - public void invalidate() { - mRoot.invalidate(); - } - public Bitmap createDitheredAlphaMask() { DisplayMetrics dm = mLauncher.getResources().getDisplayMetrics(); int width = ResourceUtils.pxFromDp(ALPHA_MASK_WIDTH_DP, dm); diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 49f515ad4b..0545344170 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -518,6 +518,7 @@ public abstract class AbstractStateChangeTouchController logReachedState(logAction, targetState); } mLauncher.getStateManager().goToState(targetState, false /* animated */); + mLauncher.getDragLayer().getScrim().animateToSysuiMultiplier(1, 0, 0); } private void logReachedState(int logAction, LauncherState targetState) { From 35a4e0eec9986090a55567be40c4b269b2fe8985 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 18 Jun 2019 17:04:49 -0700 Subject: [PATCH 05/11] Tie prediction text to all apps interpolator Now floating headers get 2 interpolators: one for the header content itselt, and one for the all apps content that follows. That way, they can choose to intperolate part of their content as if it were part of all apps instead of the header. Currently, we do this to animate predicted icons quickly, followed by the all apps icons, predictions text, all apps scrollbar, and all apps divider as you continue swiping. Bug: 132455160 Change-Id: Ib3e373c291e174e1306a53854d0ad4dc29eb4b76 --- .../appprediction/AppsDividerView.java | 12 ++--- .../appprediction/PredictionRowView.java | 47 +++++++++++-------- .../FlingAndHoldTouchController.java | 12 +++++ .../PortraitStatesTouchController.java | 2 +- .../allapps/AllAppsTransitionController.java | 12 +++-- .../launcher3/allapps/FloatingHeaderRow.java | 4 +- .../launcher3/allapps/FloatingHeaderView.java | 18 +++---- .../launcher3/allapps/PluginHeaderRow.java | 6 +-- .../launcher3/anim/AnimatorSetBuilder.java | 1 + 9 files changed, 68 insertions(+), 46 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java index 311db21935..425fb13990 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/AppsDividerView.java @@ -31,6 +31,9 @@ import android.util.AttributeSet; import android.view.View; import android.view.animation.Interpolator; +import androidx.annotation.ColorInt; +import androidx.core.content.ContextCompat; + import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; @@ -41,9 +44,6 @@ import com.android.launcher3.allapps.FloatingHeaderView; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.util.Themes; -import androidx.annotation.ColorInt; -import androidx.core.content.ContextCompat; - /** * A view which shows a horizontal divider */ @@ -288,10 +288,10 @@ public class AppsDividerView extends View implements LauncherStateManager.StateL } @Override - public void setContentVisibility(boolean hasHeaderExtra, boolean hasContent, - PropertySetter setter, Interpolator fadeInterpolator) { + public void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent, + PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) { // Don't use setViewAlpha as we want to control the visibility ourselves. - setter.setFloat(this, ALPHA, hasContent ? 1 : 0, fadeInterpolator); + setter.setFloat(this, ALPHA, hasAllAppsContent ? 1 : 0, allAppsFade); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index cb5cbddd4a..b406bec829 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -32,6 +32,9 @@ import android.view.View; import android.view.animation.Interpolator; import android.widget.LinearLayout; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + import com.android.launcher3.AppInfo; import com.android.launcher3.BubbleTextView; import com.android.launcher3.DeviceProfile; @@ -62,9 +65,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - @TargetApi(Build.VERSION_CODES.P) public class PredictionRowView extends LinearLayout implements LogContainerProvider, OnDeviceProfileChangeListener, FloatingHeaderRow { @@ -103,6 +103,8 @@ public class PredictionRowView extends LinearLayout implements private final int mIconTextColor; private final int mIconFullTextAlpha; + private int mIconLastSetTextAlpha; + // Might use mIconFullTextAlpha instead of mIconLastSetTextAlpha if we are translucent. private int mIconCurrentTextAlpha; private FloatingHeaderView mParent; @@ -315,14 +317,27 @@ public class PredictionRowView extends LinearLayout implements } } - public void setTextAlpha(int alpha) { - mIconCurrentTextAlpha = alpha; + public void setTextAlpha(int textAlpha) { + mIconLastSetTextAlpha = textAlpha; + if (getAlpha() < 1 && textAlpha > 0) { + // If the entire header is translucent, make sure the text is at full opacity so it's + // not double-translucent. However, we support keeping the text invisible (alpha == 0). + textAlpha = mIconFullTextAlpha; + } + mIconCurrentTextAlpha = textAlpha; int iconColor = setColorAlphaBound(mIconTextColor, mIconCurrentTextAlpha); for (int i = 0; i < getChildCount(); i++) { ((BubbleTextView) getChildAt(i)).setTextColor(iconColor); } } + @Override + public void setAlpha(float alpha) { + super.setAlpha(alpha); + // Reapply text alpha so that we update it to be full alpha if the row is now translucent. + setTextAlpha(mIconLastSetTextAlpha); + } + @Override public boolean hasOverlappingRendering() { return false; @@ -351,23 +366,15 @@ public class PredictionRowView extends LinearLayout implements } @Override - public void setContentVisibility(boolean hasHeaderExtra, boolean hasContent, - PropertySetter setter, Interpolator fadeInterpolator) { - boolean isDrawn = getAlpha() > 0; - int textAlpha = hasHeaderExtra - ? (hasContent ? mIconFullTextAlpha : 0) // Text follows the content visibility - : mIconCurrentTextAlpha; // Leave as before - if (!isDrawn) { - // If the header is not drawn, no need to animate the text alpha - setTextAlpha(textAlpha); - } else { - setter.setInt(this, TEXT_ALPHA, textAlpha, fadeInterpolator); - } - + public void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent, + PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) { + // Text follows all apps visibility + int textAlpha = hasHeaderExtra && hasAllAppsContent ? mIconFullTextAlpha : 0; + setter.setInt(this, TEXT_ALPHA, textAlpha, allAppsFade); setter.setFloat(mOverviewScrollFactor, AnimatedFloat.VALUE, - (hasHeaderExtra && !hasContent) ? 1 : 0, LINEAR); + (hasHeaderExtra && !hasAllAppsContent) ? 1 : 0, LINEAR); setter.setFloat(mContentAlphaFactor, AnimatedFloat.VALUE, hasHeaderExtra ? 1 : 0, - fadeInterpolator); + headerFade); } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java index 6142cdfc10..ab346c0599 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/FlingAndHoldTouchController.java @@ -23,13 +23,17 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.OVERVIEW_PEEK; import static com.android.launcher3.LauncherStateManager.ANIM_ALL; import static com.android.launcher3.LauncherStateManager.ATOMIC_OVERVIEW_PEEK_COMPONENT; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_FADE; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_HEADER_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_HOTSEAT_SCALE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_SCALE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_WORKSPACE_TRANSLATE; +import static com.android.launcher3.anim.Interpolators.ACCEL; import static com.android.launcher3.anim.Interpolators.DEACCEL_3; +import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; @@ -43,6 +47,7 @@ import android.view.ViewConfiguration; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.anim.AnimatorSetBuilder; +import com.android.launcher3.anim.Interpolators; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.quickstep.OverviewInteractionState; import com.android.quickstep.util.MotionPauseDetector; @@ -123,6 +128,13 @@ public class FlingAndHoldTouchController extends PortraitStatesTouchController { LauncherState toState) { if (fromState == NORMAL && toState == ALL_APPS) { AnimatorSetBuilder builder = new AnimatorSetBuilder(); + // Fade in prediction icons quickly, then rest of all apps after reaching overview. + float progressToReachOverview = NORMAL.getVerticalProgress(mLauncher) + - OVERVIEW.getVerticalProgress(mLauncher); + builder.setInterpolator(ANIM_ALL_APPS_HEADER_FADE, Interpolators.clampToProgress(ACCEL, + 0, ALL_APPS_CONTENT_FADE_THRESHOLD)); + builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.clampToProgress(LINEAR, + progressToReachOverview, 1)); // Get workspace out of the way quickly, to prepare for potential pause. builder.setInterpolator(ANIM_WORKSPACE_SCALE, DEACCEL_3); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 109d751c48..a55f36b787 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -62,7 +62,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr /** * The progress at which all apps content will be fully visible when swiping up from overview. */ - private static final float ALL_APPS_CONTENT_FADE_THRESHOLD = 0.08f; + protected static final float ALL_APPS_CONTENT_FADE_THRESHOLD = 0.08f; /** * The progress at which recents will begin fading out when swiping up from overview. diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index a64374bc37..5b3beeca7f 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -7,6 +7,7 @@ import static com.android.launcher3.LauncherState.HOTSEAT_ICONS; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.VERTICAL_SWIPE_INDICATOR; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_FADE; +import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_HEADER_FADE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE; import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; @@ -208,13 +209,14 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil PropertySetter setter = config == null ? NO_ANIM_PROPERTY_SETTER : config.getPropertySetter(builder); boolean hasHeaderExtra = (visibleElements & ALL_APPS_HEADER_EXTRA) != 0; - boolean hasContent = (visibleElements & ALL_APPS_CONTENT) != 0; + boolean hasAllAppsContent = (visibleElements & ALL_APPS_CONTENT) != 0; Interpolator allAppsFade = builder.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR); - setter.setViewAlpha(mAppsView.getContentView(), hasContent ? 1 : 0, allAppsFade); - setter.setViewAlpha(mAppsView.getScrollBar(), hasContent ? 1 : 0, allAppsFade); - mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasContent, setter, - allAppsFade); + Interpolator headerFade = builder.getInterpolator(ANIM_ALL_APPS_HEADER_FADE, allAppsFade); + setter.setViewAlpha(mAppsView.getContentView(), hasAllAppsContent ? 1 : 0, allAppsFade); + setter.setViewAlpha(mAppsView.getScrollBar(), hasAllAppsContent ? 1 : 0, allAppsFade); + mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasAllAppsContent, + setter, headerFade, allAppsFade); mAppsView.getSearchUiManager().setContentVisibility(visibleElements, setter, allAppsFade); setter.setInt(mScrimView, ScrimView.DRAG_HANDLE_ALPHA, diff --git a/src/com/android/launcher3/allapps/FloatingHeaderRow.java b/src/com/android/launcher3/allapps/FloatingHeaderRow.java index 922e4f1a3f..f899587bc0 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderRow.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderRow.java @@ -46,8 +46,8 @@ public interface FloatingHeaderRow { */ boolean hasVisibleContent(); - void setContentVisibility(boolean hasHeaderExtra, boolean hasContent, - PropertySetter setter, Interpolator fadeInterpolator); + void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent, + PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade); /** * Scrolls the content vertically. diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 66dced99d3..42a0eee77c 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -27,6 +27,10 @@ import android.view.ViewGroup; import android.view.animation.Interpolator; import android.widget.LinearLayout; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.recyclerview.widget.RecyclerView; + import com.android.launcher3.DeviceProfile; import com.android.launcher3.Insettable; import com.android.launcher3.Launcher; @@ -40,10 +44,6 @@ import com.android.systemui.plugins.PluginListener; import java.util.ArrayList; import java.util.Map; -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.recyclerview.widget.RecyclerView; - public class FloatingHeaderView extends LinearLayout implements ValueAnimator.AnimatorUpdateListener, PluginListener, Insettable, OnHeightUpdatedListener { @@ -363,14 +363,14 @@ public class FloatingHeaderView extends LinearLayout implements p.y = getTop() - mCurrentRV.getTop() - mParent.getTop(); } - public void setContentVisibility(boolean hasHeader, boolean hasContent, PropertySetter setter, - Interpolator fadeInterpolator) { + public void setContentVisibility(boolean hasHeader, boolean hasAllAppsContent, + PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) { for (FloatingHeaderRow row : mAllRows) { - row.setContentVisibility(hasHeader, hasContent, setter, fadeInterpolator); + row.setContentVisibility(hasHeader, hasAllAppsContent, setter, headerFade, allAppsFade); } - allowTouchForwarding(hasContent); - setter.setFloat(mTabLayout, ALPHA, hasContent ? 1 : 0, fadeInterpolator); + allowTouchForwarding(hasAllAppsContent); + setter.setFloat(mTabLayout, ALPHA, hasAllAppsContent ? 1 : 0, headerFade); } protected void allowTouchForwarding(boolean allow) { diff --git a/src/com/android/launcher3/allapps/PluginHeaderRow.java b/src/com/android/launcher3/allapps/PluginHeaderRow.java index b283ff4056..535ef54bc9 100644 --- a/src/com/android/launcher3/allapps/PluginHeaderRow.java +++ b/src/com/android/launcher3/allapps/PluginHeaderRow.java @@ -64,10 +64,10 @@ public class PluginHeaderRow implements FloatingHeaderRow { } @Override - public void setContentVisibility(boolean hasHeaderExtra, boolean hasContent, - PropertySetter setter, Interpolator fadeInterpolator) { + public void setContentVisibility(boolean hasHeaderExtra, boolean hasAllAppsContent, + PropertySetter setter, Interpolator headerFade, Interpolator allAppsFade) { // Don't use setViewAlpha as we want to control the visibility ourselves. - setter.setFloat(mView, ALPHA, hasContent ? 1 : 0, fadeInterpolator); + setter.setFloat(mView, ALPHA, hasAllAppsContent ? 1 : 0, headerFade); } @Override diff --git a/src/com/android/launcher3/anim/AnimatorSetBuilder.java b/src/com/android/launcher3/anim/AnimatorSetBuilder.java index 11db25be44..cd30dea9c0 100644 --- a/src/com/android/launcher3/anim/AnimatorSetBuilder.java +++ b/src/com/android/launcher3/anim/AnimatorSetBuilder.java @@ -40,6 +40,7 @@ public class AnimatorSetBuilder { public static final int ANIM_OVERVIEW_FADE = 9; public static final int ANIM_ALL_APPS_FADE = 10; public static final int ANIM_OVERVIEW_SCRIM_FADE = 11; + public static final int ANIM_ALL_APPS_HEADER_FADE = 12; // e.g. predictions public static final int FLAG_DONT_ANIMATE_OVERVIEW = 1 << 0; From 03c548901fb77d0a47bb46036d559968b65b2293 Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 31 Jul 2019 18:53:40 -0700 Subject: [PATCH 06/11] Don't end launcher components anim early even if it does nothing The janky animation that ends on the home screen with an invisible task on top is caused by the following scenario (for example): - Quick switch from task A to task B - After landing on B, but before we get the callback that it was successfully launched, switch back to A (or you could go to C) Now we are animating back to A, but we are still waiting to hear whether B was successfully launched. If we hear that the launch was indeed successful, we dutifully clean up after ourselves by returning launcher to its default state. Unfortunately, that clobbers the current animation that is scrolling back to A, and we end up in the bad state where we are showing the default launcher state even though we just launched task B and were about to launch task A. Normally we avoid cleaning up the state animation if the user is still controlling it. The reason we weren't doing that here is because we ended the launcher animation early even though the window animation was still running. Instead, we should keep the launcher animation running for the full duration, so that it prevents a cleanup from occurring in the middle. Bug: 138620399 Change-Id: I959e62a52638a5b974ef9b406555078c928b91f1 --- .../quickstep/WindowTransformSwipeHandler.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java index f1d1141bcd..af18bbf80c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java @@ -1132,17 +1132,16 @@ public class WindowTransformSwipeHandler } if (start == end || duration <= 0) { mLauncherTransitionController.dispatchSetInterpolator(t -> end); - mLauncherTransitionController.getAnimationPlayer().end(); } else { mLauncherTransitionController.dispatchSetInterpolator(adjustedInterpolator); mAnimationFactory.adjustActivityControllerInterpolators(); - mLauncherTransitionController.getAnimationPlayer().setDuration(duration); - - if (QUICKSTEP_SPRINGS.get()) { - mLauncherTransitionController.dispatchOnStartWithVelocity(end, velocityPxPerMs.y); - } - mLauncherTransitionController.getAnimationPlayer().start(); } + mLauncherTransitionController.getAnimationPlayer().setDuration(Math.max(0, duration)); + + if (QUICKSTEP_SPRINGS.get()) { + mLauncherTransitionController.dispatchOnStartWithVelocity(end, velocityPxPerMs.y); + } + mLauncherTransitionController.getAnimationPlayer().start(); mHasLauncherTransitionControllerStarted = true; } From 8ed3b437b1bafae2e7561cb645d04fc29bae401a Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Thu, 1 Aug 2019 15:18:08 -0700 Subject: [PATCH 07/11] Return mIconLastSetTextAlpha from TEXT_ALPHA property This was supposed to go in the last CL but I forgot to commit... Bug: 132455160 Change-Id: Ieb66b1f256d7b14c84bbd4d10af1aa8b073d5ac3 --- .../com/android/launcher3/appprediction/PredictionRowView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java index b406bec829..0c7ba9c95d 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -80,7 +80,7 @@ public class PredictionRowView extends LinearLayout implements @Override public Integer get(PredictionRowView view) { - return view.mIconCurrentTextAlpha; + return view.mIconLastSetTextAlpha; } }; From 40bce3efe497190b91a87b7f82d6568d96d28919 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 30 Jul 2019 13:40:26 -0700 Subject: [PATCH 08/11] Bandage fix for bitmap fatal exception where width / height !> 0. Bug: 135558924 Change-Id: I0a22ba849b50eee87abd52ab9ec3211294a6c40b --- .../launcher3/dragndrop/FolderAdaptiveIcon.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java b/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java index 0c5a1fc5a8..d8a1f99516 100644 --- a/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java +++ b/src/com/android/launcher3/dragndrop/FolderAdaptiveIcon.java @@ -28,6 +28,8 @@ import android.graphics.drawable.Drawable; import android.os.Build; import android.util.Log; +import androidx.annotation.Nullable; + import com.android.launcher3.Launcher; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.R; @@ -66,15 +68,19 @@ public class FolderAdaptiveIcon extends AdaptiveIconDrawable { return mBadge; } - public static FolderAdaptiveIcon createFolderAdaptiveIcon( + public static @Nullable FolderAdaptiveIcon createFolderAdaptiveIcon( Launcher launcher, int folderId, Point dragViewSize) { Preconditions.assertNonUiThread(); int margin = launcher.getResources() .getDimensionPixelSize(R.dimen.blur_size_medium_outline); // Allocate various bitmaps on the background thread, because why not! - final Bitmap badge = Bitmap.createBitmap( - dragViewSize.x - margin, dragViewSize.y - margin, Bitmap.Config.ARGB_8888); + int width = dragViewSize.x - margin; + int height = dragViewSize.y - margin; + if (width <= 0 || height <= 0) { + return null; + } + final Bitmap badge = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); // Create the actual drawable on the UI thread to avoid race conditions with // FolderIcon draw pass From 1eade2f947cae931c2acc73b980b89ca77c7fe5d Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 5 Aug 2019 11:23:19 -0700 Subject: [PATCH 09/11] Use task display id when starting split screen Before starting split screen animation, we dismiss the task view, which can detach the clicked view immediately, if animations are dissabled. That will cause NPE as view.getDisplay will be null Bug: 138793362 Change-Id: I611f6a824f756eceeed57aac5afdf38f421ff8d2 --- .../src/com/android/quickstep/TaskSystemShortcut.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java index 213c5d3244..fd45923070 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskSystemShortcut.java @@ -207,8 +207,7 @@ public class TaskSystemShortcut extends SystemShortcut } }; WindowManagerWrapper.getInstance().overridePendingAppTransitionMultiThumbFuture( - future, animStartedListener, mHandler, true /* scaleUp */, - v.getDisplay().getDisplayId()); + future, animStartedListener, mHandler, true /* scaleUp */, displayId); } }); } From 0121d466ecd42610e92faae68d9e67721e87eaa3 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Thu, 1 Aug 2019 15:44:55 -0700 Subject: [PATCH 10/11] Fix launcher crash when trying to open work profile promise icon. Bug: 138609751 Change-Id: Ifb1c4628ce6307a19a2bb696e4771d5cd5810a90 --- .../launcher3/BaseDraggingActivity.java | 2 +- .../compat/PackageInstallerCompat.java | 6 ++++ .../compat/PackageInstallerCompatVL.java | 17 ++++++++-- .../launcher3/touch/ItemClickHandler.java | 31 +++++++++++++++++-- 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java index 50553095d6..f0b3afd14a 100644 --- a/src/com/android/launcher3/BaseDraggingActivity.java +++ b/src/com/android/launcher3/BaseDraggingActivity.java @@ -170,7 +170,7 @@ public abstract class BaseDraggingActivity extends BaseActivity getUserEventDispatcher().logAppLaunch(v, intent); getStatsLogManager().logAppLaunch(v, intent); return true; - } catch (ActivityNotFoundException|SecurityException e) { + } catch (NullPointerException|ActivityNotFoundException|SecurityException e) { Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show(); Log.e(TAG, "Unable to launch. tag=" + item + " intent=" + intent, e); } diff --git a/src/com/android/launcher3/compat/PackageInstallerCompat.java b/src/com/android/launcher3/compat/PackageInstallerCompat.java index 7dad7e9052..4f4d64161a 100644 --- a/src/com/android/launcher3/compat/PackageInstallerCompat.java +++ b/src/com/android/launcher3/compat/PackageInstallerCompat.java @@ -19,6 +19,7 @@ package com.android.launcher3.compat; import android.content.ComponentName; import android.content.Context; import android.content.pm.PackageInstaller; +import android.os.UserHandle; import java.util.HashMap; import java.util.List; @@ -48,6 +49,11 @@ public abstract class PackageInstallerCompat { */ public abstract HashMap updateAndGetActiveSessionCache(); + /** + * @return an active SessionInfo for {@param pkg} or null if none exists. + */ + public abstract PackageInstaller.SessionInfo getActiveSessionInfo(UserHandle user, String pkg); + public abstract void onStop(); public static final class PackageInstallInfo { diff --git a/src/com/android/launcher3/compat/PackageInstallerCompatVL.java b/src/com/android/launcher3/compat/PackageInstallerCompatVL.java index a34ca50ebf..8a5eabca99 100644 --- a/src/com/android/launcher3/compat/PackageInstallerCompatVL.java +++ b/src/com/android/launcher3/compat/PackageInstallerCompatVL.java @@ -64,9 +64,9 @@ public class PackageInstallerCompatVL extends PackageInstallerCompat { @Override public HashMap updateAndGetActiveSessionCache() { HashMap activePackages = new HashMap<>(); - UserHandle user = Process.myUserHandle(); + UserHandle primaryUser = Process.myUserHandle(); for (SessionInfo info : getAllVerifiedSessions()) { - addSessionInfoToCache(info, user); + addSessionInfoToCache(info, Utilities.ATLEAST_Q ? info.getUser() : primaryUser); if (info.getAppPackageName() != null) { activePackages.put(info.getAppPackageName(), info); mActiveSessions.put(info.getSessionId(), info.getAppPackageName()); @@ -75,6 +75,19 @@ public class PackageInstallerCompatVL extends PackageInstallerCompat { return activePackages; } + public SessionInfo getActiveSessionInfo(UserHandle user, String pkg) { + for (SessionInfo info : getAllVerifiedSessions()) { + boolean match = pkg.equals(info.getAppPackageName()); + if (Utilities.ATLEAST_Q && !user.equals(info.getUser())) { + match = false; + } + if (match) { + return info; + } + } + return null; + } + @Thunk void addSessionInfoToCache(SessionInfo info, UserHandle user) { String packageName = info.getAppPackageName(); if (packageName != null) { diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java index 2895a89be3..03493a5389 100644 --- a/src/com/android/launcher3/touch/ItemClickHandler.java +++ b/src/com/android/launcher3/touch/ItemClickHandler.java @@ -25,9 +25,15 @@ import static com.android.launcher3.Launcher.REQUEST_RECONFIGURE_APPWIDGET; import static com.android.launcher3.model.AppLaunchTracker.CONTAINER_ALL_APPS; import android.app.AlertDialog; +import android.content.ActivityNotFoundException; +import android.content.Context; import android.content.Intent; +import android.content.pm.LauncherApps; +import android.content.pm.PackageInstaller.SessionInfo; import android.os.Process; +import android.os.UserHandle; import android.text.TextUtils; +import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Toast; @@ -43,11 +49,12 @@ import com.android.launcher3.LauncherAppWidgetInfo; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.PromiseAppInfo; import com.android.launcher3.R; +import com.android.launcher3.Utilities; import com.android.launcher3.WorkspaceItemInfo; import com.android.launcher3.compat.AppWidgetManagerCompat; +import com.android.launcher3.compat.PackageInstallerCompat; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; -import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.views.FloatingIconView; import com.android.launcher3.widget.PendingAppWidgetHostView; @@ -58,6 +65,8 @@ import com.android.launcher3.widget.WidgetAddFlowHandler; */ public class ItemClickHandler { + private static final String TAG = ItemClickHandler.class.getSimpleName(); + /** * Instance used for click handling on items */ @@ -146,6 +155,8 @@ public class ItemClickHandler { startMarketIntentForPackage(v, launcher, packageName); return; } + UserHandle user = v.getTag() instanceof ItemInfo + ? ((ItemInfo) v.getTag()).user : Process.myUserHandle(); new AlertDialog.Builder(launcher) .setTitle(R.string.abandoned_promises_title) .setMessage(R.string.abandoned_promise_explanation) @@ -153,12 +164,28 @@ public class ItemClickHandler { (d, i) -> startMarketIntentForPackage(v, launcher, packageName)) .setNeutralButton(R.string.abandoned_clean_this, (d, i) -> launcher.getWorkspace() - .removeAbandonedPromise(packageName, Process.myUserHandle())) + .removeAbandonedPromise(packageName, user)) .create().show(); } private static void startMarketIntentForPackage(View v, Launcher launcher, String packageName) { ItemInfo item = (ItemInfo) v.getTag(); + if (Utilities.ATLEAST_Q) { + PackageInstallerCompat pkgInstaller = PackageInstallerCompat.getInstance(launcher); + SessionInfo sessionInfo = pkgInstaller.getActiveSessionInfo(item.user, packageName); + if (sessionInfo != null) { + LauncherApps launcherApps = launcher.getSystemService(LauncherApps.class); + try { + launcherApps.startPackageInstallerSessionDetailsActivity(sessionInfo, null, + launcher.getActivityLaunchOptionsAsBundle(v)); + return; + } catch (Exception e) { + Log.e(TAG, "Unable to launch market intent for package=" + packageName, e); + } + } + } + + // Fallback to using custom market intent. Intent intent = new PackageManagerHelper(launcher).getMarketIntent(packageName); launcher.startActivitySafely(v, intent, item, null); } From 6b6d0a397276f581569b1968656af76c4ee47109 Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Mon, 5 Aug 2019 17:19:32 -0700 Subject: [PATCH 11/11] Fix DEFER_UPDATES_NEXT_DRAW flag is not unset when binging happens twice Bug: 138646754 Change-Id: I76eccdb812013299e18f197ba17ff858a01a6338 --- src/com/android/launcher3/Launcher.java | 8 +++++--- src/com/android/launcher3/allapps/AllAppsStore.java | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 03fdc971dd..5b38261a4e 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -1896,6 +1896,10 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, if (mPendingExecutor != null) { mPendingExecutor.markCompleted(); mPendingExecutor = null; + + // We might have set this flag previously and forgot to clear it. + mAppsView.getAppsStore() + .disableDeferUpdatesSilently(AllAppsStore.DEFER_UPDATES_NEXT_DRAW); } } @@ -2249,9 +2253,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, @Override public void executeOnNextDraw(ViewOnDrawExecutor executor) { - if (mPendingExecutor != null) { - mPendingExecutor.markCompleted(); - } + clearPendingBinds(); mPendingExecutor = executor; if (!isInState(ALL_APPS)) { mAppsView.getAppsStore().enableDeferUpdates(AllAppsStore.DEFER_UPDATES_NEXT_DRAW); diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java index 160042e692..267363fa7d 100644 --- a/src/com/android/launcher3/allapps/AllAppsStore.java +++ b/src/com/android/launcher3/allapps/AllAppsStore.java @@ -80,6 +80,10 @@ public class AllAppsStore { } } + public void disableDeferUpdatesSilently(int flag) { + mDeferUpdatesFlags &= ~flag; + } + public int getDeferUpdatesFlags() { return mDeferUpdatesFlags; }