Skip to content

Commit 20a08f5

Browse files
minaripenguinneobuddy89
authored andcommittedJul 12, 2024
Launcher3: Disable live tile feature
* This feature seems to be made for Pixel features (Recents screen/picture share, etc.). Beyond that, we have no use for live tile since we don't have such features in Quickstep. * this patch fixes multiple issue like telegram/instagram freezing when performing swipe up gesture Change-Id: I9a56ec78f74a88b99d8bba5d17c5db321debac9c Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com> Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
1 parent cf71e00 commit 20a08f5

16 files changed

+80
-335
lines changed
 

‎quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java

-5
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ private void initCurrentAnimation() {
150150
AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher,
151151
builder);
152152

153-
builder.addOnFrameCallback(recentsView::redrawLiveTile);
154-
155153
AbstractFloatingView.closeOpenContainer(mLauncher, AbstractFloatingView.TYPE_TASK_MENU);
156154
} else if (mStartState == ALL_APPS) {
157155
AllAppsTransitionController allAppsController = mLauncher.getAllAppsController();
@@ -191,9 +189,6 @@ public void onDragEnd(float velocity) {
191189
boolean success = interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS
192190
|| (velocity < 0 && fling);
193191
if (success) {
194-
RecentsView recentsView = mLauncher.getOverviewPanel();
195-
recentsView.switchToScreenshot(null,
196-
() -> recentsView.finishRecentsAnimation(true /* toRecents */, null));
197192
if (mStartState.overviewUi) {
198193
Runnable onReachedHome = () -> {
199194
StateManager.StateListener<LauncherState> listener =

‎quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java

+35-19
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,9 @@ private void initStateCallbacks() {
470470
this::resetStateForAnimationCancel);
471471
mStateCallback.runOnceAtState(STATE_HANDLER_INVALIDATED | STATE_FINISH_WITH_NO_END,
472472
this::resetStateForAnimationCancel);
473+
mStateCallback.addChangeListener(STATE_APP_CONTROLLER_RECEIVED | STATE_LAUNCHER_PRESENT
474+
| STATE_SCREENSHOT_VIEW_SHOWN | STATE_CAPTURE_SCREENSHOT,
475+
(b) -> mRecentsView.setRunningTaskHidden(!b));
473476
}
474477

475478
protected boolean onActivityInit(Boolean alreadyOnHome) {
@@ -647,10 +650,7 @@ private void onLauncherPresentAndGestureStarted() {
647650
}
648651

649652
private void onDeferredActivityLaunch() {
650-
mActivityInterface.switchRunningTaskViewToScreenshot(
651-
null, () -> {
652-
mTaskAnimationManager.finishRunningRecentsAnimation(true /* toHome */);
653-
});
653+
mTaskAnimationManager.finishRunningRecentsAnimation(true /* toHome */);
654654
}
655655

656656
private void setupRecentsViewUi() {
@@ -957,6 +957,25 @@ private void updateSysUiFlags(float windowProgress) {
957957
public void onRecentsAnimationStart(RecentsAnimationController controller,
958958
RecentsAnimationTargets targets) {
959959
super.onRecentsAnimationStart(controller, targets);
960+
if (targets.apps == null || targets.apps.length == 0) {
961+
return;
962+
}
963+
if (isDesktopModeSupported() && targets.hasDesktopTasks()) {
964+
mRemoteTargetHandles = mTargetGluer.assignTargetsForDesktop(targets);
965+
} else {
966+
int untrimmedAppCount = mRemoteTargetHandles.length;
967+
mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(targets);
968+
if (mRemoteTargetHandles == null || mRemoteTargetHandles.length == 0) {
969+
return;
970+
}
971+
if (mRemoteTargetHandles.length < untrimmedAppCount && mIsSwipeForSplit) {
972+
updateIsGestureForSplit(mRemoteTargetHandles.length);
973+
setupRecentsViewUi();
974+
}
975+
}
976+
if (mRemoteTargetHandles == null || mRemoteTargetHandles.length == 0) {
977+
return;
978+
}
960979
if (isDesktopModeSupported() && targets.hasDesktopTasks()) {
961980
mRemoteTargetHandles = mTargetGluer.assignTargetsForDesktop(targets);
962981
} else {
@@ -1995,10 +2014,8 @@ private void cancelCurrentAnimation() {
19952014
}
19962015

19972016
private void invalidateHandler() {
1998-
if (!mActivityInterface.isInLiveTileMode() || mGestureState.getEndTarget() != RECENTS) {
1999-
mInputConsumerProxy.destroy();
2000-
mTaskAnimationManager.setLiveTileCleanUpHandler(null);
2001-
}
2017+
mInputConsumerProxy.destroy();
2018+
mTaskAnimationManager.setLiveTileCleanUpHandler(null);
20022019
mInputConsumerProxy.unregisterOnTouchDownCallback();
20032020
endRunningWindowAnim(false /* cancel */);
20042021

@@ -2042,6 +2059,7 @@ private void endLauncherTransitionController() {
20422059
* continued quick switch gesture, which cancels the previous handler but doesn't invalidate it.
20432060
*/
20442061
private void resetLauncherListeners() {
2062+
mGestureState.getActivityInterface().setOnDeferredActivityLaunchCallback(null);
20452063
if (mActivity != null) {
20462064
mActivity.removeEventCallback(EVENT_STARTED, mLauncherOnStartCallback);
20472065
mActivity.removeEventCallback(EVENT_DESTROYED, mLauncherOnDestroyCallback);
@@ -2092,15 +2110,15 @@ protected void switchToScreenshot() {
20922110
}
20932111

20942112
MAIN_EXECUTOR.execute(() -> {
2095-
if (!updateThumbnail(false /* refreshView */)) {
2113+
if (!updateThumbnail(true /* refreshView */)) {
20962114
setScreenshotCapturedState();
20972115
}
20982116
});
20992117
});
21002118
return;
21012119
}
21022120

2103-
finishTransitionPosted = updateThumbnail(false /* refreshView */);
2121+
finishTransitionPosted = updateThumbnail(true /* refreshView */);
21042122
}
21052123

21062124
if (!finishTransitionPosted) {
@@ -2140,10 +2158,13 @@ private void setScreenshotCapturedState() {
21402158
TraceHelper.INSTANCE.endSection();
21412159
}
21422160

2143-
private void finishCurrentTransitionToRecents() {
2144-
mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED);
2145-
if (mRecentsAnimationController != null) {
2146-
mRecentsAnimationController.detachNavigationBarFromApp(true);
2161+
private void finishCurrentTransitionToRecents() {
2162+
if (!hasTargets() || mRecentsAnimationController == null) {
2163+
// If there are no targets or the animation not started, then there is nothing to finish
2164+
mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED);
2165+
} else {
2166+
mRecentsAnimationController.finish(true /* toRecents */,
2167+
() -> mStateCallback.setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
21472168
}
21482169
}
21492170

@@ -2215,11 +2236,6 @@ private void setupLauncherUiAfterSwipeUpToRecentsAnimation() {
22152236
}
22162237
endLauncherTransitionController();
22172238
mRecentsView.onSwipeUpAnimationSuccess();
2218-
mTaskAnimationManager.setLiveTileCleanUpHandler(() -> {
2219-
mRecentsView.cleanupRemoteTargets();
2220-
mInputConsumerProxy.destroy();
2221-
});
2222-
mTaskAnimationManager.enableLiveTileRestartListener();
22232239

22242240
SystemUiProxy.INSTANCE.get(mContext).onOverviewShown(false, TAG);
22252241
doLogGesture(RECENTS, mRecentsView.getCurrentPageTaskView());

‎quickstep/src/com/android/quickstep/FallbackActivityInterface.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public FallbackTaskbarUIController getTaskbarController() {
114114
public RecentsView getVisibleRecentsView() {
115115
RecentsActivity activity = getCreatedActivity();
116116
if (activity != null) {
117-
if (activity.hasBeenResumed() || isInLiveTileMode()) {
117+
boolean enableLiveTile = false;
118+
if (activity.hasBeenResumed() || (enableLiveTile && isInLiveTileMode())) {
118119
return activity.getOverviewPanel();
119120
}
120121
}

‎quickstep/src/com/android/quickstep/LauncherActivityInterface.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,10 @@ public RecentsView getVisibleRecentsView() {
206206
@UiThread
207207
private Launcher getVisibleLauncher() {
208208
Launcher launcher = getCreatedActivity();
209+
boolean enableLiveTile = false;
209210
return (launcher != null) && launcher.isStarted()
210-
&& (isInLiveTileMode() || launcher.hasBeenResumed()) ? launcher : null;
211+
&& ((enableLiveTile && isInLiveTileMode())
212+
|| launcher.hasBeenResumed()) ? launcher : null;
211213
}
212214

213215
@Override
@@ -216,7 +218,8 @@ public boolean switchToRecentsIfVisible(Animator.AnimatorListener animatorListen
216218
if (launcher == null) {
217219
return false;
218220
}
219-
if (isInLiveTileMode()) {
221+
boolean enableLiveTile = false;
222+
if (enableLiveTile && isInLiveTileMode()) {
220223
RecentsView recentsView = getVisibleRecentsView();
221224
if (recentsView == null) {
222225
return false;

‎quickstep/src/com/android/quickstep/OverviewCommandHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ private boolean launchTask(RecentsView recents, @Nullable TaskView taskView, Com
171171
if (taskView != null) {
172172
mWaitForToggleCommandComplete = true;
173173
taskView.setEndQuickswitchCuj(true);
174-
callbackList = taskView.launchTasks();
174+
callbackList = taskView.launchTaskAnimated();
175175
}
176176

177177
if (callbackList != null) {

‎quickstep/src/com/android/quickstep/RecentsActivity.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,7 @@ public void onBackPressed() {
431431
}
432432

433433
public void startHome() {
434-
RecentsView recentsView = getOverviewPanel();
435-
recentsView.switchToScreenshot(() -> recentsView.finishRecentsAnimation(true,
436-
this::startHomeInternal));
434+
startHomeInternal();
437435
}
438436

439437
private void startHomeInternal() {

‎quickstep/src/com/android/quickstep/TaskAnimationManager.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
6565
private RemoteAnimationTarget[] mLastAppearedTaskTargets;
6666
private Runnable mLiveTileCleanUpHandler;
6767
private Context mCtx;
68+
private boolean enableLiveTile = false;
6869

6970
private boolean mRecentsAnimationStartPending = false;
7071

@@ -78,7 +79,7 @@ public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
7879
return;
7980
}
8081
BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface();
81-
if (activityInterface.isInLiveTileMode()
82+
if (enableLiveTile && activityInterface.isInLiveTileMode()
8283
&& activityInterface.getCreatedActivity() != null) {
8384
RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel();
8485
if (recentsView != null) {
@@ -232,7 +233,7 @@ public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets) {
232233
if (nonAppTargets == null) {
233234
nonAppTargets = new RemoteAnimationTarget[0];
234235
}
235-
if ((activityInterface.isInLiveTileMode()
236+
if ((enableLiveTile && activityInterface.isInLiveTileMode()
236237
|| mLastGestureState.getEndTarget() == RECENTS
237238
|| isNonRecentsStartedTasksAppeared(appearedTaskTargets))
238239
&& activityInterface.getCreatedActivity() != null) {
@@ -272,7 +273,7 @@ public void onTasksAppeared(RemoteAnimationTarget[] appearedTaskTargets) {
272273

273274
@Override
274275
public boolean onSwitchToScreenshot(Runnable onFinished) {
275-
if (!activityInterface.isInLiveTileMode()
276+
if (!enableLiveTile && !activityInterface.isInLiveTileMode()
276277
|| activityInterface.getCreatedActivity() == null) {
277278
// No need to switch since tile is already a screenshot.
278279
onFinished.run();
@@ -333,7 +334,7 @@ public void endLiveTile() {
333334
return;
334335
}
335336
BaseActivityInterface activityInterface = mLastGestureState.getActivityInterface();
336-
if (activityInterface.isInLiveTileMode()
337+
if (enableLiveTile && activityInterface.isInLiveTileMode()
337338
&& activityInterface.getCreatedActivity() != null) {
338339
RecentsView recentsView = activityInterface.getCreatedActivity().getOverviewPanel();
339340
if (recentsView != null) {

‎quickstep/src/com/android/quickstep/TaskOverlayFactory.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,7 @@ public void initOverlay(Task task, ThumbnailData thumbnail, Matrix matrix,
191191
* @param callback callback to run, after switching to screenshot
192192
*/
193193
public void endLiveTileMode(@NonNull Runnable callback) {
194-
RecentsView recentsView = mThumbnailView.getTaskView().getRecentsView();
195-
// Task has already been dismissed
196-
if (recentsView == null) return;
197-
recentsView.switchToScreenshot(
198-
() -> recentsView.finishRecentsAnimation(true /* toRecents */,
199-
false /* shouldPip */, callback));
194+
callback.run();
200195
}
201196

202197
/**

‎quickstep/src/com/android/quickstep/TaskViewUtils.java

-3
Original file line numberDiff line numberDiff line change
@@ -698,9 +698,6 @@ public void onAnimationEnd(Animator animation) {
698698
};
699699
}
700700
pa.add(launcherAnim);
701-
if (recentsView.getRunningTaskIndex() != -1) {
702-
pa.addOnFrameCallback(recentsView::redrawLiveTile);
703-
}
704701
anim.play(pa.buildAnim());
705702

706703
// Set the current animation first, before adding windowAnimEndListener. Setting current

‎quickstep/src/com/android/quickstep/TouchInteractionService.java

+2-10
Original file line numberDiff line numberDiff line change
@@ -1184,15 +1184,7 @@ private InputConsumer newBaseConsumer(
11841184
&& !launcherResumedThroughShellTransition
11851185
&& !previousGestureState.isRecentsAnimationRunning();
11861186

1187-
if (gestureState.getActivityInterface().isInLiveTileMode()) {
1188-
return createOverviewInputConsumer(
1189-
previousGestureState,
1190-
gestureState,
1191-
event,
1192-
forceOverviewInputConsumer,
1193-
reasonString.append(SUBSTRING_PREFIX)
1194-
.append("is in live tile mode, trying to use overview input consumer"));
1195-
} else if (runningTask == null) {
1187+
if (gestureState.getRunningTask() == null) {
11961188
return getDefaultInputConsumer(reasonString.append(SUBSTRING_PREFIX)
11971189
.append("running task == null"));
11981190
} else if (previousGestureAnimatedToLauncher
@@ -1277,7 +1269,7 @@ public InputConsumer createOverviewInputConsumer(
12771269
boolean isPreviousGestureAnimatingToLauncher =
12781270
previousGestureState.isRunningAnimationToLauncher()
12791271
|| mDeviceState.isPredictiveBackToHomeInProgress();
1280-
boolean isInLiveTileMode = gestureState.getActivityInterface().isInLiveTileMode();
1272+
boolean isInLiveTileMode = false;
12811273
reasonString.append(SUBSTRING_PREFIX)
12821274
.append(hasWindowFocus
12831275
? "activity has window focus"

‎quickstep/src/com/android/quickstep/fallback/RecentsTaskController.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ public RecentsTaskController(RecentsActivity activity) {
2626

2727
@Override
2828
protected boolean isRecentsInteractive() {
29-
return mActivity.hasWindowFocus() || mActivity.getStateManager().getState().hasLiveTile();
29+
boolean enableLiveTile = false;
30+
return mActivity.hasWindowFocus() || (enableLiveTile
31+
&& mActivity.getStateManager().getState().hasLiveTile());
3032
}
3133

3234
@Override

‎quickstep/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java

+2-45
Original file line numberDiff line numberDiff line change
@@ -105,53 +105,10 @@ public void onMotionEvent(MotionEvent ev) {
105105
}
106106

107107
@Override
108-
public void onHoverEvent(MotionEvent ev) {
109-
mActivity.dispatchGenericMotionEvent(ev);
110-
}
108+
public void onHoverEvent(MotionEvent ev) {}
111109

112110
@Override
113-
public void onKeyEvent(KeyEvent ev) {
114-
switch (ev.getKeyCode()) {
115-
case KeyEvent.KEYCODE_VOLUME_DOWN:
116-
case KeyEvent.KEYCODE_VOLUME_UP:
117-
case KeyEvent.KEYCODE_VOLUME_MUTE:
118-
MediaSessionManager mgr = mActivity.getSystemService(MediaSessionManager.class);
119-
mgr.dispatchVolumeKeyEventAsSystemService(ev,
120-
AudioManager.USE_DEFAULT_STREAM_TYPE);
121-
break;
122-
case KeyEvent.KEYCODE_DPAD_LEFT:
123-
case KeyEvent.KEYCODE_DPAD_RIGHT:
124-
if (mHasSetTouchModeForFirstDPadEvent) {
125-
break;
126-
}
127-
View viewRoot = mActivity.getRootView();
128-
if (viewRoot.isAttachedToWindow()) {
129-
setTouchModeChanged(viewRoot);
130-
break;
131-
}
132-
if (mIsWaitingForAttachToWindow) {
133-
break;
134-
}
135-
mIsWaitingForAttachToWindow = true;
136-
viewRoot.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
137-
@Override
138-
public void onViewAttachedToWindow(View view) {
139-
view.removeOnAttachStateChangeListener(this);
140-
mIsWaitingForAttachToWindow = false;
141-
setTouchModeChanged(viewRoot);
142-
}
143-
144-
@Override
145-
public void onViewDetachedFromWindow(View view) {
146-
// Do nothing
147-
}
148-
});
149-
break;
150-
default:
151-
break;
152-
}
153-
mActivity.dispatchKeyEvent(ev);
154-
}
111+
public void onKeyEvent(KeyEvent ev) {}
155112

156113
private void setTouchModeChanged(@NonNull View viewRoot) {
157114
// When Overview is launched via meta+tab or swipe up from an app, the touch

‎quickstep/src/com/android/quickstep/util/TaskViewSimulator.java

-19
Original file line numberDiff line numberDiff line change
@@ -535,25 +535,6 @@ public void onBuildTargetParams(
535535
builder.setMatrix(mMatrix)
536536
.setWindowCrop(mTmpCropRect)
537537
.setCornerRadius(getCurrentCornerRadius());
538-
539-
// If mDrawsBelowRecents is unset, no reordering will be enforced.
540-
if (mDrawsBelowRecents != null) {
541-
// In legacy transitions, the animation leashes remain in same hierarchy in the
542-
// TaskDisplayArea, so we don't want to bump the layer too high otherwise it will
543-
// conflict with layers that WM core positions (ie. the input consumers). For shell
544-
// transitions, the animation leashes are reparented to an animation container so we
545-
// can bump layers as needed.
546-
if (ENABLE_SHELL_TRANSITIONS) {
547-
builder.setLayer(mDrawsBelowRecents
548-
? Integer.MIN_VALUE + app.prefixOrderIndex
549-
// 1000 is an arbitrary number to give room for multiple layers.
550-
: Integer.MAX_VALUE - 1000 + app.prefixOrderIndex);
551-
} else {
552-
builder.setLayer(mDrawsBelowRecents
553-
? Integer.MIN_VALUE + app.prefixOrderIndex
554-
: 0);
555-
}
556-
}
557538
}
558539

559540
/**

‎quickstep/src/com/android/quickstep/views/RecentsView.java

+22-124
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,8 @@ public Float get(RecentsView view) {
553553
private int mKeyboardTaskFocusIndex = INVALID_PAGE;
554554

555555
private float mScrollScale = 1f;
556+
557+
private boolean mIsLandScape;
556558

557559
/**
558560
* TODO: Call reloadIdNeeded in onTaskStackChanged.
@@ -953,9 +955,6 @@ protected void dispatchDraw(Canvas canvas) {
953955
}
954956
super.dispatchDraw(canvas);
955957
}
956-
if (mEnableDrawingLiveTile && mRemoteTargetHandles != null) {
957-
redrawLiveTile();
958-
}
959958
}
960959

961960
private float getUndampedOverScrollShift() {
@@ -1992,21 +1991,7 @@ public void resetTaskVisuals() {
19921991
taskView.setTaskThumbnailSplashAlpha(mTaskThumbnailSplashAlpha);
19931992
}
19941993
}
1995-
// resetTaskVisuals is called at the end of dismiss animation which could update
1996-
// primary and secondary translation of the live tile cut out. We will need to do so
1997-
// here accordingly.
1998-
runActionOnRemoteHandles(remoteTargetHandle -> {
1999-
TaskViewSimulator simulator = remoteTargetHandle.getTaskViewSimulator();
2000-
simulator.taskPrimaryTranslation.value = 0;
2001-
simulator.taskSecondaryTranslation.value = 0;
2002-
simulator.fullScreenProgress.value = 0;
2003-
simulator.recentsViewScale.value = 1;
2004-
});
2005-
// Similar to setRunningTaskHidden below, reapply the state before runningTaskView is
2006-
// null.
2007-
if (!mRunningTaskShowScreenshot) {
2008-
setRunningTaskViewShowScreenshot(mRunningTaskShowScreenshot);
2009-
}
1994+
20101995
if (mRunningTaskTileHidden) {
20111996
setRunningTaskHidden(mRunningTaskTileHidden);
20121997
}
@@ -2096,6 +2081,8 @@ private void updateOrientationHandler(boolean forceRecreateDragLayerControllers)
20962081
|| mOrientationState.getRecentsActivityRotation() != ROTATION_0;
20972082
mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
20982083
!mOrientationState.isRecentsActivityRotationAllowed() && isInLandscape);
2084+
2085+
mIsLandScape = isInLandscape;
20992086

21002087
// Recalculate DeviceProfile dependent layout.
21012088
updateSizeAndPadding();
@@ -2108,6 +2095,10 @@ private void updateOrientationHandler(boolean forceRecreateDragLayerControllers)
21082095
setCurrentPage(mCurrentPage);
21092096
}
21102097

2098+
public boolean getLandScape() {
2099+
return mIsLandScape;
2100+
}
2101+
21112102
private void onOrientationChanged() {
21122103
// If overview is in modal state when rotate, reset it to overview state without running
21132104
// animation.
@@ -2485,14 +2476,10 @@ public void reset() {
24852476
Log.d(TAG, "reset - mEnableDrawingLiveTile: " + mEnableDrawingLiveTile
24862477
+ ", mRecentsAnimationController: " + mRecentsAnimationController);
24872478
if (mEnableDrawingLiveTile) {
2488-
if (mRecentsAnimationController != null) {
2489-
// We owns mRecentsAnimationController, finish it now to clean up.
2490-
finishRecentsAnimation(true /* toRecents */, null);
2491-
} else {
2492-
// Only clean up target set if we no longer owns mRecentsAnimationController.
2493-
runActionOnRemoteHandles(remoteTargetHandle ->
2494-
remoteTargetHandle.getTransformParams().setTargetSet(null));
2495-
}
2479+
mRecentsAnimationController = null;
2480+
// Only clean up target set if we no longer owns mRecentsAnimationController.
2481+
runActionOnRemoteHandles(remoteTargetHandle ->
2482+
remoteTargetHandle.getTransformParams().setTargetSet(null));
24962483
setEnableDrawingLiveTile(false);
24972484
}
24982485
runActionOnRemoteHandles(remoteTargetHandle ->
@@ -2756,10 +2743,6 @@ public void onGestureAnimationEnd() {
27562743
animateActionsViewIn();
27572744

27582745
mCurrentGestureEndTarget = null;
2759-
2760-
switchToScreenshot(
2761-
() -> finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
2762-
null));
27632746
}
27642747

27652748
/**
@@ -2897,13 +2880,7 @@ public void setRunningTaskHidden(boolean isHidden) {
28972880
}
28982881
}
28992882

2900-
private void setRunningTaskViewShowScreenshot(boolean showScreenshot) {
2901-
mRunningTaskShowScreenshot = showScreenshot;
2902-
TaskView runningTaskView = getRunningTaskView();
2903-
if (runningTaskView != null) {
2904-
runningTaskView.setShowScreenshot(mRunningTaskShowScreenshot);
2905-
}
2906-
}
2883+
private void setRunningTaskViewShowScreenshot(boolean showScreenshot) {}
29072884

29082885
public void setTaskIconScaledDown(boolean isScaledDown) {
29092886
if (mTaskIconScaledDown != isScaledDown) {
@@ -3317,19 +3294,6 @@ private void addDismissedTaskAnimations(TaskView taskView, long duration,
33173294

33183295
anim.add(ObjectAnimator.ofFloat(taskView, secondaryViewTranslate,
33193296
verticalFactor * secondaryTaskDimension * 2).setDuration(duration), LINEAR, sp);
3320-
3321-
if (taskView.isRunningTask()) {
3322-
anim.addOnFrameCallback(() -> {
3323-
if (!mEnableDrawingLiveTile) return;
3324-
runActionOnRemoteHandles(
3325-
remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator()
3326-
.taskSecondaryTranslation.value = getPagedOrientationHandler()
3327-
.getSecondaryValue(taskView.getTranslationX(),
3328-
taskView.getTranslationY()
3329-
));
3330-
redrawLiveTile();
3331-
});
3332-
}
33333297
}
33343298

33353299
/**
@@ -3390,19 +3354,6 @@ private void createInitialSplitSelectAnimation(PendingAnimation anim) {
33903354

33913355
InteractionJankMonitorWrapper.begin(this, Cuj.CUJ_SPLIT_SCREEN_ENTER,
33923356
"First tile selected");
3393-
anim.addListener(new AnimatorListenerAdapter() {
3394-
@Override
3395-
public void onAnimationStart(Animator animation) {
3396-
if (mSplitHiddenTaskView == getRunningTaskView()) {
3397-
finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
3398-
null /* onFinishComplete */);
3399-
} else {
3400-
switchToScreenshot(
3401-
() -> finishRecentsAnimation(true /* toRecents */,
3402-
false /* shouldPip */, null /* onFinishComplete */));
3403-
}
3404-
}
3405-
});
34063357
anim.addEndListener(success -> {
34073358
if (success) {
34083359
InteractionJankMonitorWrapper.end(Cuj.CUJ_SPLIT_SCREEN_ENTER);
@@ -3608,16 +3559,6 @@ public void createTaskDismissAnimation(PendingAnimation anim, TaskView dismissed
36083559
dismissTranslationInterpolationEnd
36093560
- halfAdditionalDismissTranslationOffset,
36103561
END_DISMISS_TRANSLATION_INTERPOLATION_OFFSET, 1);
3611-
if (mEnableDrawingLiveTile && taskView.isRunningTask()) {
3612-
anim.addOnFrameCallback(() -> {
3613-
runActionOnRemoteHandles(
3614-
remoteTargetHandle ->
3615-
remoteTargetHandle.getTaskViewSimulator()
3616-
.taskPrimaryTranslation.value =
3617-
TaskView.GRID_END_TRANSLATION_X.get(taskView));
3618-
redrawLiveTile();
3619-
});
3620-
}
36213562
}
36223563

36233564
// Change alpha of clear all if translating grid to hide it
@@ -3738,20 +3679,6 @@ public void onAnimationEnd(Animator animation) {
37383679
)
37393680
);
37403681

3741-
if (mEnableDrawingLiveTile && child instanceof TaskView
3742-
&& ((TaskView) child).isRunningTask()) {
3743-
anim.addOnFrameCallback(() -> {
3744-
runActionOnRemoteHandles(
3745-
remoteTargetHandle ->
3746-
remoteTargetHandle.getTaskViewSimulator()
3747-
.taskPrimaryTranslation.value =
3748-
getPagedOrientationHandler().getPrimaryValue(
3749-
child.getTranslationX(),
3750-
child.getTranslationY()
3751-
));
3752-
redrawLiveTile();
3753-
});
3754-
}
37553682
needsCurveUpdates = true;
37563683
}
37573684
} else if (child instanceof TaskView) {
@@ -3854,12 +3781,7 @@ secondaryTranslation, clampToProgress(LINEAR, animationStartProgress,
38543781
mPendingAnimation.addEndListener(new Consumer<Boolean>() {
38553782
@Override
38563783
public void accept(Boolean success) {
3857-
if (mEnableDrawingLiveTile && dismissedTaskView.isRunningTask() && success) {
3858-
finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
3859-
() -> onEnd(success));
3860-
} else {
3861-
onEnd(success);
3862-
}
3784+
onEnd(success);
38633785
}
38643786

38653787
@SuppressWarnings("WrongCall")
@@ -3871,12 +3793,7 @@ private void onEnd(boolean success) {
38713793
if (success) {
38723794
if (shouldRemoveTask) {
38733795
if (dismissedTaskView.getTask() != null) {
3874-
if (dismissedTaskView.isRunningTask()) {
3875-
finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
3876-
() -> removeTaskInternal(dismissedTaskViewId));
3877-
} else {
3878-
removeTaskInternal(dismissedTaskViewId);
3879-
}
3796+
removeTaskInternal(dismissedTaskViewId);
38803797
announceForAccessibility(
38813798
getResources().getString(R.string.task_view_closed));
38823799
mActivity.getStatsLogManager().logger()
@@ -4589,12 +4506,6 @@ private void updatePageOffsets() {
45894506
? ((TaskView) child).getPrimaryTaskOffsetTranslationProperty()
45904507
: getPagedOrientationHandler().getPrimaryViewTranslate();
45914508
translationPropertyX.set(child, totalTranslationX);
4592-
if (mEnableDrawingLiveTile && i == getRunningTaskIndex()) {
4593-
runActionOnRemoteHandles(
4594-
remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator()
4595-
.taskPrimaryTranslation.value = totalTranslationX);
4596-
redrawLiveTile();
4597-
}
45984509

45994510
if (showAsGrid && enableGridOnlyOverview() && child instanceof TaskView) {
46004511
float totalTranslationY = getVerticalOffsetSize(i, modalOffset);
@@ -4798,6 +4709,8 @@ public void initiateSplitSelect(TaskView taskView, @StagePosition int stagePosit
47984709
mSplitSelectStateController.setAnimateCurrentTaskDismissal(
47994710
true /*animateCurrentTaskDismissal*/);
48004711
mSplitHiddenTaskViewIndex = indexOfChild(taskView);
4712+
finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
4713+
null /* onFinishComplete */);
48014714
if (isDesktopModeSupported()) {
48024715
updateDesktopTaskVisibility(false /* visible */);
48034716
}
@@ -5189,15 +5102,6 @@ public AnimatorSet createAdjacentPageAnimForTaskLaunch(TaskView tv) {
51895102
anim.play(ObjectAnimator.ofFloat(getPageAt(centerTaskIndex),
51905103
getPagedOrientationHandler().getPrimaryViewTranslate(), primaryTranslation));
51915104
int runningTaskIndex = getRunningTaskIndex();
5192-
if (runningTaskIndex != -1 && runningTaskIndex != taskIndex
5193-
&& getRemoteTargetHandles() != null) {
5194-
for (RemoteTargetHandle remoteHandle : getRemoteTargetHandles()) {
5195-
anim.play(ObjectAnimator.ofFloat(
5196-
remoteHandle.getTaskViewSimulator().taskPrimaryTranslation,
5197-
AnimatedFloat.VALUE,
5198-
primaryTranslation));
5199-
}
5200-
}
52015105

52025106
int otherAdjacentTaskIndex = centerTaskIndex + (centerTaskIndex - taskIndex);
52035107
if (otherAdjacentTaskIndex >= 0 && otherAdjacentTaskIndex < getPageCount()) {
@@ -5290,10 +5194,6 @@ public PendingAnimation createTaskLaunchAnimation(
52905194

52915195
mPendingAnimation = new PendingAnimation(duration);
52925196
mPendingAnimation.add(anim);
5293-
runActionOnRemoteHandles(
5294-
remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator()
5295-
.addOverviewToAppAnim(mPendingAnimation, interpolator));
5296-
mPendingAnimation.addOnFrameCallback(this::redrawLiveTile);
52975197
mPendingAnimation.addEndListener(isSuccess -> {
52985198
if (isSuccess) {
52995199
if (tv.getTaskIds()[1] != -1 && mRemoteTargetHandles != null) {
@@ -5305,12 +5205,7 @@ public PendingAnimation createTaskLaunchAnimation(
53055205
dividerAnimator.end();
53065206
});
53075207
}
5308-
if (tv.isRunningTask()) {
5309-
finishRecentsAnimation(false /* toRecents */, null);
5310-
onTaskLaunchAnimationEnd(true /* success */);
5311-
} else {
5312-
tv.launchTask(this::onTaskLaunchAnimationEnd);
5313-
}
5208+
tv.launchTask(this::onTaskLaunchAnimationEnd);
53145209
Task task = tv.getTask();
53155210
if (task != null) {
53165211
mActivity.getStatsLogManager().logger().withItemInfo(tv.getItemInfo())
@@ -6190,6 +6085,9 @@ private void doScrollScale() {
61906085
boolean layoutInLandscape = mOrientationState.getRecentsActivityRotation() != ROTATION_0
61916086
&& mOrientationState.getRecentsActivityRotation() != ROTATION_180;
61926087
boolean canRotateRecents = mOrientationState.isRecentsActivityRotationAllowed();
6088+
6089+
mIsLandScape = touchInLandscape;
6090+
61936091
int childCount = Math.min(mPageScrolls.length, getChildCount());
61946092
int curScroll = !canRotateRecents && touchInLandscape && !layoutInLandscape
61956093
? getScrollY() : getScrollX();

‎quickstep/src/com/android/quickstep/views/TaskThumbnailView.java

-6
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,6 @@ public void setFullscreenParams(TaskView.FullscreenDrawParams fullscreenParams)
357357

358358
public void drawOnCanvas(Canvas canvas, float x, float y, float width, float height,
359359
float cornerRadius) {
360-
if (mTask != null && getTaskView().isRunningTask() && !getTaskView().showScreenshot()) {
361-
canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius, mClearPaint);
362-
canvas.drawRoundRect(x, y, width, height, cornerRadius, cornerRadius,
363-
mDimmingPaintAfterClearing);
364-
return;
365-
}
366360

367361
// Always draw the background since the snapshots might be translucent or partially empty
368362
// (For example, tasks been reparented out of dismissing split root when drag-to-dismiss

‎quickstep/src/com/android/quickstep/views/TaskView.java

+1-86
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,6 @@ public Float get(TaskView taskView) {
388388

389389
protected final PointF mLastTouchDownPosition = new PointF();
390390

391-
private boolean mIsClickableAsLiveTile = true;
392-
393391
@Nullable private final BorderAnimator mFocusBorderAnimator;
394392

395393
@Nullable private final BorderAnimator mHoverBorderAnimator;
@@ -863,23 +861,6 @@ public RunnableList launchTaskAnimated() {
863861
.startActivityFromRecents(mTask.key, opts.options)) {
864862
ActiveGestureLog.INSTANCE.trackEvent(EXPECTING_TASK_APPEARED);
865863
RecentsView recentsView = getRecentsView();
866-
if (recentsView.getRunningTaskViewId() != -1) {
867-
recentsView.onTaskLaunchedInLiveTileMode();
868-
869-
// Return a fresh callback in the live tile case, so that it's not accidentally
870-
// triggered by QuickstepTransitionManager.AppLaunchAnimationRunner.
871-
RunnableList callbackList = new RunnableList();
872-
recentsView.addSideTaskLaunchCallback(callbackList);
873-
return callbackList;
874-
}
875-
if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
876-
// If the recents transition is running (ie. in live tile mode), then the start
877-
// of a new task will merge into the existing transition and it currently will
878-
// not be run independently, so we need to rely on the onTaskAppeared() call
879-
// for the new task to trigger the side launch callback to flush this runnable
880-
// list (which is usually flushed when the app launch animation finishes)
881-
recentsView.addSideTaskLaunchCallback(opts.onEndCallback);
882-
}
883864
return opts.onEndCallback;
884865
} else {
885866
notifyTaskLaunchFailed(TAG);
@@ -969,73 +950,7 @@ public void launchTask(@NonNull Consumer<Boolean> callback, boolean isQuickswitc
969950
public RunnableList launchTasks() {
970951
RecentsView recentsView = getRecentsView();
971952
RemoteTargetHandle[] remoteTargetHandles = recentsView.mRemoteTargetHandles;
972-
if (isRunningTask() && remoteTargetHandles != null) {
973-
if (!mIsClickableAsLiveTile) {
974-
Log.e(TAG, "TaskView is not clickable as a live tile; returning to home.");
975-
return null;
976-
}
977-
978-
mIsClickableAsLiveTile = false;
979-
RemoteAnimationTargets targets;
980-
if (remoteTargetHandles.length == 1) {
981-
targets = remoteTargetHandles[0].getTransformParams().getTargetSet();
982-
} else {
983-
RemoteAnimationTarget[] apps = Arrays.stream(remoteTargetHandles)
984-
.flatMap(handle -> Stream.of(
985-
handle.getTransformParams().getTargetSet().apps))
986-
.toArray(RemoteAnimationTarget[]::new);
987-
RemoteAnimationTarget[] wallpapers = Arrays.stream(remoteTargetHandles)
988-
.flatMap(handle -> Stream.of(
989-
handle.getTransformParams().getTargetSet().wallpapers))
990-
.toArray(RemoteAnimationTarget[]::new);
991-
targets = new RemoteAnimationTargets(apps, wallpapers,
992-
remoteTargetHandles[0].getTransformParams().getTargetSet().nonApps,
993-
remoteTargetHandles[0].getTransformParams().getTargetSet().targetMode);
994-
}
995-
if (targets == null) {
996-
// If the recents animation is cancelled somehow between the parent if block and
997-
// here, try to launch the task as a non live tile task.
998-
RunnableList runnableList = launchTaskAnimated();
999-
if (runnableList == null) {
1000-
Log.e(TAG, "Recents animation cancelled and cannot launch task as non-live tile"
1001-
+ "; returning to home");
1002-
}
1003-
mIsClickableAsLiveTile = true;
1004-
return runnableList;
1005-
}
1006-
1007-
RunnableList runnableList = new RunnableList();
1008-
AnimatorSet anim = new AnimatorSet();
1009-
TaskViewUtils.composeRecentsLaunchAnimator(
1010-
anim, this, targets.apps,
1011-
targets.wallpapers, targets.nonApps, true /* launcherClosing */,
1012-
mActivity.getStateManager(), recentsView,
1013-
recentsView.getDepthController());
1014-
anim.addListener(new AnimatorListenerAdapter() {
1015-
@Override
1016-
public void onAnimationEnd(Animator animator) {
1017-
if (mTask != null && mTask.key.displayId != getRootViewDisplayId()) {
1018-
launchTaskAnimated();
1019-
}
1020-
mIsClickableAsLiveTile = true;
1021-
runEndCallback();
1022-
}
1023-
1024-
@Override
1025-
public void onAnimationCancel(Animator animation) {
1026-
runEndCallback();
1027-
}
1028-
1029-
private void runEndCallback() {
1030-
runnableList.executeAllAndDestroy();
1031-
}
1032-
});
1033-
anim.start();
1034-
recentsView.onTaskLaunchedInLiveTileMode();
1035-
return runnableList;
1036-
} else {
1037-
return launchTaskAnimated();
1038-
}
953+
return launchTaskAnimated();
1039954
}
1040955

1041956
/**

0 commit comments

Comments
 (0)
Please sign in to comment.