Merge "Fix TaskbarNavButtonControllerTest failure" into main
diff --git a/quickstep/res/layout/task_desktop.xml b/quickstep/res/layout/task_desktop.xml
index 0472007..5270284 100644
--- a/quickstep/res/layout/task_desktop.xml
+++ b/quickstep/res/layout/task_desktop.xml
@@ -24,10 +24,6 @@
android:focusable="true"
launcher:focusBorderColor="?attr/materialColorOutline"
launcher:hoverBorderColor="?attr/materialColorPrimary">
- <View
- android:id="@+id/background"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
<ViewStub
android:id="@+id/icon"
@@ -38,6 +34,13 @@
<com.android.quickstep.views.DesktopTaskContentView
android:id="@+id/desktop_content"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent">
+
+ <View
+ android:id="@+id/background"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent" />
+
+ </com.android.quickstep.views.DesktopTaskContentView>
</com.android.quickstep.views.DesktopTaskView>
diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java
index 3b7ad3e..de42669 100644
--- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchController.java
@@ -299,10 +299,6 @@
return;
}
mQuickSwitchViewController.closeQuickSwitchView(animate);
- if (mOnClosed != null) {
- mOnClosed.run();
- mOnClosed = null;
- }
}
/**
@@ -394,6 +390,13 @@
});
}
+ void onCloseStarted() {
+ if (mOnClosed != null) {
+ mOnClosed.run();
+ mOnClosed = null;
+ }
+ }
+
void onCloseComplete() {
if (Flags.taskbarOverflow() && mOverlayContext != null) {
mOverlayContext.getDragLayer()
diff --git a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
index 985cc26..e623b21 100644
--- a/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/KeyboardQuickSwitchViewController.java
@@ -198,6 +198,7 @@
// Let currently-running animation finish.
return;
}
+ mControllerCallbacks.onCloseStarted();
if (!animate) {
InteractionJankMonitorWrapper.begin(
mKeyboardQuickSwitchView, Cuj.CUJ_LAUNCHER_KEYBOARD_QUICK_SWITCH_CLOSE);
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
index dce377d..f33666a 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java
@@ -475,7 +475,7 @@
}
mControllers.bubbleControllers.ifPresent(controllers -> {
// Show the bubble bar when on launcher home (hotseat icons visible) or in overview
- boolean onOverview = mLauncherState == LauncherState.OVERVIEW;
+ boolean onOverview = isInLauncher && mLauncherState == LauncherState.OVERVIEW;
boolean hotseatIconsVisible = isInLauncher && mLauncherState.areElementsVisible(
mLauncher, HOTSEAT_ICONS);
BubbleLauncherState state = onOverview
@@ -1009,12 +1009,7 @@
@Override
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
- endGestureStateOverride(!controller.getFinishTargetIsLauncher(),
- controller.getLauncherIsVisibleAtFinish(), false /*canceled*/);
- }
-
- private void endGestureStateOverride(boolean finishedToApp, boolean canceled) {
- endGestureStateOverride(finishedToApp, finishedToApp, canceled);
+ endGestureStateOverride(!controller.getFinishTargetIsLauncher(), false /*canceled*/);
}
/**
@@ -1024,13 +1019,11 @@
*
* @param finishedToApp {@code true} if the recents animation finished to showing an app and
* not workspace or overview
- * @param launcherIsVisible {code true} if launcher is visible at finish
* @param canceled {@code true} if the recents animation was canceled instead of
* finishing
* to completion
*/
- private void endGestureStateOverride(boolean finishedToApp, boolean launcherIsVisible,
- boolean canceled) {
+ private void endGestureStateOverride(boolean finishedToApp, boolean canceled) {
mCallbacks.removeListener(this);
mTaskBarRecentsAnimationListener = null;
((RecentsView) mLauncher.getOverviewPanel()).setTaskLaunchListener(null);
@@ -1039,27 +1032,18 @@
mSkipNextRecentsAnimEnd = false;
return;
}
- updateStateForUserFinishedToApp(finishedToApp, launcherIsVisible);
+ updateStateForUserFinishedToApp(finishedToApp);
}
}
/**
- * @see #updateStateForUserFinishedToApp(boolean, boolean)
- */
- private void updateStateForUserFinishedToApp(boolean finishedToApp) {
- updateStateForUserFinishedToApp(finishedToApp, !finishedToApp);
- }
-
- /**
* Updates the visible state immediately to ensure a seamless handoff.
*
* @param finishedToApp True iff user is in an app.
- * @param launcherIsVisible True iff launcher is still visible (ie. transparent app)
*/
- private void updateStateForUserFinishedToApp(boolean finishedToApp,
- boolean launcherIsVisible) {
+ private void updateStateForUserFinishedToApp(boolean finishedToApp) {
// Update the visible state immediately to ensure a seamless handoff
- boolean launcherVisible = !finishedToApp || launcherIsVisible;
+ boolean launcherVisible = !finishedToApp;
updateStateForFlag(FLAG_TRANSITION_TO_VISIBLE, false);
updateStateForFlag(FLAG_VISIBLE, launcherVisible);
applyState();
@@ -1068,7 +1052,7 @@
if (DEBUG) {
Log.d(TAG, "endGestureStateOverride - FLAG_IN_APP: " + finishedToApp);
}
- controller.updateStateForFlag(FLAG_IN_APP, finishedToApp && !launcherIsVisible);
+ controller.updateStateForFlag(FLAG_IN_APP, finishedToApp);
controller.applyState();
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
index 3c5d71e..756ab0b 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarView.java
@@ -473,8 +473,8 @@
boolean supportsOverflow = Flags.taskbarOverflow();
int overflowSize = 0;
+ int numberOfSupportedRecents = 0;
if (supportsOverflow) {
- int numberOfSupportedRecents = 0;
for (GroupTask task : recentTasks) {
// TODO(b/343289567 and b/316004172): support app pairs and desktop mode.
if (!task.supportsMultipleTasks()) {
@@ -495,7 +495,8 @@
List<Task> overflownTasks = null;
// An extra item needs to be added to overflow button to account for the space taken up by
// the overflow button.
- final int itemsToAddToOverflow = overflowSize > 0 ? overflowSize + 1 : 0;
+ final int itemsToAddToOverflow =
+ (overflowSize > 0) ? Math.min(overflowSize + 1, numberOfSupportedRecents) : 0;
if (overflowSize > 0) {
overflownTasks = new ArrayList<Task>(itemsToAddToOverflow);
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
index e0814d3..987937e 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java
@@ -115,7 +115,6 @@
private BubbleBarItem mSelectedBubble;
private TaskbarSharedState mSharedState;
- private ImeVisibilityChecker mImeVisibilityChecker;
private BubbleBarViewController mBubbleBarViewController;
private BubbleStashController mBubbleStashController;
private Optional<BubbleStashedHandleViewController> mBubbleStashedHandleViewController;
@@ -126,6 +125,8 @@
// Cache last sent top coordinate to avoid sending duplicate updates to shell
private int mLastSentBubbleBarTop;
+ private boolean mIsImeVisible = false;
+
/**
* Similar to {@link BubbleBarUpdate} but rather than {@link BubbleInfo}s it uses
* {@link BubbleBarBubble}s so that it can be used to update the views.
@@ -192,10 +193,8 @@
/** Initializes controllers. */
public void init(BubbleControllers bubbleControllers,
BubbleBarLocationListener bubbleBarLocationListener,
- ImeVisibilityChecker imeVisibilityChecker,
TaskbarSharedState sharedState) {
mSharedState = sharedState;
- mImeVisibilityChecker = imeVisibilityChecker;
mBubbleBarViewController = bubbleControllers.bubbleBarViewController;
mBubbleStashController = bubbleControllers.bubbleStashController;
mBubbleStashedHandleViewController = bubbleControllers.bubbleStashedHandleViewController;
@@ -234,6 +233,10 @@
boolean sysuiLocked = (flags & MASK_SYSUI_LOCKED) != 0;
mBubbleStashController.setSysuiLocked(sysuiLocked);
+ mIsImeVisible = (flags & SYSUI_STATE_IME_SHOWING) != 0;
+ if (mIsImeVisible) {
+ mBubbleBarViewController.onImeVisible();
+ }
}
//
@@ -309,8 +312,7 @@
// enabling gesture nav. also suppress animation if the bubble bar is hidden for sysui e.g.
// the shade is open, or we're locked.
final boolean suppressAnimation =
- update.initialState || mBubbleBarViewController.isHiddenForSysui()
- || mImeVisibilityChecker.isImeVisible();
+ update.initialState || mBubbleBarViewController.isHiddenForSysui() || mIsImeVisible;
if (update.initialState && mSharedState.hasSavedBubbles()) {
// clear restored state
@@ -572,12 +574,6 @@
mBubbleBarViewController.addBubble(bubble, isExpanding, suppressAnimation);
}
- /** Interface for checking whether the IME is visible. */
- public interface ImeVisibilityChecker {
- /** Whether the IME is visible. */
- boolean isImeVisible();
- }
-
/** Listener of {@link BubbleBarLocation} updates. */
public interface BubbleBarLocationListener {
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
index c5c2d69..833be61 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarView.java
@@ -456,7 +456,7 @@
return;
}
mDragging = dragging;
- setElevation(dragging ? mDragElevation : mBubbleElevation);
+ mController.setIsDragging(dragging);
if (!mDragging) {
// Relayout after dragging to ensure that the dragged bubble is positioned correctly
requestLayout();
@@ -1575,5 +1575,8 @@
/** Requests the controller to update bubble bar location to the given value */
void updateBubbleBarLocation(BubbleBarLocation location,
@BubbleBarLocation.UpdateSource int source);
+
+ /** Notifies the controller that bubble bar is being dragged */
+ void setIsDragging(boolean dragging);
}
}
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
index d13e0c4..fd08078 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java
@@ -85,6 +85,7 @@
private final BubbleBarView mBarView;
private int mIconSize;
private int mBubbleBarPadding;
+ private final int mDragElevation;
// Initialized in init.
private BubbleStashController mBubbleStashController;
@@ -152,6 +153,8 @@
mBubbleBarAlpha = new MultiValueAlpha(mBarView, 1 /* num alpha channels */);
mIconSize = activity.getResources().getDimensionPixelSize(
R.dimen.bubblebar_icon_size);
+ mDragElevation = activity.getResources().getDimensionPixelSize(
+ R.dimen.bubblebar_drag_elevation);
mTaskbarTranslationDelta = getBubbleBarTranslationDeltaForTaskbar(activity);
}
@@ -221,6 +224,11 @@
@BubbleBarLocation.UpdateSource int source) {
mBubbleBarController.updateBubbleBarLocation(location, source);
}
+
+ @Override
+ public void setIsDragging(boolean dragging) {
+ mBubbleBarContainer.setElevation(dragging ? mDragElevation : 0);
+ }
});
mBubbleViewController = new BubbleView.Controller() {
@@ -383,6 +391,13 @@
}
}
+ /** Notifies that the IME became visible. */
+ public void onImeVisible() {
+ if (isAnimatingNewBubble()) {
+ mBubbleBarViewAnimator.interruptForIme();
+ }
+ }
+
//
// The below animators are exposed to BubbleStashController so it can manage the stashing
// animation.
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
index d993685..cb592e6 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleControllers.java
@@ -89,7 +89,6 @@
);
bubbleBarController.init(this,
bubbleBarLocationListeners,
- taskbarControllers.navbarButtonsViewController::isImeVisible,
taskbarSharedState);
bubbleStashedHandleViewController.ifPresent(
controller -> controller.init(/* bubbleControllers = */ this));
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
index 5184a9f..89e4210 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimator.kt
@@ -532,6 +532,21 @@
)
}
+ /** Interrupts the animation due to the IME becoming visible. */
+ fun interruptForIme() {
+ cancelFlyout()
+ val hideAnimation = animatingBubble?.hideAnimation ?: return
+ scheduler.cancel(hideAnimation)
+ animatingBubble = null
+ bubbleStashController.getStashedHandlePhysicsAnimator().cancelIfRunning()
+ bubbleBarView.relativePivotY = 1f
+ // stash the bubble bar since the IME is now visible
+ bubbleStashController.onNewBubbleAnimationInterrupted(
+ /* isStashed= */ true,
+ bubbleBarView.translationY,
+ )
+ }
+
fun expandedWhileAnimating() {
val animatingBubble = animatingBubble ?: return
this.animatingBubble = animatingBubble.copy(expand = true)
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt
index e62c0d4..22d504f 100644
--- a/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt
+++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/stashing/TransientBubbleStashController.kt
@@ -90,7 +90,10 @@
val hasBubbles = bubbleBarViewController.hasBubbles()
bubbleBarViewController.onBubbleBarConfigurationChanged(hasBubbles)
if (!hasBubbles) {
- // if there are no bubbles, there's nothing to show, so just return.
+ // if there are no bubbles, there's no need to update the bubble bar, just keep the
+ // isStashed state up to date so that we can process state changes when bubbles are
+ // created.
+ isStashed = launcherState == BubbleLauncherState.IN_APP
return
}
if (field == BubbleLauncherState.HOME) {
@@ -486,10 +489,9 @@
val isStashed = stash && !isBubblesShowingOnHome && !isBubblesShowingOnOverview
if (this.isStashed != isStashed) {
this.isStashed = isStashed
+
// notify the view controller that the stash state is about to change so that it can
// cancel an ongoing animation if there is one.
- // note that this has to be called before updating mIsStashed with the new value,
- // otherwise interrupting an ongoing animation may update it again with the wrong state
bubbleBarViewController.onStashStateChanging()
animator?.cancel()
animator =
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 95e7737..5648dad 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -56,9 +56,11 @@
import static com.android.quickstep.GestureState.STATE_RECENTS_ANIMATION_STARTED;
import static com.android.quickstep.GestureState.STATE_RECENTS_SCROLLING_FINISHED;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
+import static com.android.quickstep.TaskViewUtils.extractTargetsAndStates;
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.EXPECTING_TASK_APPEARED;
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
+import static com.android.wm.shell.shared.ShellSharedConstants.KEY_EXTRA_SHELL_CAN_HAND_OFF_ANIMATION;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -77,6 +79,7 @@
import android.os.IBinder;
import android.os.SystemClock;
import android.util.Log;
+import android.util.Pair;
import android.view.MotionEvent;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
@@ -90,6 +93,7 @@
import android.widget.Toast;
import android.window.DesktopModeFlags;
import android.window.PictureInPictureSurfaceTransaction;
+import android.window.WindowAnimationState;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -143,6 +147,7 @@
import com.android.quickstep.views.RecentsViewContainer;
import com.android.quickstep.views.TaskContainer;
import com.android.quickstep.views.TaskView;
+import com.android.systemui.animation.TransitionAnimator;
import com.android.systemui.contextualeducation.GestureType;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -152,10 +157,13 @@
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.shared.system.TaskStackChangeListener;
import com.android.systemui.shared.system.TaskStackChangeListeners;
+import com.android.wm.shell.Flags;
import com.android.wm.shell.shared.TransactionPool;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import com.android.wm.shell.shared.startingsurface.SplashScreenExitAnimationUtils;
+import kotlin.Unit;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -165,8 +173,6 @@
import java.util.OptionalInt;
import java.util.function.Consumer;
-import kotlin.Unit;
-
/**
* Handles the navigation gestures when Launcher is the default home activity.
*/
@@ -347,6 +353,9 @@
// Indicates whether the divider is shown, only used when split screen is activated.
private boolean mIsDividerShown = true;
private boolean mStartMovingTasks;
+ // Whether the animation to home should be handed off to another handler once the gesture is
+ // committed.
+ protected boolean mHandOffAnimationToHome = false;
@Nullable
private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null;
@@ -945,6 +954,10 @@
mSwipePipToHomeReleaseCheck = new RemoteAnimationTargets.ReleaseCheck();
mSwipePipToHomeReleaseCheck.setCanRelease(true);
mRecentsAnimationTargets.addReleaseCheck(mSwipePipToHomeReleaseCheck);
+ if (TransitionAnimator.Companion.longLivedReturnAnimationsEnabled()) {
+ mHandOffAnimationToHome =
+ targets.extras.getBoolean(KEY_EXTRA_SHELL_CAN_HAND_OFF_ANIMATION, false);
+ }
// Only initialize the device profile, if it has not been initialized before, as in some
// configurations targets.homeContentInsets may not be correct.
@@ -1629,6 +1642,10 @@
}
windowAnim = createWindowAnimationToHome(start, homeAnimFactory);
+ if (mHandOffAnimationToHome) {
+ handOffAnimation(velocityPxPerMs);
+ }
+
windowAnim[0].addAnimatorListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
@@ -1711,6 +1728,19 @@
}
}
+ private void handOffAnimation(PointF velocityPxPerMs) {
+ if (!TransitionAnimator.Companion.longLivedReturnAnimationsEnabled()
+ || mRecentsAnimationController == null) {
+ return;
+ }
+
+ Pair<RemoteAnimationTarget[], WindowAnimationState[]> targetsAndStates =
+ extractTargetsAndStates(mRemoteTargetHandles, velocityPxPerMs);
+ mRecentsAnimationController.handOffAnimation(
+ targetsAndStates.first, targetsAndStates.second);
+ ActiveGestureProtoLogProxy.logHandOffAnimation();
+ }
+
private int calculateWindowRotation(RemoteAnimationTarget runningTaskTarget,
RecentsOrientedState orientationState) {
if (runningTaskTarget.rotationChange != 0) {
@@ -2176,8 +2206,9 @@
mSwipePipToHomeAnimator.getFinishTransaction(),
mSwipePipToHomeAnimator.getContentOverlay());
mIsSwipingPipToHome = false;
- } else if (mIsSwipeForSplit) {
+ } else if (mIsSwipeForSplit && !Flags.enablePip2()) {
// Transaction to hide the task to avoid flicker for entering PiP from split-screen.
+ // Note: PiP2 handles entering differently, so skip if enable_pip2=true
PictureInPictureSurfaceTransaction tx =
new PictureInPictureSurfaceTransaction.Builder()
.setAlpha(0f)
diff --git a/quickstep/src/com/android/quickstep/DesktopFullscreenDrawParams.kt b/quickstep/src/com/android/quickstep/DesktopFullscreenDrawParams.kt
new file mode 100644
index 0000000..bafb0b2
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/DesktopFullscreenDrawParams.kt
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2024 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
+
+import android.content.Context
+import com.android.systemui.shared.system.QuickStepContract
+
+// DesktopTaskView thumbnail's corner radius is independent of fullscreenProgress.
+open class DesktopFullscreenDrawParams
+@JvmOverloads
+constructor(context: Context, cornerRadiusProvider: (Context) -> Float = ::computeCornerRadius) :
+ FullscreenDrawParams(context, cornerRadiusProvider, cornerRadiusProvider) {
+ companion object {
+ // computeCornerRadius is used as cornerRadiusProvider, so
+ // QuickStepContract::getWindowCornerRadius can be mocked properly.
+ private fun computeCornerRadius(context: Context): Float =
+ QuickStepContract.getWindowCornerRadius(context)
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/FullscreenDrawParams.kt b/quickstep/src/com/android/quickstep/FullscreenDrawParams.kt
new file mode 100644
index 0000000..a5ba52a
--- /dev/null
+++ b/quickstep/src/com/android/quickstep/FullscreenDrawParams.kt
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2024 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
+
+import android.content.Context
+import com.android.launcher3.R
+import com.android.launcher3.Utilities
+import com.android.launcher3.util.DisplayController
+import com.android.launcher3.util.SafeCloseable
+import com.android.launcher3.views.ActivityContext
+import com.android.quickstep.util.TaskCornerRadius
+import com.android.systemui.shared.system.QuickStepContract
+
+/**
+ * Class for computing corner radius by interpolating between overview and fullscreen corner radius
+ * with fullscreenProgress set in [setProgress].
+ */
+open class FullscreenDrawParams
+@JvmOverloads
+constructor(
+ context: Context,
+ private val taskCornerRadiusProvider: (Context) -> Float = ::computeTaskCornerRadius,
+ private val windowCornerRadiusProvider: (Context) -> Float = ::computeWindowCornerRadius,
+) : SafeCloseable {
+ private var taskCornerRadius = 0f
+ private var windowCornerRadius = 0f
+ var currentCornerRadius = 0f
+
+ init {
+ updateCornerRadius(context)
+ }
+
+ /** Recomputes the start and end corner radius for the given Context. */
+ fun updateCornerRadius(context: Context) {
+ taskCornerRadius = taskCornerRadiusProvider(context)
+ windowCornerRadius = windowCornerRadiusProvider(context)
+ }
+
+ /** Sets the progress in range [0, 1] */
+ fun setProgress(fullscreenProgress: Float, parentScale: Float, taskViewScale: Float) {
+ currentCornerRadius =
+ Utilities.mapRange(fullscreenProgress, taskCornerRadius, windowCornerRadius) /
+ parentScale /
+ taskViewScale
+ }
+
+ override fun close() {}
+
+ companion object {
+ private fun computeTaskCornerRadius(context: Context): Float = TaskCornerRadius.get(context)
+
+ private fun computeWindowCornerRadius(context: Context): Float {
+ val activityContext: ActivityContext? = ActivityContext.lookupContextNoThrow(context)
+ return if (
+ activityContext?.deviceProfile?.isTaskbarPresent == true &&
+ DisplayController.isTransientTaskbar(context)
+ ) {
+ context.resources
+ .getDimensionPixelSize(R.dimen.persistent_taskbar_corner_radius)
+ .toFloat()
+ } else {
+ // The corner radius is fixed to match when Taskbar is persistent mode
+ QuickStepContract.getWindowCornerRadius(context)
+ }
+ }
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
index 6719ab7..4bd9ffb 100644
--- a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
+++ b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java
@@ -49,8 +49,8 @@
import android.window.BackEvent;
import android.window.BackMotionEvent;
import android.window.BackProgressAnimator;
+import android.window.IBackAnimationHandoffHandler;
import android.window.IOnBackInvokedCallback;
-
import com.android.app.animation.Interpolators;
import com.android.internal.policy.SystemBarUtils;
import com.android.internal.view.AppearanceRegion;
@@ -225,6 +225,12 @@
public void setTriggerBack(boolean triggerBack) {
// TODO(b/261654570): track touch from the Launcher process.
}
+
+ @Override
+ public void setHandoffHandler(IBackAnimationHandoffHandler unused) {
+ // For now, Launcher handles this internally so it doesn't need to hand off the
+ // animation.
+ }
}
private static class RemoteAnimationRunnerStub extends IRemoteAnimationRunner.Stub {
@@ -384,10 +390,11 @@
// Move the window along the Y axis.
float top = (screenHeight - height) * 0.5f + deltaY;
// Move the window along the X axis.
- float left = event.getSwipeEdge() == BackEvent.EDGE_RIGHT
- ? progress * mWindowScaleMarginX
- : screenWidth - progress * mWindowScaleMarginX - width;
-
+ float left = switch (event.getSwipeEdge()) {
+ case BackEvent.EDGE_RIGHT -> progress * mWindowScaleMarginX;
+ case BackEvent.EDGE_LEFT -> screenWidth - progress * mWindowScaleMarginX - width;
+ default -> (screenWidth - width) / 2;
+ };
mCurrentRect.set(left, top, left + width, top + height);
float cornerRadius = Utilities.mapRange(
progress, mWindowScaleStartCornerRadius, mWindowScaleEndCornerRadius);
diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
index dacafd4..6087dc2 100644
--- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
+++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java
@@ -46,7 +46,6 @@
import com.android.launcher3.views.FloatingIconView;
import com.android.launcher3.views.FloatingView;
import com.android.launcher3.widget.LauncherAppWidgetHostView;
-import com.android.quickstep.fallback.window.RecentsWindowManager;
import com.android.quickstep.util.RectFSpringAnim;
import com.android.quickstep.util.ScalingWorkspaceRevealAnim;
import com.android.quickstep.util.StaggeredWorkspaceAnim;
@@ -54,6 +53,7 @@
import com.android.quickstep.views.FloatingWidgetView;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;
+import com.android.systemui.animation.TransitionAnimator;
import com.android.systemui.shared.system.InputConsumerController;
import java.util.Collections;
@@ -108,7 +108,9 @@
mContainer.getRootView().setForceHideBackArrow(true);
- if (!canUseWorkspaceView || appCanEnterPip || mIsSwipeForSplit) {
+ boolean handOffAnimation = TransitionAnimator.Companion.longLivedReturnAnimationsEnabled()
+ && mHandOffAnimationToHome;
+ if (handOffAnimation || !canUseWorkspaceView || appCanEnterPip || mIsSwipeForSplit) {
return new LauncherHomeAnimationFactory() {
@Nullable
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationController.java b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
index 60fcff8..055aadb 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationController.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
@@ -21,9 +21,11 @@
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
+import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
import android.view.WindowManagerGlobal;
import android.window.PictureInPictureSurfaceTransaction;
+import android.window.WindowAnimationState;
import androidx.annotation.UiThread;
@@ -32,6 +34,7 @@
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.RunnableList;
import com.android.quickstep.util.ActiveGestureProtoLogProxy;
+import com.android.systemui.animation.TransitionAnimator;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
import com.android.systemui.shared.system.RecentsAnimationControllerCompat;
@@ -53,8 +56,6 @@
private boolean mFinishRequested = false;
// Only valid when mFinishRequested == true.
private boolean mFinishTargetIsLauncher;
- // Only valid when mFinishRequested == true
- private boolean mLauncherIsVisibleAtFinish;
private RunnableList mPendingFinishCallbacks = new RunnableList();
public RecentsAnimationController(RecentsAnimationControllerCompat controller,
@@ -90,6 +91,16 @@
}
@UiThread
+ public void handOffAnimation(RemoteAnimationTarget[] targets, WindowAnimationState[] states) {
+ if (TransitionAnimator.Companion.longLivedReturnAnimationsEnabled()) {
+ UI_HELPER_EXECUTOR.execute(() -> mController.handOffAnimation(targets, states));
+ } else {
+ Log.e(TAG, "Tried to hand off the animation, but the feature is disabled",
+ new Exception());
+ }
+ }
+
+ @UiThread
public void finishAnimationToHome() {
finishController(true /* toRecents */, null, false /* sendUserLeaveHint */);
}
@@ -119,27 +130,13 @@
}
@UiThread
- public void finish(boolean toRecents, boolean launcherIsVisibleAtFinish,
- Runnable onFinishComplete, boolean sendUserLeaveHint) {
- Preconditions.assertUIThread();
- finishController(toRecents, launcherIsVisibleAtFinish, onFinishComplete, sendUserLeaveHint,
- false);
- }
-
- @UiThread
public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint) {
- finishController(toRecents, false, callback, sendUserLeaveHint, false /* forceFinish */);
+ finishController(toRecents, callback, sendUserLeaveHint, false /* forceFinish */);
}
@UiThread
public void finishController(boolean toRecents, Runnable callback, boolean sendUserLeaveHint,
boolean forceFinish) {
- finishController(toRecents, toRecents, callback, sendUserLeaveHint, forceFinish);
- }
-
- @UiThread
- public void finishController(boolean toRecents, boolean launcherIsVisibleAtFinish,
- Runnable callback, boolean sendUserLeaveHint, boolean forceFinish) {
mPendingFinishCallbacks.add(callback);
if (!forceFinish && mFinishRequested) {
// If finish has already been requested, then add the callback to the pending list.
@@ -151,7 +148,6 @@
// Finish not yet requested
mFinishRequested = true;
mFinishTargetIsLauncher = toRecents;
- mLauncherIsVisibleAtFinish = launcherIsVisibleAtFinish;
mOnFinishedListener.accept(this);
Runnable finishCb = () -> {
mController.finish(toRecents, sendUserLeaveHint, new IResultReceiver.Stub() {
@@ -228,14 +224,6 @@
return mFinishTargetIsLauncher;
}
- /**
- * RecentsAnimationListeners can check this in onRecentsAnimationFinished() to determine whether
- * the animation was finished to launcher vs an app.
- */
- public boolean getLauncherIsVisibleAtFinish() {
- return mLauncherIsVisibleAtFinish;
- }
-
public void dump(String prefix, PrintWriter pw) {
pw.println(prefix + "RecentsAnimationController:");
diff --git a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java
index 06b2972..91d0776 100644
--- a/quickstep/src/com/android/quickstep/RemoteTargetGluer.java
+++ b/quickstep/src/com/android/quickstep/RemoteTargetGluer.java
@@ -93,8 +93,7 @@
BaseContainerInterface sizingStrategy, int numHandles, boolean forDesktop) {
RemoteTargetHandle[] handles = new RemoteTargetHandle[numHandles];
for (int i = 0; i < numHandles; i++) {
- TaskViewSimulator tvs = new TaskViewSimulator(context, sizingStrategy);
- tvs.setIsDesktopTask(forDesktop , i);
+ TaskViewSimulator tvs = new TaskViewSimulator(context, sizingStrategy, forDesktop , i);
TransformParams transformParams = new TransformParams();
handles[i] = new RemoteTargetHandle(tvs, transformParams);
}
diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
index 0dbdcb7..fef4c30 100644
--- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java
@@ -348,7 +348,7 @@
}
/** Called when the snapshot has updated its full screen drawing parameters. */
- public void setFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams) {}
+ public void setFullscreenParams(FullscreenDrawParams fullscreenParams) {}
/** Sets visibility for the overlay associated elements. */
public void setVisibility(int visibility) {}
diff --git a/quickstep/src/com/android/quickstep/TaskViewUtils.java b/quickstep/src/com/android/quickstep/TaskViewUtils.java
index 07ee479..783c87c 100644
--- a/quickstep/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/src/com/android/quickstep/TaskViewUtils.java
@@ -47,12 +47,15 @@
import android.content.Context;
import android.graphics.Matrix;
import android.graphics.Matrix.ScaleToFit;
+import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
+import android.util.Pair;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
import android.view.View;
import android.window.TransitionInfo;
+import android.window.WindowAnimationState;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -784,4 +787,43 @@
animatorHandler.accept(dockFadeAnimator);
return dockFadeAnimator;
}
+
+ /**
+ * Creates an array of {@link RemoteAnimationTarget}s and a matching array of
+ * {@link WindowAnimationState}s from the provided handles.
+ * Important: the ordering of the two arrays is the same, so the state at each index of the
+ * second applies to the target in the same index of the first.
+ *
+ * @param handles The handles wrapping each target.
+ * @param velocityPxPerMs The current velocity of the target animations.
+ */
+ @NonNull
+ public static Pair<RemoteAnimationTarget[], WindowAnimationState[]> extractTargetsAndStates(
+ @NonNull RemoteTargetHandle[] handles, @NonNull PointF velocityPxPerMs) {
+ RemoteAnimationTarget[] targets = new RemoteAnimationTarget[handles.length];
+ WindowAnimationState[] animationStates = new WindowAnimationState[handles.length];
+ long timestamp = System.currentTimeMillis();
+
+ for (int i = 0; i < handles.length; i++) {
+ targets[i] = handles[i].getTransformParams().getTargetSet().apps[i];
+
+ TaskViewSimulator taskViewSimulator = handles[i].getTaskViewSimulator();
+ RectF startRect = taskViewSimulator.getCurrentRect();
+ float cornerRadius = taskViewSimulator.getCurrentCornerRadius();
+
+ WindowAnimationState state = new WindowAnimationState();
+ state.timestamp = timestamp;
+ state.bounds = new RectF(
+ startRect.left, startRect.top, startRect.right, startRect.bottom);
+ state.topLeftRadius = cornerRadius;
+ state.topRightRadius = cornerRadius;
+ state.bottomRightRadius = cornerRadius;
+ state.bottomLeftRadius = cornerRadius;
+ state.velocityPxPerMs = velocityPxPerMs;
+
+ animationStates[i] = state;
+ }
+
+ return new Pair<>(targets, animationStates);
+ }
}
diff --git a/quickstep/src/com/android/quickstep/recents/di/RecentsDependencies.kt b/quickstep/src/com/android/quickstep/recents/di/RecentsDependencies.kt
index dd11d48..b78e214 100644
--- a/quickstep/src/com/android/quickstep/recents/di/RecentsDependencies.kt
+++ b/quickstep/src/com/android/quickstep/recents/di/RecentsDependencies.kt
@@ -36,9 +36,6 @@
import com.android.quickstep.task.viewmodel.TaskOverlayViewModel
import com.android.quickstep.task.viewmodel.TaskThumbnailViewModel
import com.android.quickstep.task.viewmodel.TaskThumbnailViewModelImpl
-import com.android.quickstep.task.viewmodel.TaskViewData
-import com.android.quickstep.task.viewmodel.TaskViewModel
-import com.android.quickstep.views.TaskViewType
import com.android.systemui.shared.recents.model.Task
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
@@ -186,17 +183,11 @@
}
}
RecentsViewData::class.java -> RecentsViewData()
- TaskViewModel::class.java -> TaskViewModel(taskViewData = inject(scopeId, extras))
- TaskViewData::class.java -> {
- val taskViewType = extras["TaskViewType"] as TaskViewType
- TaskViewData(taskViewType)
- }
TaskContainerData::class.java -> TaskContainerData()
TaskThumbnailViewData::class.java -> TaskThumbnailViewData()
TaskThumbnailViewModel::class.java ->
TaskThumbnailViewModelImpl(
recentsViewData = inject(),
- taskViewData = inject(scopeId, extras),
taskContainerData = inject(scopeId),
dispatcherProvider = inject(),
getThumbnailPositionUseCase = inject(),
diff --git a/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewData.kt b/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewData.kt
index 87446b0..6ccf372 100644
--- a/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewData.kt
+++ b/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewData.kt
@@ -22,9 +22,6 @@
class RecentsViewData {
val fullscreenProgress = MutableStateFlow(1f)
- // This is typically a View concern but it is used to invalidate rendering in other Views
- val scale = MutableStateFlow(1f)
-
// Whether the current RecentsView state supports task overlays.
// TODO(b/331753115): Derive from RecentsView state flow once migrated to MVVM.
val overlayEnabled = MutableStateFlow(false)
diff --git a/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewModel.kt b/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewModel.kt
index c511005..cfebb81 100644
--- a/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewModel.kt
+++ b/quickstep/src/com/android/quickstep/recents/viewmodel/RecentsViewModel.kt
@@ -34,10 +34,6 @@
recentsTasksRepository.setVisibleTasks(visibleTaskIdList.toSet())
}
- fun updateScale(scale: Float) {
- recentsViewData.scale.value = scale
- }
-
fun updateFullscreenProgress(fullscreenProgress: Float) {
recentsViewData.fullscreenProgress.value = fullscreenProgress
}
diff --git a/quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailView.kt b/quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailView.kt
index a8c8659..0c783d3 100644
--- a/quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailView.kt
+++ b/quickstep/src/com/android/quickstep/task/thumbnail/TaskThumbnailView.kt
@@ -17,7 +17,6 @@
package com.android.quickstep.task.thumbnail
import android.content.Context
-import android.content.res.Configuration
import android.graphics.Color
import android.graphics.Outline
import android.graphics.Rect
@@ -29,7 +28,6 @@
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isInvisible
import com.android.launcher3.R
-import com.android.launcher3.Utilities
import com.android.launcher3.util.ViewPool
import com.android.quickstep.recents.di.RecentsDependencies
import com.android.quickstep.recents.di.get
@@ -39,9 +37,7 @@
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.SnapshotSplash
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.Uninitialized
import com.android.quickstep.task.viewmodel.TaskThumbnailViewModel
-import com.android.quickstep.util.TaskCornerRadius
import com.android.quickstep.views.FixedSizeImageView
-import com.android.systemui.shared.system.QuickStepContract
import kotlinx.coroutines.CoroutineName
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -63,18 +59,15 @@
private val splashIcon: FixedSizeImageView by lazy { findViewById(R.id.splash_icon) }
private var uiState: TaskThumbnailUiState = Uninitialized
- private var inheritedScale: Float = 1f
- private val _measuredBounds = Rect()
- private val measuredBounds: Rect
- get() {
- _measuredBounds.set(0, 0, measuredWidth, measuredHeight)
- return _measuredBounds
+ private val bounds = Rect()
+
+ var cornerRadius: Float = 0f
+ set(value) {
+ field = value
+ invalidateOutline()
}
- private var overviewCornerRadius: Float = TaskCornerRadius.get(context)
- private var fullscreenCornerRadius: Float = QuickStepContract.getWindowCornerRadius(context)
-
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)
@@ -114,19 +107,12 @@
splashIcon.alpha = splashAlpha
}
.launchIn(viewAttachedScope)
- viewModel.cornerRadiusProgress.onEach { invalidateOutline() }.launchIn(viewAttachedScope)
- viewModel.inheritedScale
- .onEach { viewModelInheritedScale ->
- inheritedScale = viewModelInheritedScale
- invalidateOutline()
- }
- .launchIn(viewAttachedScope)
clipToOutline = true
outlineProvider =
object : ViewOutlineProvider() {
override fun getOutline(view: View, outline: Outline) {
- outline.setRoundRect(measuredBounds, getCurrentCornerRadius())
+ outline.setRoundRect(bounds, cornerRadius)
}
}
}
@@ -157,6 +143,8 @@
if (uiState is SnapshotSplash) {
setImageMatrix()
}
+ bounds.set(0, 0, w, h)
+ invalidateOutline()
}
override fun setScaleX(scaleX: Float) {
@@ -171,14 +159,6 @@
splashIcon.scaleY = 1 / scaleY
}
- override fun onConfigurationChanged(newConfig: Configuration?) {
- super.onConfigurationChanged(newConfig)
-
- overviewCornerRadius = TaskCornerRadius.get(context)
- fullscreenCornerRadius = QuickStepContract.getWindowCornerRadius(context)
- invalidateOutline()
- }
-
private fun resetViews() {
liveTileView.isInvisible = true
thumbnailView.isInvisible = true
@@ -214,13 +194,6 @@
thumbnailView.imageMatrix = viewModel.getThumbnailPositionState(width, height, isLayoutRtl)
}
- private fun getCurrentCornerRadius() =
- Utilities.mapRange(
- viewModel.cornerRadiusProgress.value,
- overviewCornerRadius,
- fullscreenCornerRadius,
- ) / inheritedScale
-
private companion object {
const val TAG = "TaskThumbnailView"
}
diff --git a/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModel.kt b/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModel.kt
index f55462a..a048a1d 100644
--- a/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModel.kt
+++ b/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModel.kt
@@ -19,19 +19,9 @@
import android.graphics.Matrix
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState
import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.StateFlow
/** ViewModel for representing TaskThumbnails */
interface TaskThumbnailViewModel {
- /**
- * Progress for changes in corner radius. progress: 0 = overview corner radius; 1 = fullscreen
- * corner radius.
- */
- val cornerRadiusProgress: StateFlow<Float>
-
- /** The accumulated View.scale value for parent Views up to and including RecentsView */
- val inheritedScale: Flow<Float>
-
/** Provides the level of dimming that the View should have */
val dimProgress: Flow<Float>
diff --git a/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModelImpl.kt b/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModelImpl.kt
index 8b15a82..b6cb984 100644
--- a/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModelImpl.kt
+++ b/quickstep/src/com/android/quickstep/task/viewmodel/TaskThumbnailViewModelImpl.kt
@@ -38,7 +38,6 @@
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
@@ -50,7 +49,6 @@
@OptIn(ExperimentalCoroutinesApi::class)
class TaskThumbnailViewModelImpl(
recentsViewData: RecentsViewData,
- taskViewData: TaskViewData,
taskContainerData: TaskContainerData,
dispatcherProvider: DispatcherProvider,
private val tasksRepository: RecentTasksRepository,
@@ -61,15 +59,6 @@
private val splashProgress = MutableStateFlow(flowOf(0f))
private var taskId: Int = INVALID_TASK_ID
- override val cornerRadiusProgress =
- if (taskViewData.isOutlineFormedByThumbnailView) recentsViewData.fullscreenProgress
- else MutableStateFlow(1f).asStateFlow()
-
- override val inheritedScale =
- combine(recentsViewData.scale, taskViewData.scale) { recentsScale, taskScale ->
- recentsScale * taskScale
- }
-
override val dimProgress: Flow<Float> =
combine(taskContainerData.taskMenuOpenProgress, recentsViewData.tintAmount) {
taskMenuOpenProgress,
diff --git a/quickstep/src/com/android/quickstep/task/viewmodel/TaskViewData.kt b/quickstep/src/com/android/quickstep/task/viewmodel/TaskViewData.kt
deleted file mode 100644
index 7a9ecf2..0000000
--- a/quickstep/src/com/android/quickstep/task/viewmodel/TaskViewData.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2024 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.task.viewmodel
-
-import com.android.quickstep.views.TaskViewType
-import kotlinx.coroutines.flow.MutableStateFlow
-
-class TaskViewData(taskViewType: TaskViewType) {
- // This is typically a View concern but it is used to invalidate rendering in other Views
- val scale = MutableStateFlow(1f)
-
- // TODO(b/331753115): This property should not be in TaskViewData once TaskView is MVVM.
- /** Whether outline of TaskView is formed by outline thumbnail view(s). */
- val isOutlineFormedByThumbnailView: Boolean = taskViewType != TaskViewType.DESKTOP
-}
diff --git a/quickstep/src/com/android/quickstep/task/viewmodel/TaskViewModel.kt b/quickstep/src/com/android/quickstep/task/viewmodel/TaskViewModel.kt
deleted file mode 100644
index ec75d59..0000000
--- a/quickstep/src/com/android/quickstep/task/viewmodel/TaskViewModel.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2024 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.task.viewmodel
-
-import androidx.lifecycle.ViewModel
-
-class TaskViewModel(private val taskViewData: TaskViewData) : ViewModel() {
- fun updateScale(scale: Float) {
- taskViewData.scale.value = scale
- }
-}
diff --git a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
index a4b8fec..706cfe4 100644
--- a/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -50,9 +50,10 @@
import com.android.launcher3.util.TraceHelper;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.BaseContainerInterface;
+import com.android.quickstep.DesktopFullscreenDrawParams;
+import com.android.quickstep.FullscreenDrawParams;
import com.android.quickstep.TaskAnimationManager;
import com.android.quickstep.util.SurfaceTransaction.SurfaceProperties;
-import com.android.quickstep.views.TaskView.FullscreenDrawParams;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.recents.utilities.PreviewPositionHelper;
@@ -116,20 +117,25 @@
private SplitBounds mSplitBounds;
private Boolean mDrawsBelowRecents = null;
private boolean mIsGridTask;
- private boolean mIsDesktopTask;
+ private final boolean mIsDesktopTask;
private boolean mScaleToCarouselTaskSize = false;
private int mTaskRectTranslationX;
private int mTaskRectTranslationY;
private int mDesktopTaskIndex = 0;
- public TaskViewSimulator(Context context, BaseContainerInterface sizeStrategy) {
+ public TaskViewSimulator(Context context, BaseContainerInterface sizeStrategy,
+ boolean isDesktop, int desktopTaskIndex) {
mContext = context;
mSizeStrategy = sizeStrategy;
+ mIsDesktopTask = isDesktop;
+ mDesktopTaskIndex = desktopTaskIndex;
mOrientationState = TraceHelper.allowIpcs("TaskViewSimulator.init",
() -> new RecentsOrientedState(context, sizeStrategy, i -> { }));
mOrientationState.setGestureActive(true);
- mCurrentFullscreenParams = new FullscreenDrawParams(context);
+ mCurrentFullscreenParams = mIsDesktopTask
+ ? new DesktopFullscreenDrawParams(context)
+ : new FullscreenDrawParams(context);
mOrientationStateId = mOrientationState.getStateId();
Resources resources = context.getResources();
mIsRecentsRtl = mOrientationState.getOrientationHandler().getRecentsRtlSetting(resources);
@@ -289,14 +295,6 @@
}
/**
- * Sets whether this task is part of desktop tasks in overview.
- */
- public void setIsDesktopTask(boolean desktop, int index) {
- mIsDesktopTask = desktop;
- mDesktopTaskIndex = index;
- }
-
- /**
* Apply translations on TaskRect's starting location.
*/
public void setTaskRectTranslation(int taskRectTranslationX, int taskRectTranslationY) {
@@ -558,7 +556,7 @@
* TaskView
*/
public float getCurrentCornerRadius() {
- float visibleRadius = mCurrentFullscreenParams.getCurrentDrawnCornerRadius();
+ float visibleRadius = mCurrentFullscreenParams.getCurrentCornerRadius();
mTempPoint[0] = visibleRadius;
mTempPoint[1] = 0;
mInversePositionMatrix.mapVectors(mTempPoint);
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskContentView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskContentView.kt
index 481acac..ef044f4 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskContentView.kt
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskContentView.kt
@@ -23,14 +23,15 @@
import android.view.View
import android.view.ViewOutlineProvider
import android.widget.FrameLayout
-import com.android.quickstep.views.TaskView.FullscreenDrawParams
class DesktopTaskContentView
@JvmOverloads
constructor(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) {
- private val currentFullscreenParams = FullscreenDrawParams(context)
- private val taskCornerRadius: Float
- get() = currentFullscreenParams.cornerRadius
+ var cornerRadius: Float = 0f
+ set(value) {
+ field = value
+ invalidateOutline()
+ }
private val bounds = Rect()
@@ -39,7 +40,7 @@
outlineProvider =
object : ViewOutlineProvider() {
override fun getOutline(view: View, outline: Outline) {
- outline.setRoundRect(bounds, taskCornerRadius)
+ outline.setRoundRect(bounds, cornerRadius)
}
}
}
diff --git a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
index 5e842aa..576a56e 100644
--- a/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/DesktopTaskView.kt
@@ -20,13 +20,10 @@
import android.graphics.Point
import android.graphics.PointF
import android.graphics.Rect
-import android.graphics.drawable.ShapeDrawable
-import android.graphics.drawable.shapes.RoundRectShape
import android.util.AttributeSet
import android.util.Log
import android.view.Gravity
import android.view.View
-import android.widget.FrameLayout
import androidx.core.content.res.ResourcesCompat
import androidx.core.view.updateLayoutParams
import com.android.launcher3.Flags.enableRefactorTaskThumbnail
@@ -39,6 +36,8 @@
import com.android.launcher3.util.ViewPool
import com.android.launcher3.util.rects.set
import com.android.quickstep.BaseContainerInterface
+import com.android.quickstep.DesktopFullscreenDrawParams
+import com.android.quickstep.FullscreenDrawParams
import com.android.quickstep.TaskOverlayFactory
import com.android.quickstep.ViewUtils
import com.android.quickstep.task.thumbnail.TaskThumbnailView
@@ -47,14 +46,13 @@
/** TaskView that contains all tasks that are part of the desktop. */
class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
- TaskView(context, attrs, type = TaskViewType.DESKTOP) {
-
- private val snapshotDrawParams =
- object : FullscreenDrawParams(context) {
- // DesktopTaskView thumbnail's corner radius is independent of fullscreenProgress.
- override fun computeTaskCornerRadius(context: Context) =
- computeWindowCornerRadius(context)
- }
+ TaskView(
+ context,
+ attrs,
+ type = TaskViewType.DESKTOP,
+ thumbnailFullscreenParams = DesktopFullscreenDrawParams(context),
+ ) {
+ private val contentViewFullscreenParams = FullscreenDrawParams(context)
private val taskThumbnailViewDeprecatedPool =
if (!enableRefactorTaskThumbnail()) {
@@ -80,28 +78,12 @@
private val tempPointF = PointF()
private val tempRect = Rect()
- private lateinit var backgroundView: View
private lateinit var iconView: TaskViewIcon
- private lateinit var contentView: FrameLayout
+ private lateinit var contentView: DesktopTaskContentView
+ private lateinit var backgroundView: View
override fun onFinishInflate() {
super.onFinishInflate()
- backgroundView =
- findViewById<View>(R.id.background).apply {
- updateLayoutParams<LayoutParams> {
- topMargin = container.deviceProfile.overviewTaskThumbnailTopMarginPx
- }
- background =
- ShapeDrawable(RoundRectShape(FloatArray(8) { taskCornerRadius }, null, null))
- .apply {
- setTint(
- resources.getColor(
- android.R.color.system_neutral2_300,
- context.theme,
- )
- )
- }
- }
iconView =
getOrInflateIconView(R.id.icon).apply {
setIcon(
@@ -115,10 +97,15 @@
setText(resources.getText(R.string.recent_task_desktop))
}
contentView =
- findViewById<FrameLayout>(R.id.desktop_content).apply {
+ findViewById<DesktopTaskContentView>(R.id.desktop_content).apply {
updateLayoutParams<LayoutParams> {
topMargin = container.deviceProfile.overviewTaskThumbnailTopMarginPx
}
+ cornerRadius = contentViewFullscreenParams.currentCornerRadius
+ backgroundView = findViewById(R.id.background)
+ backgroundView.setBackgroundColor(
+ resources.getColor(android.R.color.system_neutral2_300, context.theme)
+ )
}
}
@@ -135,6 +122,7 @@
Log.d(TAG, sb.toString())
}
cancelPendingLoadTasks()
+ val backgroundViewIndex = contentView.indexOfChild(backgroundView)
taskContainers =
tasks.map { task ->
val snapshotView =
@@ -143,7 +131,7 @@
} else {
taskThumbnailViewDeprecatedPool!!.view
}
- contentView.addView(snapshotView, 0)
+ contentView.addView(snapshotView, backgroundViewIndex + 1)
TaskContainer(
this,
@@ -157,8 +145,7 @@
taskOverlayFactory,
)
}
- taskContainers.forEach { it.bind() }
- setOrientationState(orientedState)
+ onBind(orientedState)
}
override fun onRecycle() {
@@ -242,8 +229,12 @@
}
}
- override fun needsUpdate(dataChange: Int, flag: Int) =
- if (flag == FLAG_UPDATE_CORNER_RADIUS) false else super.needsUpdate(dataChange, flag)
+ override fun onTaskListVisibilityChanged(visible: Boolean, changes: Int) {
+ super.onTaskListVisibilityChanged(visible, changes)
+ if (needsUpdate(changes, FLAG_UPDATE_CORNER_RADIUS)) {
+ contentViewFullscreenParams.updateCornerRadius(context)
+ }
+ }
override fun onIconLoaded(taskContainer: TaskContainer) {
// Update contentDescription of snapshotView only, individual task icon is unused.
@@ -258,9 +249,9 @@
override fun getThumbnailBounds(bounds: Rect, relativeToDragLayer: Boolean) {
if (relativeToDragLayer) {
- container.dragLayer.getDescendantRectRelativeToSelf(backgroundView, bounds)
+ container.dragLayer.getDescendantRectRelativeToSelf(contentView, bounds)
} else {
- bounds.set(backgroundView)
+ bounds.set(contentView)
}
}
@@ -306,13 +297,12 @@
backgroundView.alpha = 1 - fullscreenProgress
}
- override fun updateCurrentFullscreenParams() {
- super.updateCurrentFullscreenParams()
- updateFullscreenParams(snapshotDrawParams)
+ override fun updateFullscreenParams() {
+ super.updateFullscreenParams()
+ updateFullscreenParams(contentViewFullscreenParams)
+ contentView.cornerRadius = contentViewFullscreenParams.currentCornerRadius
}
- override fun getThumbnailFullscreenParams() = snapshotDrawParams
-
override fun addChildrenForAccessibility(outChildren: ArrayList<View>) {
super.addChildrenForAccessibility(outChildren)
ViewUtils.addAccessibleChildToList(backgroundView, outChildren)
diff --git a/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt b/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
index 92c1e93..0d9583d 100644
--- a/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/GroupedTaskView.kt
@@ -104,7 +104,7 @@
R.id.show_windows,
R.id.digital_wellbeing_toast,
STAGE_POSITION_TOP_OR_LEFT,
- taskOverlayFactory
+ taskOverlayFactory,
),
createTaskContainer(
secondaryTask,
@@ -113,14 +113,12 @@
R.id.show_windows_right,
R.id.bottomRight_digital_wellbeing_toast,
STAGE_POSITION_BOTTOM_OR_RIGHT,
- taskOverlayFactory
- )
+ taskOverlayFactory,
+ ),
)
- taskContainers.forEach { it.bind() }
-
this.splitBoundsConfig = splitBoundsConfig
taskContainers.forEach { it.digitalWellBeingToast?.splitBounds = splitBoundsConfig }
- setOrientationState(orientedState)
+ onBind(orientedState)
}
override fun setOrientationState(orientationState: RecentsOrientedState) {
@@ -131,7 +129,7 @@
container.deviceProfile,
it,
layoutParams.width,
- layoutParams.height
+ layoutParams.height,
)
val iconViewMarginStart =
resources.getDimensionPixelSize(
@@ -168,7 +166,7 @@
container.deviceProfile,
splitBoundsConfig,
layoutParams.width,
- layoutParams.height
+ layoutParams.height,
)
pagedOrientationHandler.setSplitIconParams(
taskContainers[0].iconView.asView(),
@@ -181,7 +179,7 @@
isRtl,
container.deviceProfile,
splitBoundsConfig,
- inSplitSelection
+ inSplitSelection,
)
} else {
pagedOrientationHandler.setSplitIconParams(
@@ -195,7 +193,7 @@
isRtl,
container.deviceProfile,
splitBoundsConfig,
- inSplitSelection
+ inSplitSelection,
)
}
}
@@ -216,7 +214,7 @@
InteractionJankMonitorWrapper.begin(
this,
Cuj.CUJ_SPLIT_SCREEN_ENTER,
- "Enter form GroupedTaskView"
+ "Enter form GroupedTaskView",
)
launchTaskInternal(isQuickSwitch = false, launchingExistingTaskView = true) {
endCallback.executeAllAndDestroy()
@@ -230,7 +228,7 @@
override fun launchWithoutAnimation(
isQuickSwitch: Boolean,
- callback: (launched: Boolean) -> Unit
+ callback: (launched: Boolean) -> Unit,
) {
launchTaskInternal(isQuickSwitch, launchingExistingTaskView = false, callback)
}
@@ -244,7 +242,7 @@
private fun launchTaskInternal(
isQuickSwitch: Boolean,
launchingExistingTaskView: Boolean,
- callback: (launched: Boolean) -> Unit
+ callback: (launched: Boolean) -> Unit,
) {
recentsView?.let {
it.splitSelectController.launchExistingSplitPair(
@@ -254,11 +252,11 @@
STAGE_POSITION_TOP_OR_LEFT,
callback,
isQuickSwitch,
- snapPosition
+ snapPosition,
)
Log.d(
TAG,
- "launchTaskInternal - launchExistingSplitPair: ${taskIds.contentToString()}, launchingExistingTaskView: $launchingExistingTaskView"
+ "launchTaskInternal - launchExistingSplitPair: ${taskIds.contentToString()}, launchingExistingTaskView: $launchingExistingTaskView",
)
}
}
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 6ab3e28..cfadc35 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -417,9 +417,6 @@
public void setValue(RecentsView view, float scale) {
view.setScaleX(scale);
view.setScaleY(scale);
- if (enableRefactorTaskThumbnail()) {
- view.mRecentsViewModel.updateScale(scale);
- }
view.mLastComputedTaskStartPushOutDistance = null;
view.mLastComputedTaskEndPushOutDistance = null;
view.runActionOnRemoteHandles(new Consumer<RemoteTargetHandle>() {
@@ -5034,7 +5031,7 @@
private void updateTaskViewsSnapshotRadius() {
for (TaskView taskView : getTaskViews()) {
- taskView.updateSnapshotRadius();
+ taskView.updateFullscreenParams();
}
}
@@ -5167,7 +5164,7 @@
if (!enableRefactorTaskThumbnail()) {
taskContainer.getThumbnailViewDeprecated().refreshSplashView();
}
- mSplitHiddenTaskView.updateSnapshotRadius();
+ mSplitHiddenTaskView.updateFullscreenParams();
});
} else if (isInitiatingSplitFromTaskView) {
if (Flags.enableHoverOfChildElementsInTaskview()) {
@@ -5879,22 +5876,15 @@
* Finish recents animation.
*/
public void finishRecentsAnimation(boolean toRecents, @Nullable Runnable onFinishComplete) {
- finishRecentsAnimation(toRecents, false, true /* shouldPip */, onFinishComplete);
+ finishRecentsAnimation(toRecents, true /* shouldPip */, onFinishComplete);
}
/**
- * Finish recents animation.
- */
- public void finishRecentsAnimation(boolean toRecents, boolean shouldPip,
- @Nullable Runnable onFinishComplete) {
- finishRecentsAnimation(toRecents, shouldPip, false, onFinishComplete);
- }
- /**
* NOTE: Whatever value gets passed through to the toRecents param may need to also be set on
* {@link #mRecentsAnimationController#setWillFinishToHome}.
*/
public void finishRecentsAnimation(boolean toRecents, boolean shouldPip,
- boolean allAppTargetsAreTranslucent, @Nullable Runnable onFinishComplete) {
+ @Nullable Runnable onFinishComplete) {
Log.d(TAG, "finishRecentsAnimation - mRecentsAnimationController: "
+ mRecentsAnimationController);
// TODO(b/197232424#comment#10) Move this back into onRecentsAnimationComplete(). Maybe?
@@ -5926,7 +5916,7 @@
tx, null /* overlay */);
}
}
- mRecentsAnimationController.finish(toRecents, allAppTargetsAreTranslucent, () -> {
+ mRecentsAnimationController.finish(toRecents, () -> {
if (onFinishComplete != null) {
onFinishComplete.run();
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java
index 5dbc2ef..9f2bb9a 100644
--- a/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java
+++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailViewDeprecated.java
@@ -50,9 +50,9 @@
import com.android.launcher3.util.SystemUiController;
import com.android.launcher3.util.SystemUiController.SystemUiControllerFlags;
import com.android.launcher3.util.ViewPool;
+import com.android.quickstep.FullscreenDrawParams;
import com.android.quickstep.TaskOverlayFactory.TaskOverlay;
import com.android.quickstep.orientation.RecentsPagedOrientationHandler;
-import com.android.quickstep.views.TaskView.FullscreenDrawParams;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.recents.utilities.PreviewPositionHelper;
@@ -107,7 +107,7 @@
// Contains the portion of the thumbnail that is clipped when fullscreen progress = 0.
private final Rect mPreviewRect = new Rect();
private final PreviewPositionHelper mPreviewPositionHelper = new PreviewPositionHelper();
- private TaskView.FullscreenDrawParams mFullscreenParams;
+ private FullscreenDrawParams mFullscreenParams;
private ImageView mSplashView;
private Drawable mSplashViewDrawable;
private TaskView mTaskView;
@@ -279,7 +279,7 @@
canvas.save();
// Draw the insets if we're being drawn fullscreen (we do this for quick switch).
drawOnCanvas(canvas, 0, 0, getMeasuredWidth(), getMeasuredHeight(),
- mFullscreenParams.getCurrentDrawnCornerRadius());
+ mFullscreenParams.getCurrentCornerRadius());
canvas.restore();
}
@@ -287,7 +287,7 @@
return mPreviewPositionHelper;
}
- public void setFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams) {
+ public void setFullscreenParams(FullscreenDrawParams fullscreenParams) {
mFullscreenParams = fullscreenParams;
invalidate();
}
@@ -473,7 +473,7 @@
mBitmapShader.setLocalMatrix(mPreviewPositionHelper.getMatrix());
mPaint.setShader(mBitmapShader);
}
- mTaskView.updateCurrentFullscreenParams();
+ mTaskView.updateFullscreenParams();
invalidate();
}
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.kt b/quickstep/src/com/android/quickstep/views/TaskView.kt
index b1cb407..819ab05 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.kt
+++ b/quickstep/src/com/android/quickstep/views/TaskView.kt
@@ -59,13 +59,11 @@
import com.android.launcher3.testing.TestLogging
import com.android.launcher3.testing.shared.TestProtocol
import com.android.launcher3.util.CancellableTask
-import com.android.launcher3.util.DisplayController
import com.android.launcher3.util.Executors
import com.android.launcher3.util.MultiPropertyFactory
import com.android.launcher3.util.MultiPropertyFactory.MULTI_PROPERTY_VALUE
import com.android.launcher3.util.MultiValueAlpha
import com.android.launcher3.util.RunnableList
-import com.android.launcher3.util.SafeCloseable
import com.android.launcher3.util.SplitConfigurationOptions
import com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption
@@ -74,16 +72,13 @@
import com.android.launcher3.util.TransformingTouchDelegate
import com.android.launcher3.util.ViewPool
import com.android.launcher3.util.rects.set
-import com.android.launcher3.views.ActivityContext
+import com.android.quickstep.FullscreenDrawParams
import com.android.quickstep.RecentsModel
import com.android.quickstep.RemoteAnimationTargets
import com.android.quickstep.TaskOverlayFactory
import com.android.quickstep.TaskViewUtils
import com.android.quickstep.orientation.RecentsPagedOrientationHandler
-import com.android.quickstep.recents.di.RecentsDependencies
-import com.android.quickstep.recents.di.get
import com.android.quickstep.task.thumbnail.TaskThumbnailView
-import com.android.quickstep.task.viewmodel.TaskViewModel
import com.android.quickstep.util.ActiveGestureErrorDetector
import com.android.quickstep.util.ActiveGestureLog
import com.android.quickstep.util.BorderAnimator
@@ -95,7 +90,6 @@
import com.android.systemui.shared.recents.model.Task
import com.android.systemui.shared.recents.model.ThumbnailData
import com.android.systemui.shared.system.ActivityManagerWrapper
-import com.android.systemui.shared.system.QuickStepContract
/** A task in the Recents view. */
open class TaskView
@@ -108,6 +102,7 @@
focusBorderAnimator: BorderAnimator? = null,
hoverBorderAnimator: BorderAnimator? = null,
private val type: TaskViewType = TaskViewType.SINGLE,
+ protected val thumbnailFullscreenParams: FullscreenDrawParams = FullscreenDrawParams(context),
) : FrameLayout(context, attrs), ViewPool.Reusable {
/**
* Used in conjunction with [onTaskListVisibilityChanged], providing more granularity on which
@@ -117,8 +112,6 @@
@IntDef(FLAG_UPDATE_ALL, FLAG_UPDATE_ICON, FLAG_UPDATE_THUMBNAIL, FLAG_UPDATE_CORNER_RADIUS)
annotation class TaskDataChanges
- private lateinit var taskViewModel: TaskViewModel
-
val taskIds: IntArray
/** Returns a copy of integer array containing taskIds of all tasks in the TaskView. */
get() = taskContainers.map { it.task.key.id }.toIntArray()
@@ -142,9 +135,6 @@
this == recentsView?.focusedTaskView ||
(enableLargeDesktopWindowingTile() && type == TaskViewType.DESKTOP)
- val taskCornerRadius: Float
- get() = currentFullscreenParams.cornerRadius
-
val recentsView: RecentsView<*, *>?
get() = parent as? RecentsView<*, *>
@@ -165,7 +155,6 @@
val firstItemInfo: ItemInfo
get() = taskContainers[0].itemInfo
- private val currentFullscreenParams = FullscreenDrawParams(context)
protected val container: RecentsViewContainer =
RecentsViewContainer.containerFromContext(context)
protected val lastTouchDownPosition = PointF()
@@ -489,17 +478,13 @@
init {
setOnClickListener { _ -> onClick() }
- if (enableRefactorTaskThumbnail()) {
- taskViewModel = RecentsDependencies.get(this, "TaskViewType" to type)
- }
-
val cursorHoverStatesEnabled = enableCursorHoverStates()
setWillNotDraw(!cursorHoverStatesEnabled)
context.obtainStyledAttributes(attrs, R.styleable.TaskView, defStyleAttr, defStyleRes).use {
this.focusBorderAnimator =
focusBorderAnimator
?: createSimpleBorderAnimator(
- currentFullscreenParams.cornerRadius.toInt(),
+ TaskCornerRadius.get(context).toInt(),
context.resources.getDimensionPixelSize(
R.dimen.keyboard_quick_switch_border_width
),
@@ -514,7 +499,7 @@
hoverBorderAnimator
?: if (cursorHoverStatesEnabled)
createSimpleBorderAnimator(
- currentFullscreenParams.cornerRadius.toInt(),
+ TaskCornerRadius.get(context).toInt(),
context.resources.getDimensionPixelSize(
R.dimen.task_hover_border_width
),
@@ -716,7 +701,16 @@
taskOverlayFactory,
)
)
- taskContainers.forEach { it.bind() }
+ onBind(orientedState)
+ }
+
+ open fun onBind(orientedState: RecentsOrientedState) {
+ taskContainers.forEach {
+ it.bind()
+ if (enableRefactorTaskThumbnail()) {
+ it.thumbnailView.cornerRadius = thumbnailFullscreenParams.currentCornerRadius
+ }
+ }
setOrientationState(orientedState)
}
@@ -935,7 +929,7 @@
}
}
if (needsUpdate(changes, FLAG_UPDATE_CORNER_RADIUS)) {
- currentFullscreenParams.updateCornerRadius(context)
+ thumbnailFullscreenParams.updateCornerRadius(context)
}
}
@@ -1514,10 +1508,7 @@
val scale = persistentScale * dismissScale
scaleX = scale
scaleY = scale
- if (enableRefactorTaskThumbnail()) {
- taskViewModel.updateScale(scale)
- }
- updateSnapshotRadius()
+ updateFullscreenParams()
}
protected open fun applyThumbnailSplashAlpha() {
@@ -1560,30 +1551,25 @@
}
focusTransitionFullscreen.value =
FOCUS_TRANSITION_FAST_OUT_INTERPOLATOR.getInterpolation(1 - fullscreenProgress)
- updateSnapshotRadius()
+ updateFullscreenParams()
}
- protected open fun updateSnapshotRadius() {
- updateCurrentFullscreenParams()
+ protected open fun updateFullscreenParams() {
+ updateFullscreenParams(thumbnailFullscreenParams)
taskContainers.forEach {
- if (!enableRefactorTaskThumbnail()) {
- it.thumbnailViewDeprecated.setFullscreenParams(getThumbnailFullscreenParams())
+ if (enableRefactorTaskThumbnail()) {
+ it.thumbnailView.cornerRadius = thumbnailFullscreenParams.currentCornerRadius
+ } else {
+ it.thumbnailViewDeprecated.setFullscreenParams(thumbnailFullscreenParams)
}
- it.overlay.setFullscreenParams(getThumbnailFullscreenParams())
+ it.overlay.setFullscreenParams(thumbnailFullscreenParams)
}
}
- protected open fun updateCurrentFullscreenParams() {
- updateFullscreenParams(currentFullscreenParams)
- }
-
protected fun updateFullscreenParams(fullscreenParams: FullscreenDrawParams) {
recentsView?.let { fullscreenParams.setProgress(fullscreenProgress, it.scaleX, scaleX) }
}
- protected open fun getThumbnailFullscreenParams(): FullscreenDrawParams =
- currentFullscreenParams
-
private fun onModalnessUpdated(modalness: Float) {
taskContainers.forEach {
it.iconView.setModalAlpha(1 - modalness)
@@ -1630,56 +1616,6 @@
private fun getNonGridTrans(endTranslation: Float) =
endTranslation - getGridTrans(endTranslation)
- /** We update and subsequently draw these in [fullscreenProgress]. */
- open class FullscreenDrawParams(context: Context) : SafeCloseable {
- var cornerRadius = 0f
- private var windowCornerRadius = 0f
- var currentDrawnCornerRadius = 0f
-
- init {
- updateCornerRadius(context)
- }
-
- /** Recomputes the start and end corner radius for the given Context. */
- fun updateCornerRadius(context: Context) {
- cornerRadius = computeTaskCornerRadius(context)
- windowCornerRadius = computeWindowCornerRadius(context)
- }
-
- @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
- open fun computeTaskCornerRadius(context: Context): Float {
- return TaskCornerRadius.get(context)
- }
-
- @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
- open fun computeWindowCornerRadius(context: Context): Float {
- val activityContext: ActivityContext? = ActivityContext.lookupContextNoThrow(context)
-
- // The corner radius is fixed to match when Taskbar is persistent mode
- return if (
- activityContext != null &&
- activityContext.deviceProfile?.isTaskbarPresent == true &&
- DisplayController.isTransientTaskbar(context)
- ) {
- context.resources
- .getDimensionPixelSize(R.dimen.persistent_taskbar_corner_radius)
- .toFloat()
- } else {
- QuickStepContract.getWindowCornerRadius(context)
- }
- }
-
- /** Sets the progress in range [0, 1] */
- fun setProgress(fullscreenProgress: Float, parentScale: Float, taskViewScale: Float) {
- currentDrawnCornerRadius =
- Utilities.mapRange(fullscreenProgress, cornerRadius, windowCornerRadius) /
- parentScale /
- taskViewScale
- }
-
- override fun close() {}
- }
-
private fun MotionEvent.isWithinThumbnailBounds(): Boolean {
return thumbnailBounds.contains(x.toInt(), y.toInt())
}
diff --git a/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java b/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java
index f43a125..0091036 100644
--- a/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java
+++ b/quickstep/src_protolog/com/android/quickstep/util/ActiveGestureProtoLogProxy.java
@@ -96,6 +96,12 @@
+ "force finish recents animation complete; clearing state callback.");
}
+ public static void logHandOffAnimation() {
+ ActiveGestureLog.INSTANCE.addLog("AbsSwipeUpHandler.handOffAnimation");
+ if (!enableActiveGestureProtoLog()) return;
+ ProtoLog.d(ACTIVE_GESTURE_LOG, "AbsSwipeUpHandler.handOffAnimation");
+ }
+
public static void logFinishRecentsAnimationOnTasksAppeared() {
ActiveGestureLog.INSTANCE.addLog("finishRecentsAnimationOnTasksAppeared");
if (!enableActiveGestureProtoLog()) return;
diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/FakeTaskThumbnailViewModel.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/FakeTaskThumbnailViewModel.kt
index ff5d8bd..47d2bfc 100644
--- a/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/FakeTaskThumbnailViewModel.kt
+++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/FakeTaskThumbnailViewModel.kt
@@ -22,8 +22,6 @@
import kotlinx.coroutines.flow.MutableStateFlow
class FakeTaskThumbnailViewModel : TaskThumbnailViewModel {
- override val cornerRadiusProgress = MutableStateFlow(0f)
- override val inheritedScale = MutableStateFlow(1f)
override val dimProgress = MutableStateFlow(0f)
override val splashAlpha = MutableStateFlow(0f)
override val uiState = MutableStateFlow<TaskThumbnailUiState>(Uninitialized)
diff --git a/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewScreenshotTest.kt b/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewScreenshotTest.kt
index 75769e9..49fe614 100644
--- a/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewScreenshotTest.kt
+++ b/quickstep/tests/multivalentScreenshotTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewScreenshotTest.kt
@@ -66,11 +66,13 @@
val di = RecentsDependencies.initialize(context)
val taskThumbnailView =
LayoutInflater.from(context).inflate(R.layout.task_thumbnail, null, false)
+ as TaskThumbnailView
+ taskThumbnailView.cornerRadius = CORNER_RADIUS
val ttvDiScopeId = di.getScope(taskThumbnailView).scopeId
di.provide(TaskThumbnailViewData::class.java, ttvDiScopeId) { TaskThumbnailViewData() }
di.provide(TaskThumbnailViewModel::class.java, ttvDiScopeId) { taskThumbnailViewModel }
- return taskThumbnailView as TaskThumbnailView
+ return taskThumbnailView
}
companion object {
@@ -82,5 +84,7 @@
isDarkTheme = false,
isLandscape = false,
)
+
+ const val CORNER_RADIUS = 56f
}
}
diff --git a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
index 582ea54..fe448f4 100644
--- a/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/launcher3/taskbar/bubbles/animation/BubbleBarViewAnimatorTest.kt
@@ -54,6 +54,7 @@
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.atLeastOnce
+import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
@@ -1266,6 +1267,50 @@
verify(bubbleStashController).stashBubbleBarImmediate()
}
+ @Test
+ fun interruptForIme() {
+ setUpBubbleBar()
+ setUpBubbleStashController()
+
+ val handle = View(context)
+ val handleAnimator = PhysicsAnimator.getInstance(handle)
+ whenever(bubbleStashController.getStashedHandlePhysicsAnimator()).thenReturn(handleAnimator)
+
+ val animator =
+ BubbleBarViewAnimator(
+ bubbleBarView,
+ bubbleStashController,
+ flyoutController,
+ onExpandedNoOp,
+ animatorScheduler,
+ )
+
+ InstrumentationRegistry.getInstrumentation().runOnMainSync {
+ animator.animateBubbleInForStashed(bubble, isExpanding = false)
+ }
+
+ // wait for the animation to start
+ InstrumentationRegistry.getInstrumentation().runOnMainSync {}
+ PhysicsAnimatorTestUtils.blockUntilFirstAnimationFrameWhereTrue(handleAnimator) { true }
+
+ handleAnimator.assertIsRunning()
+ assertThat(animator.isAnimating).isTrue()
+ // verify the hide bubble animation is pending
+ assertThat(animatorScheduler.delayedBlock).isNotNull()
+
+ InstrumentationRegistry.getInstrumentation().runOnMainSync { animator.interruptForIme() }
+
+ // verify that the hide animation was canceled
+ assertThat(animatorScheduler.delayedBlock).isNull()
+ assertThat(animator.isAnimating).isFalse()
+ verify(bubbleStashController).onNewBubbleAnimationInterrupted(eq(true), any())
+
+ // PhysicsAnimatorTestUtils posts the cancellation to the main thread so we need to wait
+ // again
+ InstrumentationRegistry.getInstrumentation().waitForIdleSync()
+ handleAnimator.assertIsNotRunning()
+ }
+
private fun setUpBubbleBar() {
bubbleBarView = BubbleBarView(context)
InstrumentationRegistry.getInstrumentation().runOnMainSync {
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/AbsSwipeUpHandlerTestCase.java b/quickstep/tests/multivalentTests/src/com/android/quickstep/AbsSwipeUpHandlerTestCase.java
index 6b95f8d..970bdec 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/AbsSwipeUpHandlerTestCase.java
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/AbsSwipeUpHandlerTestCase.java
@@ -17,6 +17,7 @@
package com.android.quickstep;
import static com.android.quickstep.AbsSwipeUpHandler.STATE_HANDLER_INVALIDATED;
+import static com.android.wm.shell.shared.ShellSharedConstants.KEY_EXTRA_SHELL_CAN_HAND_OFF_ANIMATION;
import static junit.framework.TestCase.assertFalse;
import static junit.framework.TestCase.assertTrue;
@@ -28,6 +29,7 @@
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -40,6 +42,9 @@
import android.graphics.Rect;
import android.os.Bundle;
import android.os.SystemClock;
+import android.platform.test.annotations.DisableFlags;
+import android.platform.test.annotations.EnableFlags;
+import android.platform.test.flag.junit.SetFlagsRule;
import android.view.RemoteAnimationTarget;
import android.view.SurfaceControl;
import android.view.ViewTreeObserver;
@@ -58,6 +63,7 @@
import com.android.quickstep.util.ContextInitListener;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.RecentsViewContainer;
+import com.android.systemui.shared.Flags;
import com.android.systemui.shared.system.InputConsumerController;
import org.junit.Before;
@@ -103,14 +109,8 @@
/* startBounds= */ null,
/* taskInfo= */ mRunningTaskInfo,
/* allowEnterPip= */ false);
- protected final RecentsAnimationTargets mRecentsAnimationTargets = new RecentsAnimationTargets(
- new RemoteAnimationTarget[] {mRemoteAnimationTarget},
- new RemoteAnimationTarget[] {mRemoteAnimationTarget},
- new RemoteAnimationTarget[] {mRemoteAnimationTarget},
- /* homeContentInsets= */ new Rect(),
- /* minimizedHomeBounds= */ null,
- new Bundle());
+ protected RecentsAnimationTargets mRecentsAnimationTargets;
protected TaskAnimationManager mTaskAnimationManager;
protected RecentsAnimationDeviceState mRecentsAnimationDeviceState;
@@ -127,6 +127,22 @@
@Rule
public final MockitoRule mMockitoRule = MockitoJUnit.rule();
+ @Rule
+ public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
+
+ @Before
+ public void setUpAnimationTargets() {
+ Bundle extras = new Bundle();
+ extras.putBoolean(KEY_EXTRA_SHELL_CAN_HAND_OFF_ANIMATION, true);
+ mRecentsAnimationTargets = new RecentsAnimationTargets(
+ new RemoteAnimationTarget[] {mRemoteAnimationTarget},
+ new RemoteAnimationTarget[] {mRemoteAnimationTarget},
+ new RemoteAnimationTarget[] {mRemoteAnimationTarget},
+ /* homeContentInsets= */ new Rect(),
+ /* minimizedHomeBounds= */ null,
+ extras);
+ }
+
@Before
public void setUpRunningTaskInfo() {
mRunningTaskInfo.baseIntent = new Intent(Intent.ACTION_MAIN)
@@ -237,6 +253,30 @@
});
}
+ @EnableFlags({Flags.FLAG_RETURN_ANIMATION_FRAMEWORK_LIBRARY,
+ Flags.FLAG_RETURN_ANIMATION_FRAMEWORK_LONG_LIVED})
+ @Test
+ public void testHomeGesture_handsOffAnimation() {
+ createSwipeUpHandlerForGesture(GestureState.GestureEndTarget.HOME);
+
+ runOnMainSync(() -> {
+ verify(mRecentsAnimationController).handOffAnimation(any(), any());
+ verifyRecentsAnimationFinishedAndCallCallback();
+ });
+ }
+
+ @DisableFlags({Flags.FLAG_RETURN_ANIMATION_FRAMEWORK_LIBRARY,
+ Flags.FLAG_RETURN_ANIMATION_FRAMEWORK_LONG_LIVED})
+ @Test
+ public void testHomeGesture_doesNotHandOffAnimation_withFlagsDisabled() {
+ createSwipeUpHandlerForGesture(GestureState.GestureEndTarget.HOME);
+
+ runOnMainSync(() -> {
+ verify(mRecentsAnimationController, never()).handOffAnimation(any(), any());
+ verifyRecentsAnimationFinishedAndCallCallback();
+ });
+ }
+
@Test
public void testHomeGesture_invalidatesHandlerAfterParallelAnim() {
ValueAnimator parallelAnim = new ValueAnimator();
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/DesktopFullscreenDrawParamsTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/DesktopFullscreenDrawParamsTest.kt
new file mode 100644
index 0000000..e62455f
--- /dev/null
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/DesktopFullscreenDrawParamsTest.kt
@@ -0,0 +1,48 @@
+/*
+ * 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
+
+import android.content.Context
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.SmallTest
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.mock
+
+/** Test for [DesktopFullscreenDrawParams] class. */
+@SmallTest
+@RunWith(AndroidJUnit4::class)
+class DesktopFullscreenDrawParamsTest() {
+ private val params =
+ DesktopFullscreenDrawParams(mock<Context>(), cornerRadiusProvider = { CORNER_RADIUS })
+
+ @Test
+ fun setMiddleProgress_invariantCornerRadiusForDesktop() {
+ params.setProgress(fullscreenProgress = 0f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(CORNER_RADIUS)
+
+ params.setProgress(fullscreenProgress = 0.67f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(CORNER_RADIUS)
+
+ params.setProgress(fullscreenProgress = 1f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(CORNER_RADIUS)
+ }
+
+ companion object {
+ const val CORNER_RADIUS = 32f
+ }
+}
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/FullscreenDrawParamsTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
index 5d62a4c..99b81e0 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/FullscreenDrawParamsTest.kt
@@ -20,21 +20,17 @@
import androidx.test.filters.SmallTest
import com.android.launcher3.FakeInvariantDeviceProfileTest
import com.android.quickstep.util.TaskCornerRadius
-import com.android.quickstep.views.TaskView.FullscreenDrawParams
import com.android.systemui.shared.system.QuickStepContract
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
-import org.mockito.Mockito.doReturn
-import org.mockito.Mockito.mock
-import org.mockito.Mockito.spy
+import org.mockito.kotlin.mock
-/** Test for FullscreenDrawParams class. */
+/** Test for [FullscreenDrawParams] class. */
@SmallTest
@RunWith(AndroidJUnit4::class)
class FullscreenDrawParamsTest : FakeInvariantDeviceProfileTest() {
-
private lateinit var params: FullscreenDrawParams
@Before
@@ -46,115 +42,108 @@
fun setStartProgress_correctCornerRadiusForTablet() {
initializeVarsForTablet()
- params.setProgress(
- /* fullscreenProgress= */ 0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f
- )
+ params.setProgress(fullscreenProgress = 0f, parentScale = 1.0f, taskViewScale = 1.0f)
val expectedRadius = TaskCornerRadius.get(context)
- assertThat(params.currentDrawnCornerRadius).isEqualTo(expectedRadius)
+ assertThat(params.currentCornerRadius).isEqualTo(expectedRadius)
}
@Test
fun setFullProgress_correctCornerRadiusForTablet() {
initializeVarsForTablet()
- params.setProgress(
- /* fullscreenProgress= */ 1.0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f
- )
+ params.setProgress(fullscreenProgress = 1.0f, parentScale = 1f, taskViewScale = 1f)
val expectedRadius = QuickStepContract.getWindowCornerRadius(context)
- assertThat(params.currentDrawnCornerRadius).isEqualTo(expectedRadius)
+ assertThat(params.currentCornerRadius).isEqualTo(expectedRadius)
}
@Test
fun setStartProgress_correctCornerRadiusForPhone() {
initializeVarsForPhone()
- params.setProgress(
- /* fullscreenProgress= */ 0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f
- )
+ params.setProgress(fullscreenProgress = 0f, parentScale = 1f, taskViewScale = 1f)
val expectedRadius = TaskCornerRadius.get(context)
- assertThat(params.currentDrawnCornerRadius).isEqualTo(expectedRadius)
+ assertThat(params.currentCornerRadius).isEqualTo(expectedRadius)
}
@Test
fun setFullProgress_correctCornerRadiusForPhone() {
initializeVarsForPhone()
- params.setProgress(
- /* fullscreenProgress= */ 1.0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f
- )
+ params.setProgress(fullscreenProgress = 1.0f, parentScale = 1f, taskViewScale = 1f)
val expectedRadius = QuickStepContract.getWindowCornerRadius(context)
- assertThat(params.currentDrawnCornerRadius).isEqualTo(expectedRadius)
+ assertThat(params.currentCornerRadius).isEqualTo(expectedRadius)
}
@Test
fun setStartProgress_correctCornerRadiusForMultiDisplay() {
- val display1Context = context
- val display2Context = mock(Context::class.java)
- val spyParams = spy(params)
+ val display1Context = mock<Context>()
+ val display2Context = mock<Context>()
+ val display1TaskRadius = TASK_CORNER_RADIUS + 1
+ val display2TaskRadius = TASK_CORNER_RADIUS + 2
- val display1TaskRadius = TaskCornerRadius.get(display1Context)
- val display1WindowRadius = QuickStepContract.getWindowCornerRadius(display1Context)
- val display2TaskRadius = display1TaskRadius * 2 + 1 // Arbitrarily different.
- val display2WindowRadius = display1WindowRadius * 2 + 1 // Arbitrarily different.
- doReturn(display2TaskRadius).`when`(spyParams).computeTaskCornerRadius(display2Context)
- doReturn(display2WindowRadius).`when`(spyParams).computeWindowCornerRadius(display2Context)
+ val params =
+ FullscreenDrawParams(
+ context,
+ taskCornerRadiusProvider = { context ->
+ when (context) {
+ display1Context -> display1TaskRadius
+ display2Context -> display2TaskRadius
+ else -> TASK_CORNER_RADIUS
+ }
+ },
+ windowCornerRadiusProvider = { 0f },
+ )
- spyParams.updateCornerRadius(display1Context)
- spyParams.setProgress(
- /* fullscreenProgress= */ 0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f
- )
- assertThat(spyParams.currentDrawnCornerRadius).isEqualTo(display1TaskRadius)
+ params.setProgress(fullscreenProgress = 0f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(TASK_CORNER_RADIUS)
- spyParams.updateCornerRadius(display2Context)
- spyParams.setProgress(
- /* fullscreenProgress= */ 0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f
- )
- assertThat(spyParams.currentDrawnCornerRadius).isEqualTo(display2TaskRadius)
+ params.updateCornerRadius(display1Context)
+ params.setProgress(fullscreenProgress = 0f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(display1TaskRadius)
+
+ params.updateCornerRadius(display2Context)
+ params.setProgress(fullscreenProgress = 0f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(display2TaskRadius)
}
@Test
fun setFullProgress_correctCornerRadiusForMultiDisplay() {
- val display1Context = context
- val display2Context = mock(Context::class.java)
- val spyParams = spy(params)
+ val display1Context = mock<Context>()
+ val display2Context = mock<Context>()
+ val display1WindowRadius = WINDOW_CORNER_RADIUS + 1
+ val display2WindowRadius = WINDOW_CORNER_RADIUS + 2
- val display1TaskRadius = TaskCornerRadius.get(display1Context)
- val display1WindowRadius = QuickStepContract.getWindowCornerRadius(display1Context)
- val display2TaskRadius = display1TaskRadius * 2 + 1 // Arbitrarily different.
- val display2WindowRadius = display1WindowRadius * 2 + 1 // Arbitrarily different.
- doReturn(display2TaskRadius).`when`(spyParams).computeTaskCornerRadius(display2Context)
- doReturn(display2WindowRadius).`when`(spyParams).computeWindowCornerRadius(display2Context)
+ val params =
+ FullscreenDrawParams(
+ context,
+ taskCornerRadiusProvider = { 0f },
+ windowCornerRadiusProvider = { context ->
+ when (context) {
+ display1Context -> display1WindowRadius
+ display2Context -> display2WindowRadius
+ else -> WINDOW_CORNER_RADIUS
+ }
+ },
+ )
- spyParams.updateCornerRadius(display1Context)
- spyParams.setProgress(
- /* fullscreenProgress= */ 1.0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f
- )
- assertThat(spyParams.currentDrawnCornerRadius).isEqualTo(display1WindowRadius)
+ params.setProgress(fullscreenProgress = 1f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(WINDOW_CORNER_RADIUS)
- spyParams.updateCornerRadius(display2Context)
- spyParams.setProgress(
- /* fullscreenProgress= */ 1.0f,
- /* parentScale= */ 1.0f,
- /* taskViewScale= */ 1.0f,
- )
- assertThat(spyParams.currentDrawnCornerRadius).isEqualTo(display2WindowRadius)
+ params.updateCornerRadius(display1Context)
+ params.setProgress(fullscreenProgress = 1f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(display1WindowRadius)
+
+ params.updateCornerRadius(display2Context)
+ params.setProgress(fullscreenProgress = 1f, parentScale = 1f, taskViewScale = 1f)
+ assertThat(params.currentCornerRadius).isEqualTo(display2WindowRadius)
+ }
+
+ companion object {
+ const val TASK_CORNER_RADIUS = 56f
+ const val WINDOW_CORNER_RADIUS = 32f
}
}
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewModelImplTest.kt b/quickstep/tests/multivalentTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewModelImplTest.kt
index e3a6adf..a777bd4 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewModelImplTest.kt
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/task/thumbnail/TaskThumbnailViewModelImplTest.kt
@@ -37,8 +37,6 @@
import com.android.quickstep.task.thumbnail.TaskThumbnailUiState.Uninitialized
import com.android.quickstep.task.viewmodel.TaskContainerData
import com.android.quickstep.task.viewmodel.TaskThumbnailViewModelImpl
-import com.android.quickstep.task.viewmodel.TaskViewData
-import com.android.quickstep.views.TaskViewType
import com.android.systemui.shared.recents.model.Task
import com.android.systemui.shared.recents.model.ThumbnailData
import com.google.common.truth.Truth.assertThat
@@ -57,9 +55,7 @@
private val dispatcher = StandardTestDispatcher()
private val testScope = TestScope(dispatcher)
- private var taskViewType = TaskViewType.SINGLE
private val recentsViewData = RecentsViewData()
- private val taskViewData by lazy { TaskViewData(taskViewType) }
private val taskContainerData = TaskContainerData()
private val dispatcherProvider = TestDispatcherProvider(dispatcher)
private val tasksRepository = FakeTasksRepository()
@@ -69,7 +65,6 @@
private val systemUnderTest by lazy {
TaskThumbnailViewModelImpl(
recentsViewData,
- taskViewData,
taskContainerData,
dispatcherProvider,
tasksRepository,
@@ -124,40 +119,6 @@
}
@Test
- fun setRecentsFullscreenProgress_thenCornerRadiusProgressIsPassedThrough() =
- testScope.runTest {
- recentsViewData.fullscreenProgress.value = 0.5f
-
- assertThat(systemUnderTest.cornerRadiusProgress.first()).isEqualTo(0.5f)
-
- recentsViewData.fullscreenProgress.value = 0.6f
-
- assertThat(systemUnderTest.cornerRadiusProgress.first()).isEqualTo(0.6f)
- }
-
- @Test
- fun setRecentsFullscreenProgress_thenCornerRadiusProgressIsConstantForDesktop() =
- testScope.runTest {
- taskViewType = TaskViewType.DESKTOP
- recentsViewData.fullscreenProgress.value = 0.5f
-
- assertThat(systemUnderTest.cornerRadiusProgress.first()).isEqualTo(1f)
-
- recentsViewData.fullscreenProgress.value = 0.6f
-
- assertThat(systemUnderTest.cornerRadiusProgress.first()).isEqualTo(1f)
- }
-
- @Test
- fun setAncestorScales_thenScaleIsCalculated() =
- testScope.runTest {
- recentsViewData.scale.value = 0.5f
- taskViewData.scale.value = 0.6f
-
- assertThat(systemUnderTest.inheritedScale.first()).isEqualTo(0.3f)
- }
-
- @Test
fun bindRunningTaskThenStoppedTaskWithoutThumbnail_thenStateChangesToBackgroundOnly() =
testScope.runTest {
val runningTaskId = 1
diff --git a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/TaskViewSimulatorTest.java b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/TaskViewSimulatorTest.java
index 72cfd92..fa81680 100644
--- a/quickstep/tests/multivalentTests/src/com/android/quickstep/util/TaskViewSimulatorTest.java
+++ b/quickstep/tests/multivalentTests/src/com/android/quickstep/util/TaskViewSimulatorTest.java
@@ -202,7 +202,7 @@
mDeviceProfile.updateInsets(mLauncherInsets);
TaskViewSimulator tvs = new TaskViewSimulator(helper.sandboxContext,
- FallbackActivityInterface.INSTANCE);
+ FallbackActivityInterface.INSTANCE, false, 0);
tvs.setDp(mDeviceProfile);
int launcherRotation = info.rotation;
diff --git a/res/values/strings.xml b/res/values/strings.xml
index c280307..f7069a6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -458,7 +458,7 @@
<string name="widget_resized">Widget resized to width <xliff:g id="number" example="2">%1$s</xliff:g> height <xliff:g id="number" example="1">%2$s</xliff:g></string>
<!-- Accessibility action to show quick actions menu for an icon. [CHAR_LIMIT=30] -->
- <string name="action_deep_shortcut">Shortcuts</string>
+ <string name="action_deep_shortcut">Shortcut Menu</string>
<!-- Accessibility action to dismiss a notification in the shortcuts menu for an icon. [CHAR_LIMIT=30] -->
<string name="action_dismiss_notification">Dismiss</string>
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 74dd971..f61d3f0 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -233,6 +233,7 @@
import com.android.launcher3.util.ItemInflater;
import com.android.launcher3.util.KeyboardShortcutsDelegate;
import com.android.launcher3.util.LockedUserState;
+import com.android.launcher3.util.MSDLPlayerWrapper;
import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.util.PendingRequestArgs;
import com.android.launcher3.util.PluginManagerWrapper;
@@ -2745,6 +2746,7 @@
mModel.dumpState(prefix, fd, writer, args);
mOverlayManager.dump(prefix, writer);
ACTIVITY_TRACKER.dump(prefix, writer);
+ MSDLPlayerWrapper.INSTANCE.get(getApplicationContext()).dump(prefix, writer);
}
/**
diff --git a/src/com/android/launcher3/util/ContextTracker.java b/src/com/android/launcher3/util/ContextTracker.java
index c729b4b..3201bd1 100644
--- a/src/com/android/launcher3/util/ContextTracker.java
+++ b/src/com/android/launcher3/util/ContextTracker.java
@@ -35,7 +35,7 @@
private static final String TAG = "ContextTracker";
private WeakReference<CONTEXT> mCurrentContext = new WeakReference<>(null);
- private CopyOnWriteArrayList<SchedulerCallback<CONTEXT>> mCallbacks =
+ private final CopyOnWriteArrayList<SchedulerCallback<CONTEXT>> mCallbacks =
new CopyOnWriteArrayList<>();
@Nullable
@@ -81,7 +81,7 @@
public boolean handleCreate(CONTEXT context) {
mCurrentContext = new WeakReference<>(context);
- return handleCreate(context, /* alreadyOnHome= */ false);
+ return handleCreate(context, isHomeStarted(context));
}
public boolean handleNewIntent(CONTEXT context) {
diff --git a/src/com/android/launcher3/util/MSDLPlayerWrapper.java b/src/com/android/launcher3/util/MSDLPlayerWrapper.java
index aab7009..eccccc7 100644
--- a/src/com/android/launcher3/util/MSDLPlayerWrapper.java
+++ b/src/com/android/launcher3/util/MSDLPlayerWrapper.java
@@ -30,6 +30,7 @@
import com.google.android.msdl.domain.MSDLPlayer;
import com.google.android.msdl.logging.MSDLEvent;
+import java.io.PrintWriter;
import java.util.List;
import javax.inject.Inject;
@@ -65,4 +66,13 @@
public List<MSDLEvent> getHistory() {
return mMSDLPlayer.getHistory();
}
+
+ /** Print the latest history of MSDL tokens played */
+ public void dump(String prefix, PrintWriter writer) {
+ writer.println(prefix + "MSDLPlayerWrapper history of latest events:");
+ List<MSDLEvent> events = getHistory();
+ for (MSDLEvent event: events) {
+ writer.println(prefix + "\t" + event);
+ }
+ }
}
diff --git a/tests/AndroidManifest-common.xml b/tests/AndroidManifest-common.xml
index 1ddd453..68e493d 100644
--- a/tests/AndroidManifest-common.xml
+++ b/tests/AndroidManifest-common.xml
@@ -183,6 +183,7 @@
</activity>
<activity-alias android:name="Activity2"
android:label="TestActivity2"
+ android:icon="@drawable/test_icon"
android:exported="true"
android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
<intent-filter>
@@ -192,6 +193,7 @@
</activity-alias>
<activity-alias android:name="Activity3"
android:label="TestActivity3"
+ android:icon="@drawable/test_icon"
android:exported="true"
android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
<intent-filter>
@@ -201,6 +203,7 @@
</activity-alias>
<activity-alias android:name="Activity4"
android:label="TestActivity4"
+ android:icon="@drawable/test_icon"
android:exported="true"
android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
<intent-filter>
@@ -210,6 +213,7 @@
</activity-alias>
<activity-alias android:name="Activity5"
android:label="TestActivity5"
+ android:icon="@drawable/test_icon"
android:exported="true"
android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
<intent-filter>
@@ -219,6 +223,7 @@
</activity-alias>
<activity-alias android:name="Activity6"
android:label="TestActivity6"
+ android:icon="@drawable/test_icon"
android:exported="true"
android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
<intent-filter>
@@ -228,6 +233,7 @@
</activity-alias>
<activity-alias android:name="Activity7"
android:label="TestActivity7"
+ android:icon="@drawable/test_icon"
android:exported="true"
android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
<intent-filter>
@@ -237,6 +243,7 @@
</activity-alias>
<activity-alias android:name="Activity8"
android:label="TestActivity8"
+ android:icon="@drawable/test_icon"
android:exported="true"
android:targetActivity="com.android.launcher3.testcomponent.BaseTestingActivity">
<intent-filter>
@@ -246,6 +253,7 @@
</activity-alias>
<activity-alias android:name="Activity9" android:exported="true"
android:label="TestActivity9"
+ android:icon="@drawable/test_icon"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -254,6 +262,7 @@
</activity-alias>
<activity-alias android:name="Activity10" android:exported="true"
android:label="TestActivity10"
+ android:icon="@drawable/test_icon"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -262,6 +271,7 @@
</activity-alias>
<activity-alias android:name="Activity11" android:exported="true"
android:label="TestActivity11"
+ android:icon="@drawable/test_icon"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -270,6 +280,7 @@
</activity-alias>
<activity-alias android:name="Activity12" android:exported="true"
android:label="TestActivity12"
+ android:icon="@drawable/test_icon"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -278,6 +289,7 @@
</activity-alias>
<activity-alias android:name="Activity13" android:exported="true"
android:label="TestActivity13"
+ android:icon="@drawable/test_icon"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -286,6 +298,7 @@
</activity-alias>
<activity-alias android:name="Activity14" android:exported="true"
android:label="TestActivity14"
+ android:icon="@drawable/test_icon"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -363,7 +376,7 @@
</activity>
<activity android:name="com.android.launcher3.testcomponent.ImeTestActivity"
android:label="ImeTestActivity"
- android:icon="@drawable/test_theme_icon"
+ android:icon="@drawable/test_icon"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
diff --git a/tests/multivalentTests/src/com/android/launcher3/model/FolderIconLoadTest.kt b/tests/multivalentTests/src/com/android/launcher3/model/FolderIconLoadTest.kt
index 7cd5da4..e8f778f 100644
--- a/tests/multivalentTests/src/com/android/launcher3/model/FolderIconLoadTest.kt
+++ b/tests/multivalentTests/src/com/android/launcher3/model/FolderIconLoadTest.kt
@@ -18,6 +18,7 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.launcher3.LauncherAppState
+import com.android.launcher3.icons.BitmapInfo
import com.android.launcher3.icons.waitForUpdateHandlerToFinish
import com.android.launcher3.model.data.WorkspaceItemInfo
import com.android.launcher3.util.Executors
@@ -160,6 +161,9 @@
assertWithMessage("Index $index was not highRes")
.that(items[index].bitmap.isNullOrLowRes)
.isFalse()
+ assertWithMessage("Index $index was the default icon")
+ .that(isDefaultIcon(items[index].bitmap))
+ .isFalse()
}
}
@@ -168,9 +172,17 @@
assertWithMessage("Index $index was not lowRes")
.that(items[index].bitmap.isNullOrLowRes)
.isTrue()
+ assertWithMessage("Index $index was the default icon")
+ .that(isDefaultIcon(items[index].bitmap))
+ .isFalse()
}
}
+ private fun isDefaultIcon(bitmap: BitmapInfo) =
+ LauncherAppState.getInstance(modelHelper.sandboxContext)
+ .iconCache
+ .isDefaultIcon(bitmap, modelHelper.sandboxContext.user)
+
/** Recreate DeviceProfiles after changing InvariantDeviceProfile */
private fun recreateSupportedDeviceProfiles() {
LauncherAppState.getIDP(modelHelper.sandboxContext).supportedProfiles =
diff --git a/tests/res/drawable/test_icon.xml b/tests/res/drawable/test_icon.xml
new file mode 100644
index 0000000..72ebfeb
--- /dev/null
+++ b/tests/res/drawable/test_icon.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Copyright (C) 2024 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.
+-->
+<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
+ <background android:drawable="@android:color/white"/>
+ <foreground>
+ <color android:color="#FFFF0000" />
+ </foreground>
+ <monochrome>
+ <vector android:width="48dp" android:height="48dp" android:viewportWidth="48.0" android:viewportHeight="48.0">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M0,24L48,24 48,48, 0,48 Z"/>
+ </vector>
+ </monochrome>
+</adaptive-icon>