Skip to content

Commit 20a08f5

Browse files
minaripenguinneobuddy89
authored andcommitted
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 <[email protected]> Signed-off-by: Pranav Vashi <[email protected]>
1 parent cf71e00 commit 20a08f5

16 files changed

+80
-335
lines changed

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

Lines changed: 0 additions & 5 deletions
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

Lines changed: 35 additions & 19 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 5 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 5 additions & 4 deletions
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

Lines changed: 1 addition & 6 deletions
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

Lines changed: 0 additions & 3 deletions
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

Lines changed: 2 additions & 10 deletions
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"

0 commit comments

Comments
 (0)