From 1d8b7cba318b0c9e8472ffdfd2ca5f5f6a08d655 Mon Sep 17 00:00:00 2001 From: Sihua Ma Date: Tue, 2 Aug 2022 10:49:37 -0700 Subject: [PATCH 1/6] Showing Toast message when the target package is null for the disabled shortcut The shortcut for a certain set of apps could have their component names set to null. In this case, if we still need the package name for the shortcut, we should use the package name from the intent, which is accomplished in getTargetPackage. Additionally, if the target package is still null, we are falling back to showing the Toast messages only. Fix: 239685630 Test: Verified that the crash no longer happens after clicking on grayed out shortcuts Change-Id: I4de68ea1a227032e16e5c00407f75159a7aba30f --- .../android/launcher3/model/data/ItemInfoWithIcon.java | 7 +++---- src/com/android/launcher3/touch/ItemClickHandler.java | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/com/android/launcher3/model/data/ItemInfoWithIcon.java b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java index 76a0c4d64c..e5fb015f2e 100644 --- a/src/com/android/launcher3/model/data/ItemInfoWithIcon.java +++ b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java @@ -16,7 +16,6 @@ package com.android.launcher3.model.data; -import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -220,10 +219,10 @@ public abstract class ItemInfoWithIcon extends ItemInfo { /** Creates an intent to that launches the app store at this app's page. */ @Nullable public Intent getMarketIntent(Context context) { - ComponentName componentName = getTargetComponent(); + String targetPackage = getTargetPackage(); - return componentName != null - ? new PackageManagerHelper(context).getMarketIntent(componentName.getPackageName()) + return targetPackage != null + ? new PackageManagerHelper(context).getMarketIntent(targetPackage) : null; } diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java index e95a787cfd..32c5aa529f 100644 --- a/src/com/android/launcher3/touch/ItemClickHandler.java +++ b/src/com/android/launcher3/touch/ItemClickHandler.java @@ -248,13 +248,19 @@ public class ItemClickHandler { final Launcher launcher = Launcher.getLauncher(context); if (shortcut.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT && shortcut.isDisabledVersionLower()) { + final Intent marketIntent = shortcut.getMarketIntent(context); + // No market intent means no target package for the shortcut, which should be an + // issue. Falling back to showing toast messages. + if (marketIntent == null) { + return false; + } new AlertDialog.Builder(context) .setTitle(R.string.dialog_update_title) .setMessage(R.string.dialog_update_message) .setPositiveButton(R.string.dialog_update, (d, i) -> { // Direct the user to the play store to update the app - context.startActivity(shortcut.getMarketIntent(context)); + context.startActivity(marketIntent); }) .setNeutralButton(R.string.dialog_remove, (d, i) -> { // Remove the icon if launcher is successfully initialized From e41c5b005fb80062770071740836bc7589a8f04e Mon Sep 17 00:00:00 2001 From: Sunny Goyal Date: Fri, 16 Sep 2022 09:45:56 -0700 Subject: [PATCH 2/6] Fixing nullPointerException is RotationHelper Bug: 247055735 Test: Verified on device Change-Id: Ie73be138bdb616fb9db739b09c12794d61183657 --- src/com/android/launcher3/states/RotationHelper.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/states/RotationHelper.java b/src/com/android/launcher3/states/RotationHelper.java index c408904ffa..b94ea0707b 100644 --- a/src/com/android/launcher3/states/RotationHelper.java +++ b/src/com/android/launcher3/states/RotationHelper.java @@ -24,12 +24,16 @@ import static com.android.launcher3.Utilities.dpiFromPx; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.window.WindowManagerProxy.MIN_TABLET_WIDTH; +import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; import android.os.Handler; import android.os.Message; +import androidx.annotation.Nullable; +import androidx.annotation.WorkerThread; + import com.android.launcher3.BaseActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Utilities; @@ -58,6 +62,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, public static final int REQUEST_ROTATE = 1; public static final int REQUEST_LOCK = 2; + @Nullable private BaseActivity mActivity; private SharedPreferences mSharedPrefs = null; private final Handler mRequestOrientationHandler; @@ -209,8 +214,12 @@ public class RotationHelper implements OnSharedPreferenceChangeListener, } } + @WorkerThread private boolean setOrientationAsync(Message msg) { - mActivity.setRequestedOrientation(msg.what); + Activity activity = mActivity; + if (activity != null) { + activity.setRequestedOrientation(msg.what); + } return true; } From a4ba51679791b5f8199367f2ad373dd85f4ae0d5 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Mon, 12 Sep 2022 21:20:14 -0700 Subject: [PATCH 3/6] Update animations for TM-QPR: OverviewSplitSelect > Confirmed transition This change updates the animation for confirming a split. Includes: - New timings - A new interface, SplitAnimationTimings, that centralizes timing values for splitscreen animations Fixes: 241126570 Test: Manual Change-Id: I61339964a7254618b368b17f00fda8f5efb53de4 --- .../QuickstepAtomicAnimationFactory.java | 14 +-- .../states/SplitScreenSelectState.java | 9 +- .../util/OverviewToSplitTimings.java | 89 ++++++++++++++ .../quickstep/util/SplitAnimationTimings.java | 79 ++++++++++++ .../quickstep/util/SplitToConfirmTimings.java | 45 +++++++ .../quickstep/views/FloatingTaskView.java | 113 ++++++++++-------- .../android/quickstep/views/RecentsView.java | 108 ++++++----------- .../android/launcher3/anim/Interpolators.java | 2 +- 8 files changed, 316 insertions(+), 143 deletions(-) create mode 100644 quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java create mode 100644 quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java create mode 100644 quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index f5161aa25f..bfece6c5e2 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -62,6 +62,7 @@ import com.android.launcher3.touch.AllAppsSwipeController; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.DisplayController; import com.android.quickstep.util.RecentsAtomicAnimationFactory; +import com.android.quickstep.util.SplitAnimationTimings; import com.android.quickstep.views.RecentsView; /** @@ -79,14 +80,6 @@ public class QuickstepAtomicAnimationFactory extends private static final int PER_PAGE_SCROLL_DURATION = 150; private static final int MAX_PAGE_SCROLL_DURATION = 750; - private static final int OVERVIEW_TO_SPLIT_ACTIONS_FADE_START = 0; - private static final int OVERVIEW_TO_SPLIT_ACTIONS_FADE_END = 83; - - private static final float OVERVIEW_TO_SPLIT_ACTIONS_FADE_START_OFFSET = - (float) OVERVIEW_TO_SPLIT_ACTIONS_FADE_START / SplitScreenSelectState.ENTER_DURATION; - private static final float OVERVIEW_TO_SPLIT_ACTIONS_FADE_END_OFFSET = - (float) OVERVIEW_TO_SPLIT_ACTIONS_FADE_END / SplitScreenSelectState.ENTER_DURATION; - // Due to use of physics, duration may differ between devices so we need to calculate and // cache the value. private int mHintToNormalDuration = -1; @@ -197,9 +190,10 @@ public class QuickstepAtomicAnimationFactory extends } else if (fromState == NORMAL && toState == ALL_APPS) { AllAppsSwipeController.applyNormalToAllAppsAnimConfig(mActivity, config); } else if (fromState == OVERVIEW && toState == OVERVIEW_SPLIT_SELECT) { + SplitAnimationTimings timings = SplitAnimationTimings.OVERVIEW_TO_SPLIT; config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR, - OVERVIEW_TO_SPLIT_ACTIONS_FADE_START_OFFSET, - OVERVIEW_TO_SPLIT_ACTIONS_FADE_END_OFFSET)); + timings.getActionsFadeStartOffset(), + timings.getActionsFadeEndOffset())); } } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java b/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java index 2bc3c3e959..430053d066 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/SplitScreenSelectState.java @@ -19,6 +19,7 @@ package com.android.launcher3.uioverrides.states; import android.content.Context; import com.android.launcher3.Launcher; +import com.android.quickstep.util.SplitAnimationTimings; import com.android.quickstep.views.RecentsView; /** @@ -26,10 +27,6 @@ import com.android.quickstep.views.RecentsView; * pinned and user is selecting the second one */ public class SplitScreenSelectState extends OverviewState { - public static final int ENTER_DURATION = 866; - public static final int EXIT_DURATION = 500; - // TODO: Add ability to differentiate between Split > Home and Split > Confirmed timings - public SplitScreenSelectState(int id) { super(id); } @@ -47,6 +44,8 @@ public class SplitScreenSelectState extends OverviewState { @Override public int getTransitionDuration(Context context, boolean isToState) { - return isToState ? ENTER_DURATION : EXIT_DURATION; + return isToState + ? SplitAnimationTimings.ENTER_DURATION + : SplitAnimationTimings.ABORT_DURATION; } } diff --git a/quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java b/quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java new file mode 100644 index 0000000000..40e547b749 --- /dev/null +++ b/quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2022 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.quickstep.util; + +import static com.android.launcher3.anim.Interpolators.DEACCEL_2; + +import android.view.animation.Interpolator; + +/** + * Timings for the Overview > OverviewSplitSelect animation. + */ +public class OverviewToSplitTimings implements SplitAnimationTimings { + public int getThumbnailFadeToGrayStart() { return 0; } + public int getThumbnailFadeToGrayEnd() { return 133; } + public int getDockedIconFadeInStart() { return 167; } + public int getDockedIconFadeInEnd() { return 250; } + public int getStagedRectSlideStart() { return 0; } + public int getStagedRectSlideEnd() { return 417; } + public int getGridSlideStart() { return 67; } + public int getGridSlideStagger() { return 16; } + public int getGridSlideDuration() { return 500; } + public int getActionsFadeStart() { return 0; } + public int getActionsFadeEnd() { return 83; } + public int getIconFadeStart() { return 0; } + public int getIconFadeEnd() { return 83; } + public int getInstructionsContainerFadeInStart() { return 167; } + public int getInstructionsContainerFadeInEnd() { return 250; } + public int getInstructionsTextFadeInStart() { return 217; } + public int getInstructionsTextFadeInEnd() { return 300; } + public int getInstructionsUnfoldStart() { return 167; } + public int getInstructionsUnfoldEnd() { return 500; } + + public int getDuration() { return ENTER_DURATION; } + public Interpolator getStagedRectSlideInterpolator() { return DEACCEL_2; } + + public float getGridSlideStartOffset() { + return (float) getGridSlideStart() / getDuration(); + } + public float getGridSlideStaggerOffset() { + return (float) getGridSlideStagger() / getDuration(); + } + public float getGridSlideDurationOffset() { + return (float) getGridSlideDuration() / getDuration(); + } + public float getActionsFadeStartOffset() { + return (float) getActionsFadeStart() / getDuration(); + } + public float getActionsFadeEndOffset() { + return (float) getActionsFadeEnd() / getDuration(); + } + public float getIconFadeStartOffset() { + return (float) getIconFadeStart() / getDuration(); + } + public float getIconFadeEndOffset() { + return (float) getIconFadeEnd() / getDuration(); + } + public float getInstructionsContainerFadeInStartOffset() { + return (float) getInstructionsContainerFadeInStart() / getDuration(); + } + public float getInstructionsContainerFadeInEndOffset() { + return (float) getInstructionsContainerFadeInEnd() / getDuration(); + } + public float getInstructionsTextFadeInStartOffset() { + return (float) getInstructionsTextFadeInStart() / getDuration(); + } + public float getInstructionsTextFadeInEndOffset() { + return (float) getInstructionsTextFadeInEnd() / getDuration(); + } + public float getInstructionsUnfoldStartOffset() { + return (float) getInstructionsUnfoldStart() / getDuration(); + } + public float getInstructionsUnfoldEndOffset() { + return (float) getInstructionsUnfoldEnd() / getDuration(); + } +} diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java b/quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java new file mode 100644 index 0000000000..c6f7fb125a --- /dev/null +++ b/quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2022 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.quickstep.util; + +import android.view.animation.Interpolator; + +/** + * An interface that supports the centralization of timing information for splitscreen animations. + */ +public interface SplitAnimationTimings { + int ENTER_DURATION = 866; + int ABORT_DURATION = 500; + int CONFIRM_DURATION = 383; + + SplitAnimationTimings OVERVIEW_TO_SPLIT = new OverviewToSplitTimings(); + SplitAnimationTimings SPLIT_TO_CONFIRM = new SplitToConfirmTimings(); + + // Shared methods + int getDuration(); + int getThumbnailFadeToGrayStart(); + int getThumbnailFadeToGrayEnd(); + int getDockedIconFadeInStart(); + int getDockedIconFadeInEnd(); + int getStagedRectSlideStart(); + int getStagedRectSlideEnd(); + Interpolator getStagedRectSlideInterpolator(); + default float getThumbnailFadeToGrayStartOffset() { + return (float) getThumbnailFadeToGrayStart() / getDuration(); + } + default float getThumbnailFadeToGrayEndOffset() { + return (float) getThumbnailFadeToGrayEnd() / getDuration(); + } + default float getDockedIconFadeInStartOffset() { + return (float) getDockedIconFadeInStart() / getDuration(); + } + default float getDockedIconFadeInEndOffset() { + return (float) getDockedIconFadeInEnd() / getDuration(); + } + default float getStagedRectSlideStartOffset() { + return (float) getStagedRectSlideStart() / getDuration(); + } + default float getStagedRectSlideEndOffset() { + return (float) getStagedRectSlideEnd() / getDuration(); + } + + // Defaults for OverviewToSplit + default float getGridSlideStartOffset() { return 0; } + default float getGridSlideStaggerOffset() { return 0; } + default float getGridSlideDurationOffset() { return 0; } + default float getActionsFadeStartOffset() { return 0; } + default float getActionsFadeEndOffset() { return 0; } + default float getIconFadeStartOffset() { return 0; } + default float getIconFadeEndOffset() { return 0; } + default float getInstructionsContainerFadeInStartOffset() { return 0; } + default float getInstructionsContainerFadeInEndOffset() { return 0; } + default float getInstructionsTextFadeInStartOffset() { return 0; } + default float getInstructionsTextFadeInEndOffset() { return 0; } + default float getInstructionsUnfoldStartOffset() { return 0; } + default float getInstructionsUnfoldEndOffset() { return 0; } + + // Defaults for SplitToConfirm + default float getInstructionsFadeStartOffset() { return 0; } + default float getInstructionsFadeEndOffset() { return 0; } +} + diff --git a/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java b/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java new file mode 100644 index 0000000000..2eb0941aa2 --- /dev/null +++ b/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2022 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.quickstep.util; + +import static com.android.launcher3.anim.Interpolators.LINEAR; + +import android.view.animation.Interpolator; + +/** + * Timings for the OverviewSplitSelect > confirmed animation. + */ +public class SplitToConfirmTimings implements SplitAnimationTimings { + public int getThumbnailFadeToGrayStart() { return 0; } + public int getThumbnailFadeToGrayEnd() { return 133; } + public int getDockedIconFadeInStart() { return 167; } + public int getDockedIconFadeInEnd() { return 250; } + public int getStagedRectSlideStart() { return 0; } + public int getStagedRectSlideEnd() { return 383; } + public int getInstructionsFadeStart() { return 0; } + public int getInstructionsFadeEnd() { return 67; } + + public int getDuration() { return CONFIRM_DURATION; } + public Interpolator getStagedRectSlideInterpolator() { return LINEAR; } + + public float getInstructionsFadeStartOffset() { + return (float) getInstructionsFadeStart() / getDuration(); + } + public float getInstructionsFadeEndOffset() { + return (float) getInstructionsFadeEnd() / getDuration(); + } +} diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index c211d7ad4b..1d58748b62 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -2,7 +2,6 @@ package com.android.quickstep.views; import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU; import static com.android.launcher3.anim.Interpolators.ACCEL; -import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.clampToProgress; @@ -31,10 +30,10 @@ import com.android.launcher3.Utilities; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.uioverrides.states.SplitScreenSelectState; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.launcher3.views.BaseDragLayer; import com.android.quickstep.util.MultiValueUpdateListener; +import com.android.quickstep.util.SplitAnimationTimings; import com.android.quickstep.util.TaskCornerRadius; import com.android.systemui.shared.system.QuickStepContract; @@ -44,38 +43,14 @@ import com.android.systemui.shared.system.QuickStepContract; * which will have the thumbnail from the provided existing TaskView overlaying the taskview itself. * * Can then animate the taskview using - * {@link #addAnimation(PendingAnimation, RectF, Rect, boolean, boolean)} + * {@link #addStagingAnimation(PendingAnimation, RectF, Rect, boolean, boolean)} or + * {@link #addConfirmAnimation(PendingAnimation, RectF, Rect, boolean, boolean)} * giving a starting and ending bounds. Currently this is set to use the split placeholder view, * but it could be generified. * * TODO: Figure out how to copy thumbnail data from existing TaskView to this view. */ public class FloatingTaskView extends FrameLayout { - private static final int OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START = 0; - private static final int OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END = 133; - private static final int OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START = 167; - private static final int OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END = 250; - private static final int OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START = 0; - private static final int OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END = 417; - - private static final float OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START_OFFSET = - (float) OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START - / SplitScreenSelectState.ENTER_DURATION; - private static final float OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END_OFFSET = - (float) OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END - / SplitScreenSelectState.ENTER_DURATION; - private static final float OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START_OFFSET = - (float) OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START - / SplitScreenSelectState.ENTER_DURATION; - private static final float OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END_OFFSET = - (float) OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END - / SplitScreenSelectState.ENTER_DURATION; - private static final float OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET = - (float) OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START - / SplitScreenSelectState.ENTER_DURATION; - private static final float OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET = - (float) OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END - / SplitScreenSelectState.ENTER_DURATION; public static final FloatProperty PRIMARY_TRANSLATE_OFFSCREEN = new FloatProperty("floatingTaskPrimaryTranslateOffscreen") { @@ -236,8 +211,34 @@ public class FloatingTaskView extends FrameLayout { layout(left, lp.topMargin, left + lp.width, lp.topMargin + lp.height); } - public void addAnimation(PendingAnimation animation, RectF startingBounds, Rect endBounds, - boolean fadeWithThumbnail, boolean isStagedTask) { + /** + * Animates a FloatingTaskThumbnailView and its overlapping SplitPlaceholderView when a split + * is staged. + */ + public void addStagingAnimation(PendingAnimation animation, RectF startingBounds, + Rect endBounds, boolean fadeWithThumbnail, boolean isStagedTask) { + addAnimation(animation, startingBounds, endBounds, fadeWithThumbnail, isStagedTask, + SplitAnimationTimings.OVERVIEW_TO_SPLIT); + } + + /** + * Animates the FloatingTaskThumbnailView and SplitPlaceholderView for the two thumbnails + * when a split is confirmed. + */ + public void addConfirmAnimation(PendingAnimation animation, RectF startingBounds, + Rect endBounds, boolean fadeWithThumbnail, boolean isStagedTask) { + addAnimation(animation, startingBounds, endBounds, fadeWithThumbnail, isStagedTask, + SplitAnimationTimings.SPLIT_TO_CONFIRM); + } + + /** + * Sets up and builds a split staging animation. + * Called by {@link #addStagingAnimation(PendingAnimation, RectF, Rect, boolean, boolean)} and + * {@link #addConfirmAnimation(PendingAnimation, RectF, Rect, boolean, boolean)}. + */ + public void addAnimation(PendingAnimation animation, RectF startingBounds, + Rect endBounds, boolean fadeWithThumbnail, boolean isStagedTask, + SplitAnimationTimings timings) { mFullscreenParams.setIsStagedTask(isStagedTask); final BaseDragLayer dragLayer = mActivity.getDragLayer(); int[] dragLayerBounds = new int[2]; @@ -251,49 +252,54 @@ public class FloatingTaskView extends FrameLayout { RectF floatingTaskViewBounds = new RectF(); if (fadeWithThumbnail) { - // This code block runs when animating from Overview > OverviewSplitSelect - // And for the second thumbnail on confirm + // This code block runs for the placeholder view during Overview > OverviewSplitSelect + // and for the selected (secondary) thumbnail during OverviewSplitSelect > Confirmed // FloatingTaskThumbnailView: thumbnail fades out to transparent animation.setViewAlpha(mThumbnailView, 0, clampToProgress(LINEAR, - OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START_OFFSET, - OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END_OFFSET)); + timings.getThumbnailFadeToGrayStartOffset(), + timings.getThumbnailFadeToGrayEndOffset())); - // SplitPlaceholderView: gray background fades in at the same time, then new icon fades - // in + // SplitPlaceholderView: gray background fades in at same time, then new icon fades in animation.setViewAlpha(mSplitPlaceholderView, 1, clampToProgress(LINEAR, - OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_START_OFFSET, - OVERVIEW_TO_SPLIT_THUMBNAIL_FADE_TO_GRAY_END_OFFSET)); + timings.getThumbnailFadeToGrayStartOffset(), + timings.getThumbnailFadeToGrayEndOffset())); animation.setViewAlpha(mSplitPlaceholderView.getIconView(), 1, clampToProgress( - LINEAR, OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_START_OFFSET, - OVERVIEW_TO_SPLIT_DOCKED_ICON_FADE_IN_END_OFFSET)); + LINEAR, + timings.getDockedIconFadeInStartOffset(), + timings.getDockedIconFadeInEndOffset())); } else if (isStagedTask) { - // This code block runs when animating from Normal > OverviewSplitSelect - // and for the first thumbnail on confirm + // This code block runs for the placeholder view during Normal > OverviewSplitSelect + // and for the placeholder (primary) thumbnail during OverviewSplitSelect > Confirmed - // Fade in the placeholder view when split is initiated from homescreen / all apps + // Fade in the placeholder view during Normal > OverviewSplitSelect if (mSplitPlaceholderView.getAlpha() == 0) { animation.setViewAlpha(mSplitPlaceholderView, 0.3f, INSTANT); animation.setViewAlpha(mSplitPlaceholderView, 1, ACCEL); } + + // No-op for placeholder during OverviewSplitSelect > Confirmed, alpha should be set } + MultiValueUpdateListener listener = new MultiValueUpdateListener() { // SplitPlaceholderView: rectangle translates and stretches to new position final FloatProp mDx = new FloatProp(0, prop.dX, 0, animDuration, - clampToProgress(DEACCEL_2, OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, - OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); + clampToProgress(timings.getStagedRectSlideInterpolator(), + timings.getStagedRectSlideStartOffset(), + timings.getStagedRectSlideEndOffset())); final FloatProp mDy = new FloatProp(0, prop.dY, 0, animDuration, - clampToProgress(DEACCEL_2, OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, - OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); + clampToProgress(timings.getStagedRectSlideInterpolator(), + timings.getStagedRectSlideStartOffset(), + timings.getStagedRectSlideEndOffset())); final FloatProp mTaskViewScaleX = new FloatProp(1f, prop.finalTaskViewScaleX, 0, - animDuration, clampToProgress(DEACCEL_2, - OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, - OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); + animDuration, clampToProgress(timings.getStagedRectSlideInterpolator(), + timings.getStagedRectSlideStartOffset(), + timings.getStagedRectSlideEndOffset())); final FloatProp mTaskViewScaleY = new FloatProp(1f, prop.finalTaskViewScaleY, 0, - animDuration, clampToProgress(DEACCEL_2, - OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_START_OFFSET, - OVERVIEW_TO_SPLIT_STAGED_RECT_SLIDE_END_OFFSET)); + animDuration, clampToProgress(timings.getStagedRectSlideInterpolator(), + timings.getStagedRectSlideStartOffset(), + timings.getStagedRectSlideEndOffset())); @Override public void onUpdate(float percent, boolean initOnly) { // Calculate the icon position. @@ -305,6 +311,7 @@ public class FloatingTaskView extends FrameLayout { update(floatingTaskViewBounds, percent); } }; + transitionAnimator.addUpdateListener(listener); } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 8da08b4007..3f2681c6fe 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -39,7 +39,7 @@ import static com.android.launcher3.anim.Interpolators.EMPHASIZED_DECELERATE; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.LINEAR; -import static com.android.launcher3.anim.Interpolators.OVERSHOOT_0_85; +import static com.android.launcher3.anim.Interpolators.OVERSHOOT_0_75; import static com.android.launcher3.anim.Interpolators.clampToProgress; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL; @@ -140,7 +140,6 @@ import com.android.launcher3.statemanager.BaseState; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.touch.OverScroll; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.uioverrides.states.SplitScreenSelectState; import com.android.launcher3.util.DynamicResource; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.IntSet; @@ -173,6 +172,7 @@ import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.GroupTask; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.util.RecentsOrientedState; +import com.android.quickstep.util.SplitAnimationTimings; import com.android.quickstep.util.SplitScreenBounds; import com.android.quickstep.util.SplitSelectStateController; import com.android.quickstep.util.SurfaceTransaction; @@ -417,54 +417,6 @@ public abstract class RecentsView { mSplitSelectStateController.launchSplitTasks( aBoolean1 -> RecentsView.this.resetFromSplitSelectionState()); diff --git a/src/com/android/launcher3/anim/Interpolators.java b/src/com/android/launcher3/anim/Interpolators.java index d900c90814..b55a1e4ada 100644 --- a/src/com/android/launcher3/anim/Interpolators.java +++ b/src/com/android/launcher3/anim/Interpolators.java @@ -83,7 +83,7 @@ public class Interpolators { EXAGGERATED_EASE = new PathInterpolator(exaggeratedEase); } - public static final Interpolator OVERSHOOT_0_85 = new OvershootInterpolator(0.85f); + public static final Interpolator OVERSHOOT_0_75 = new OvershootInterpolator(0.75f); public static final Interpolator OVERSHOOT_1_2 = new OvershootInterpolator(1.2f); public static final Interpolator OVERSHOOT_1_7 = new OvershootInterpolator(1.7f); From f132bd7d3fb4a163730ae5b45c05b1b15c7e0fbc Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 19 Sep 2022 19:05:10 -0700 Subject: [PATCH 4/6] Adding a comment for goHome() Bug: 187761685 Test: presubmit Change-Id: I2917daa90f22cc0da0169c287b02cc4cf37a8f4b --- .../launcher3/tapl/LauncherInstrumentation.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index 43766bf496..e0df3f07be 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -893,7 +893,14 @@ public final class LauncherInstrumentation { } /** - * Presses nav bar home button. + * Goes to home by swiping up in zero-button mode or pressing Home button. + * Calling it after another TAPL call is safe because all TAPL methods wait for the animations + * to finish. + * When calling it after a non-TAPL method, make sure that all animations have already + * completed, otherwise it may detect the current state (for example "Application" or "Home") + * incorrectly. + * The method expects either app or Launcher to be active when it's called. Other states, such + * as visible notification shade are not supported. * * @return the Workspace object. */ @@ -1894,8 +1901,9 @@ public final class LauncherInstrumentation { /** * Taps outside container to dismiss. + * * @param container container to be dismissed - * @param tapRight tap on the right of the container if true, or left otherwise + * @param tapRight tap on the right of the container if true, or left otherwise */ void touchOutsideContainer(UiObject2 container, boolean tapRight) { try (LauncherInstrumentation.Closable c = addContextLayer( From 2fbddc49498c3b52d5a30f99406964c550678177 Mon Sep 17 00:00:00 2001 From: Jeremy Sim Date: Sat, 17 Sep 2022 15:32:11 -0700 Subject: [PATCH 5/6] Fix small bug with DWB banners not animating out promptly This CL fixes an issue where initiating split select on a task with a DWB banner would result in the DWB banner sticking around long after the thumbnail itself fades, interfering visually with the rest of the animation. Fixed by hiding all child views of the taskview when splitting, instead of just the thumbnail. Fixes: 247257724 Test: Manual Change-Id: I4dbeccf8dd28431749df5e78482e80aacf5df55a --- .../views/DigitalWellBeingToast.java | 8 ++++++ .../quickstep/views/GroupedTaskView.java | 28 +++++++++++++++---- .../android/quickstep/views/RecentsView.java | 26 +++++++---------- .../com/android/quickstep/views/TaskView.java | 19 +++++++++---- 4 files changed, 55 insertions(+), 26 deletions(-) diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java index 76552a3d50..96504afcd4 100644 --- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java @@ -385,4 +385,12 @@ public final class DigitalWellBeingToast { mBanner.setLayerType(View.LAYER_TYPE_HARDWARE, layerPaint); mBanner.setLayerPaint(layerPaint); } + + void setBannerVisibility(int visibility) { + if (mBanner == null) { + return; + } + + mBanner.setVisibility(visibility); + } } diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java index 44ea0a0b5e..5bc7f18d0c 100644 --- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.java +++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.java @@ -230,11 +230,12 @@ public class GroupedTaskView extends TaskView { } @Override - protected int getChildTaskIndexAtPosition(PointF position) { - if (isCoordInView(mIconView2, position) || isCoordInView(mSnapshotView2, position)) { + protected int getLastSelectedChildTaskIndex() { + if (isCoordInView(mIconView2, mLastTouchDownPosition) + || isCoordInView(mSnapshotView2, mLastTouchDownPosition)) { return 1; } - return super.getChildTaskIndexAtPosition(position); + return super.getLastSelectedChildTaskIndex(); } private boolean isCoordInView(View v, PointF position) { @@ -336,9 +337,26 @@ public class GroupedTaskView extends TaskView { mSnapshotView2.setSplashAlpha(mTaskThumbnailSplashAlpha); } + /** + * Sets visibility for thumbnails and associated elements (DWB banners). + * IconView is unaffected. + * + * When setting INVISIBLE, sets the visibility for the last selected child task. + * When setting VISIBLE (as a reset), sets the visibility for both tasks. + */ @Override void setThumbnailVisibility(int visibility) { - super.setThumbnailVisibility(visibility); - mSnapshotView2.setVisibility(visibility); + if (visibility == VISIBLE) { + mSnapshotView.setVisibility(visibility); + mDigitalWellBeingToast.setBannerVisibility(visibility); + mSnapshotView2.setVisibility(visibility); + mDigitalWellBeingToast2.setBannerVisibility(visibility); + } else if (getLastSelectedChildTaskIndex() == 0) { + mSnapshotView.setVisibility(visibility); + mDigitalWellBeingToast.setBannerVisibility(visibility); + } else { + mSnapshotView2.setVisibility(visibility); + mDigitalWellBeingToast2.setBannerVisibility(visibility); + } } } diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 6a94094146..aa8f1835d8 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -703,7 +703,7 @@ public abstract class RecentsView RecentsView.this.resetFromSplitSelectionState()); InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER); }); - if (containerTaskView.containsMultipleTasks()) { - // If we are launching from a child task, then only hide the thumbnail itself - mSecondSplitHiddenView = thumbnailView; - } else { - mSecondSplitHiddenView = containerTaskView; - } - mSecondSplitHiddenView.setVisibility(INVISIBLE); + + mSecondSplitHiddenView = containerTaskView; + mSecondSplitHiddenView.setThumbnailVisibility(INVISIBLE); + InteractionJankMonitorWrapper.begin(this, InteractionJankMonitorWrapper.CUJ_SPLIT_SCREEN_ENTER, "Second tile selected"); @@ -4278,13 +4275,14 @@ public abstract class RecentsView Date: Mon, 19 Sep 2022 21:53:53 -0700 Subject: [PATCH 6/6] Update animations for TM-QPR: Home > OverviewSplitSelect transition This change updates the animation for initiating a split from the home screen. Also fixes a bug where icons were getting severely pixelated mid-animation. Fixes: 236759099 Fixes: 244499770 Test: Manual Change-Id: I56a76cbf286bd30540f3debdcb681d39c890a445 --- .../popup/QuickstepSystemShortcut.java | 1 + .../taskbar/TaskbarPopupController.java | 1 + .../QuickstepAtomicAnimationFactory.java | 8 ++++ .../quickstep/util/NormalToSplitTimings.java | 43 +++++++++++++++++++ .../util/OverviewToSplitTimings.java | 13 +++--- .../quickstep/util/SplitAnimationTimings.java | 34 +++++++++------ .../quickstep/util/SplitToConfirmTimings.java | 13 +++--- .../quickstep/views/FloatingTaskView.java | 41 ++++++++++-------- .../android/quickstep/views/RecentsView.java | 3 +- 9 files changed, 114 insertions(+), 43 deletions(-) create mode 100644 quickstep/src/com/android/quickstep/util/NormalToSplitTimings.java diff --git a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java index 9a682c6e53..7c3281a046 100644 --- a/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java +++ b/quickstep/src/com/android/launcher3/popup/QuickstepSystemShortcut.java @@ -55,6 +55,7 @@ public interface QuickstepSystemShortcut { @Override public void onClick(View view) { + // Initiate splitscreen from the Home screen or Home All Apps Bitmap bitmap; Intent intent; if (mItemInfo instanceof WorkspaceItemInfo) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java index 49d0873037..da6dab1e10 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarPopupController.java @@ -270,6 +270,7 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba @Override public void onClick(View view) { + // Initiate splitscreen from the in-app Taskbar or Taskbar All Apps Pair instanceIds = LogUtils.getShellShareableInstanceId(); mTarget.getStatsLogManager().logger() diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java index bfece6c5e2..f75a404821 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java @@ -34,6 +34,7 @@ import static com.android.launcher3.anim.Interpolators.EMPHASIZED_DECELERATE; import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; +import static com.android.launcher3.anim.Interpolators.OVERSHOOT_0_75; import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2; import static com.android.launcher3.anim.Interpolators.clampToProgress; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; @@ -194,6 +195,13 @@ public class QuickstepAtomicAnimationFactory extends config.setInterpolator(ANIM_OVERVIEW_ACTIONS_FADE, clampToProgress(LINEAR, timings.getActionsFadeStartOffset(), timings.getActionsFadeEndOffset())); + } else if (fromState == NORMAL && toState == OVERVIEW_SPLIT_SELECT) { + SplitAnimationTimings timings = SplitAnimationTimings.NORMAL_TO_SPLIT; + config.setInterpolator(ANIM_SCRIM_FADE, clampToProgress(LINEAR, + timings.getScrimFadeInStartOffset(), + timings.getScrimFadeInEndOffset())); + config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_X, OVERSHOOT_0_75); + config.setInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, OVERSHOOT_0_75); } } } diff --git a/quickstep/src/com/android/quickstep/util/NormalToSplitTimings.java b/quickstep/src/com/android/quickstep/util/NormalToSplitTimings.java new file mode 100644 index 0000000000..1bf5a5dda7 --- /dev/null +++ b/quickstep/src/com/android/quickstep/util/NormalToSplitTimings.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2022 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.quickstep.util; + +import static com.android.launcher3.anim.Interpolators.LINEAR; + +import android.view.animation.Interpolator; + +/** + * Timings for the Normal > OverviewSplitSelect animation. + */ +public class NormalToSplitTimings extends OverviewToSplitTimings implements SplitAnimationTimings { + @Override + public Interpolator getStagedRectXInterpolator() { return LINEAR; } + @Override + public Interpolator getStagedRectScaleXInterpolator() { return LINEAR; } + @Override + public Interpolator getStagedRectScaleYInterpolator() { return LINEAR; } + + public int getScrimFadeInStart() { return 0; } + public int getScrimFadeInEnd() { return 167; } + + public float getScrimFadeInStartOffset() { + return (float) getScrimFadeInStart() / getDuration(); + } + public float getScrimFadeInEndOffset() { + return (float) getScrimFadeInEnd() / getDuration(); + } +} diff --git a/quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java b/quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java index 40e547b749..f44796b79e 100644 --- a/quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java +++ b/quickstep/src/com/android/quickstep/util/OverviewToSplitTimings.java @@ -24,10 +24,10 @@ import android.view.animation.Interpolator; * Timings for the Overview > OverviewSplitSelect animation. */ public class OverviewToSplitTimings implements SplitAnimationTimings { - public int getThumbnailFadeToGrayStart() { return 0; } - public int getThumbnailFadeToGrayEnd() { return 133; } - public int getDockedIconFadeInStart() { return 167; } - public int getDockedIconFadeInEnd() { return 250; } + public int getPlaceholderFadeInStart() { return 0; } + public int getPlaceholderFadeInEnd() { return 133; } + public int getPlaceholderIconFadeInStart() { return 167; } + public int getPlaceholderIconFadeInEnd() { return 250; } public int getStagedRectSlideStart() { return 0; } public int getStagedRectSlideEnd() { return 417; } public int getGridSlideStart() { return 67; } @@ -45,7 +45,10 @@ public class OverviewToSplitTimings implements SplitAnimationTimings { public int getInstructionsUnfoldEnd() { return 500; } public int getDuration() { return ENTER_DURATION; } - public Interpolator getStagedRectSlideInterpolator() { return DEACCEL_2; } + public Interpolator getStagedRectXInterpolator() { return DEACCEL_2; } + public Interpolator getStagedRectYInterpolator() { return DEACCEL_2; } + public Interpolator getStagedRectScaleXInterpolator() { return DEACCEL_2; } + public Interpolator getStagedRectScaleYInterpolator() { return DEACCEL_2; } public float getGridSlideStartOffset() { return (float) getGridSlideStart() / getDuration(); diff --git a/quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java b/quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java index c6f7fb125a..133be0394e 100644 --- a/quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java +++ b/quickstep/src/com/android/quickstep/util/SplitAnimationTimings.java @@ -27,28 +27,32 @@ public interface SplitAnimationTimings { int CONFIRM_DURATION = 383; SplitAnimationTimings OVERVIEW_TO_SPLIT = new OverviewToSplitTimings(); + SplitAnimationTimings NORMAL_TO_SPLIT = new NormalToSplitTimings(); SplitAnimationTimings SPLIT_TO_CONFIRM = new SplitToConfirmTimings(); // Shared methods int getDuration(); - int getThumbnailFadeToGrayStart(); - int getThumbnailFadeToGrayEnd(); - int getDockedIconFadeInStart(); - int getDockedIconFadeInEnd(); + int getPlaceholderFadeInStart(); + int getPlaceholderFadeInEnd(); + int getPlaceholderIconFadeInStart(); + int getPlaceholderIconFadeInEnd(); int getStagedRectSlideStart(); int getStagedRectSlideEnd(); - Interpolator getStagedRectSlideInterpolator(); - default float getThumbnailFadeToGrayStartOffset() { - return (float) getThumbnailFadeToGrayStart() / getDuration(); + Interpolator getStagedRectXInterpolator(); + Interpolator getStagedRectYInterpolator(); + Interpolator getStagedRectScaleXInterpolator(); + Interpolator getStagedRectScaleYInterpolator(); + default float getPlaceholderFadeInStartOffset() { + return (float) getPlaceholderFadeInStart() / getDuration(); } - default float getThumbnailFadeToGrayEndOffset() { - return (float) getThumbnailFadeToGrayEnd() / getDuration(); + default float getPlaceholderFadeInEndOffset() { + return (float) getPlaceholderFadeInEnd() / getDuration(); } - default float getDockedIconFadeInStartOffset() { - return (float) getDockedIconFadeInStart() / getDuration(); + default float getPlaceholderIconFadeInStartOffset() { + return (float) getPlaceholderIconFadeInStart() / getDuration(); } - default float getDockedIconFadeInEndOffset() { - return (float) getDockedIconFadeInEnd() / getDuration(); + default float getPlaceholderIconFadeInEndOffset() { + return (float) getPlaceholderIconFadeInEnd() / getDuration(); } default float getStagedRectSlideStartOffset() { return (float) getStagedRectSlideStart() / getDuration(); @@ -72,6 +76,10 @@ public interface SplitAnimationTimings { default float getInstructionsUnfoldStartOffset() { return 0; } default float getInstructionsUnfoldEndOffset() { return 0; } + // Defaults for NormalToSplit + default float getScrimFadeInStartOffset() { return 0; } + default float getScrimFadeInEndOffset() { return 0; } + // Defaults for SplitToConfirm default float getInstructionsFadeStartOffset() { return 0; } default float getInstructionsFadeEndOffset() { return 0; } diff --git a/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java b/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java index 2eb0941aa2..84cfb0be94 100644 --- a/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java +++ b/quickstep/src/com/android/quickstep/util/SplitToConfirmTimings.java @@ -24,17 +24,20 @@ import android.view.animation.Interpolator; * Timings for the OverviewSplitSelect > confirmed animation. */ public class SplitToConfirmTimings implements SplitAnimationTimings { - public int getThumbnailFadeToGrayStart() { return 0; } - public int getThumbnailFadeToGrayEnd() { return 133; } - public int getDockedIconFadeInStart() { return 167; } - public int getDockedIconFadeInEnd() { return 250; } + public int getPlaceholderFadeInStart() { return 0; } + public int getPlaceholderFadeInEnd() { return 133; } + public int getPlaceholderIconFadeInStart() { return 167; } + public int getPlaceholderIconFadeInEnd() { return 250; } public int getStagedRectSlideStart() { return 0; } public int getStagedRectSlideEnd() { return 383; } public int getInstructionsFadeStart() { return 0; } public int getInstructionsFadeEnd() { return 67; } public int getDuration() { return CONFIRM_DURATION; } - public Interpolator getStagedRectSlideInterpolator() { return LINEAR; } + public Interpolator getStagedRectXInterpolator() { return LINEAR; } + public Interpolator getStagedRectYInterpolator() { return LINEAR; } + public Interpolator getStagedRectScaleXInterpolator() { return LINEAR; } + public Interpolator getStagedRectScaleYInterpolator() { return LINEAR; } public float getInstructionsFadeStartOffset() { return (float) getInstructionsFadeStart() / getDuration(); diff --git a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java index 1d58748b62..bf88702972 100644 --- a/quickstep/src/com/android/quickstep/views/FloatingTaskView.java +++ b/quickstep/src/com/android/quickstep/views/FloatingTaskView.java @@ -1,8 +1,6 @@ package com.android.quickstep.views; import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU; -import static com.android.launcher3.anim.Interpolators.ACCEL; -import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.Interpolators.clampToProgress; @@ -217,8 +215,11 @@ public class FloatingTaskView extends FrameLayout { */ public void addStagingAnimation(PendingAnimation animation, RectF startingBounds, Rect endBounds, boolean fadeWithThumbnail, boolean isStagedTask) { + SplitAnimationTimings timings = fadeWithThumbnail + ? SplitAnimationTimings.OVERVIEW_TO_SPLIT + : SplitAnimationTimings.NORMAL_TO_SPLIT; addAnimation(animation, startingBounds, endBounds, fadeWithThumbnail, isStagedTask, - SplitAnimationTimings.OVERVIEW_TO_SPLIT); + timings); } /** @@ -257,47 +258,40 @@ public class FloatingTaskView extends FrameLayout { // FloatingTaskThumbnailView: thumbnail fades out to transparent animation.setViewAlpha(mThumbnailView, 0, clampToProgress(LINEAR, - timings.getThumbnailFadeToGrayStartOffset(), - timings.getThumbnailFadeToGrayEndOffset())); + timings.getPlaceholderFadeInStartOffset(), + timings.getPlaceholderFadeInEndOffset())); // SplitPlaceholderView: gray background fades in at same time, then new icon fades in - animation.setViewAlpha(mSplitPlaceholderView, 1, clampToProgress(LINEAR, - timings.getThumbnailFadeToGrayStartOffset(), - timings.getThumbnailFadeToGrayEndOffset())); - animation.setViewAlpha(mSplitPlaceholderView.getIconView(), 1, clampToProgress( - LINEAR, - timings.getDockedIconFadeInStartOffset(), - timings.getDockedIconFadeInEndOffset())); + fadeInSplitPlaceholder(animation, timings); } else if (isStagedTask) { // This code block runs for the placeholder view during Normal > OverviewSplitSelect // and for the placeholder (primary) thumbnail during OverviewSplitSelect > Confirmed // Fade in the placeholder view during Normal > OverviewSplitSelect if (mSplitPlaceholderView.getAlpha() == 0) { - animation.setViewAlpha(mSplitPlaceholderView, 0.3f, INSTANT); - animation.setViewAlpha(mSplitPlaceholderView, 1, ACCEL); + mSplitPlaceholderView.getIconView().setAlpha(0); + fadeInSplitPlaceholder(animation, timings); } // No-op for placeholder during OverviewSplitSelect > Confirmed, alpha should be set } - MultiValueUpdateListener listener = new MultiValueUpdateListener() { // SplitPlaceholderView: rectangle translates and stretches to new position final FloatProp mDx = new FloatProp(0, prop.dX, 0, animDuration, - clampToProgress(timings.getStagedRectSlideInterpolator(), + clampToProgress(timings.getStagedRectXInterpolator(), timings.getStagedRectSlideStartOffset(), timings.getStagedRectSlideEndOffset())); final FloatProp mDy = new FloatProp(0, prop.dY, 0, animDuration, - clampToProgress(timings.getStagedRectSlideInterpolator(), + clampToProgress(timings.getStagedRectYInterpolator(), timings.getStagedRectSlideStartOffset(), timings.getStagedRectSlideEndOffset())); final FloatProp mTaskViewScaleX = new FloatProp(1f, prop.finalTaskViewScaleX, 0, - animDuration, clampToProgress(timings.getStagedRectSlideInterpolator(), + animDuration, clampToProgress(timings.getStagedRectScaleXInterpolator(), timings.getStagedRectSlideStartOffset(), timings.getStagedRectSlideEndOffset())); final FloatProp mTaskViewScaleY = new FloatProp(1f, prop.finalTaskViewScaleY, 0, - animDuration, clampToProgress(timings.getStagedRectSlideInterpolator(), + animDuration, clampToProgress(timings.getStagedRectScaleYInterpolator(), timings.getStagedRectSlideStartOffset(), timings.getStagedRectSlideEndOffset())); @Override @@ -315,6 +309,15 @@ public class FloatingTaskView extends FrameLayout { transitionAnimator.addUpdateListener(listener); } + void fadeInSplitPlaceholder(PendingAnimation animation, SplitAnimationTimings timings) { + animation.setViewAlpha(mSplitPlaceholderView, 1, clampToProgress(LINEAR, + timings.getPlaceholderFadeInStartOffset(), + timings.getPlaceholderFadeInEndOffset())); + animation.setViewAlpha(mSplitPlaceholderView.getIconView(), 1, clampToProgress(LINEAR, + timings.getPlaceholderIconFadeInStartOffset(), + timings.getPlaceholderIconFadeInEndOffset())); + } + void drawRoundedRect(Canvas canvas, Paint paint) { if (mFullscreenParams == null) { return; diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 9b1a92a86f..50cc39d151 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -2814,7 +2814,7 @@ public abstract class RecentsView