From 436b9939e3be19b6259f8fd44e93eb00d1154d7d Mon Sep 17 00:00:00 2001 From: Johannes Gallmann Date: Wed, 3 Jan 2024 16:45:16 +0100 Subject: [PATCH] Hide app icon during predictive back to home Bug: 311337169 Flag: ACONFIG com.android.systemui.predictive_back_qs_dialog_anim DEVELOPMENT Test: Manual, i.e. testing predictive back to home on device and verifying visually that app icon behaves correctly Change-Id: I91491d91d004d81f4abc67c361c8824eba8dfdcd --- .../launcher3/QuickstepTransitionManager.java | 2 +- .../LauncherBackAnimationController.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index f25b652d0c..2ebbe6f79e 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1290,7 +1290,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener /** * Returns view on launcher that corresponds to the closing app in the list of app targets */ - private @Nullable View findLauncherView(RemoteAnimationTarget[] appTargets) { + public @Nullable View findLauncherView(RemoteAnimationTarget[] appTargets) { for (RemoteAnimationTarget appTarget : appTargets) { if (appTarget.mode == MODE_CLOSING) { View launcherView = findLauncherView(appTarget); diff --git a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java index 0f88aac4fc..b9029ea9f8 100644 --- a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java +++ b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java @@ -54,12 +54,14 @@ import android.window.IOnBackInvokedCallback; import com.android.internal.view.AppearanceRegion; import com.android.launcher3.AbstractFloatingView; +import com.android.launcher3.BubbleTextView; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.QuickstepTransitionManager; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.taskbar.LauncherTaskbarUIController; import com.android.launcher3.uioverrides.QuickstepLauncher; +import com.android.launcher3.widget.LauncherAppWidgetHostView; import com.android.quickstep.util.RectFSpringAnim; import com.android.systemui.shared.system.QuickStepContract; @@ -108,6 +110,7 @@ public class LauncherBackAnimationController { private final PointF mInitialTouchPos = new PointF(); private RemoteAnimationTarget mBackTarget; + private View mLauncherTargetView; private SurfaceControl.Transaction mTransaction = new SurfaceControl.Transaction(); private boolean mSpringAnimationInProgress = false; private boolean mAnimatorSetInProgress = false; @@ -303,11 +306,22 @@ public class LauncherBackAnimationController { int insetBottom = mStartRect.bottom - appTarget.contentInsets.bottom; mStartRect.set(mStartRect.left, mStartRect.top, mStartRect.right, insetBottom); } + mLauncherTargetView = mQuickstepTransitionManager.findLauncherView( + new RemoteAnimationTarget[]{ mBackTarget }); + setLauncherTargetViewVisible(false); mCurrentRect.set(mStartRect); addScrimLayer(); mTransaction.apply(); } + private void setLauncherTargetViewVisible(boolean isVisible) { + if (mLauncherTargetView instanceof BubbleTextView) { + ((BubbleTextView) mLauncherTargetView).setIconVisible(isVisible); + } else if (mLauncherTargetView instanceof LauncherAppWidgetHostView) { + mLauncherTargetView.setAlpha(isVisible ? 1f : 0f); + } + } + void addScrimLayer() { ViewRootImpl viewRootImpl = mLauncher.getDragLayer().getViewRootImpl(); SurfaceControl parent = viewRootImpl != null @@ -436,6 +450,8 @@ public class LauncherBackAnimationController { mLauncher.getStateManager().moveToRestState(); } + setLauncherTargetViewVisible(true); + // Explicitly close opened floating views (which is typically called from // Launcher#onResumed, but in the predictive back flow launcher is not resumed until // the transition is fully finished.) @@ -470,6 +486,8 @@ public class LauncherBackAnimationController { mInitialTouchPos.set(0, 0); mAnimatorSetInProgress = false; mSpringAnimationInProgress = false; + setLauncherTargetViewVisible(true); + mLauncherTargetView = null; // We don't call customizeStatusBarAppearance here to prevent the status bar update with // the legacy appearance. It should be refreshed after the transition done. mOverridingStatusBarFlags = false;