Loading quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java +2 −2 Original line number Diff line number Diff line Loading @@ -188,9 +188,9 @@ public class RecentsAnimationWrapper { return true; } public void setCancelWithDeferredScreenshot(boolean deferredWithScreenshot) { public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) { if (targetSet != null) { targetSet.controller.setCancelWithDeferredScreenshot(deferredWithScreenshot); targetSet.controller.setDeferCancelUntilNextTransition(defer, screenshot); } } Loading quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +30 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_H import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_ASSISTANT; Loading Loading @@ -68,6 +69,7 @@ import android.view.WindowManager; import androidx.annotation.BinderThread; import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.MainThreadExecutor; Loading Loading @@ -145,6 +147,11 @@ public class TouchInteractionService extends Service implements private static final String TAG = "TouchInteractionService"; private static final String KEY_BACK_NOTIFICATION_COUNT = "backNotificationCount"; private static final String NOTIFY_ACTION_BACK = "com.android.quickstep.action.BACK_GESTURE"; private static final int MAX_BACK_NOTIFICATION_COUNT = 3; private int mBackGestureNotificationCounter = -1; private final IBinder mMyBinder = new IOverviewProxy.Stub() { public void onActiveNavBarRegionChanges(Region region) { Loading Loading @@ -205,6 +212,10 @@ public class TouchInteractionService extends Service implements mOverviewComponentObserver.getActivityControlHelper(); UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY, isButton, gestureSwipeLeft, activityControl.getContainerType()); if (completed && !isButton && shouldNotifyBackGesture()) { BACKGROUND_EXECUTOR.execute(TouchInteractionService.this::tryNotifyBackGesture); } } public void onSystemUiStateChanged(int stateFlags) { Loading Loading @@ -479,6 +490,8 @@ public class TouchInteractionService extends Service implements // Temporarily disable model preload // new ModelPreload().start(this); mBackGestureNotificationCounter = Math.max(0, Utilities.getDevicePrefs(this) .getInt(KEY_BACK_NOTIFICATION_COUNT, MAX_BACK_NOTIFICATION_COUNT)); Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver); } Loading Loading @@ -569,6 +582,7 @@ public class TouchInteractionService extends Service implements private boolean validSystemUiFlags() { return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0 && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0 && (mSystemUiStateFlags & SYSUI_STATE_QUICK_SETTINGS_EXPANDED) == 0 && ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0 || (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0); } Loading Loading @@ -864,6 +878,22 @@ public class TouchInteractionService extends Service implements mRecentsModel, mInputConsumer, isLikelyToStartNewTask, continuingLastGesture); } protected boolean shouldNotifyBackGesture() { return mBackGestureNotificationCounter > 0 && mGestureBlockingActivity != null; } @WorkerThread protected void tryNotifyBackGesture() { if (shouldNotifyBackGesture()) { mBackGestureNotificationCounter--; Utilities.getDevicePrefs(this).edit() .putInt(KEY_BACK_NOTIFICATION_COUNT, mBackGestureNotificationCounter).apply(); sendBroadcast(new Intent(NOTIFY_ACTION_BACK).setPackage( mGestureBlockingActivity.getPackageName())); } } public static void startRecentsActivityAsync(Intent intent, RecentsAnimationListener listener) { BACKGROUND_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance() .startRecentsActivity(intent, null, listener, null, null)); Loading quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +2 −1 Original line number Diff line number Diff line Loading @@ -1186,7 +1186,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> private void setupLauncherUiAfterSwipeUpToRecentsAnimation() { endLauncherTransitionController(); mActivityControlHelper.onSwipeUpToRecentsComplete(mActivity); mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true); mRecentsAnimationWrapper.setDeferCancelUntilNextTransition(true /* defer */, true /* screenshot */); mRecentsView.onSwipeUpAnimationSuccess(); RecentsModel.INSTANCE.get(mContext).onOverviewShown(false, TAG); Loading quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/FallbackNoButtonInputConsumer.java +3 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import com.android.quickstep.fallback.FallbackRecentsView; import com.android.quickstep.util.ObjectWrapper; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.SwipeAnimationTargetSet; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; Loading Loading @@ -335,7 +336,8 @@ public class FallbackNoButtonInputConsumer extends ThumbnailData thumbnail = mRecentsAnimationWrapper.targetSet.controller.screenshotTask(mRunningTaskId); mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true); mRecentsAnimationWrapper.setDeferCancelUntilNextTransition(true /* defer */, false /* screenshot */); ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0); ActivityOptionsCompat.setFreezeRecentTasksList(options); Loading quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java +5 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.util.ArraySet; import com.android.launcher3.Utilities; import com.android.launcher3.util.Preconditions; import com.android.quickstep.util.SwipeAnimationTargetSet.SwipeAnimationListener; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import com.android.systemui.shared.system.RecentsAnimationListener; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; Loading @@ -39,7 +40,7 @@ import androidx.annotation.UiThread; public class RecentsAnimationListenerSet implements RecentsAnimationListener { // The actual app surface is replaced by a screenshot upon recents animation cancelation when // deferredWithScreenshot is true. Launcher takes the responsibility to clean up this screenshot // the thumbnailData exists. Launcher takes the responsibility to clean up this screenshot // after app transition is finished. This delay is introduced to cover the app transition // period of time. private final int TRANSITION_DELAY = 100; Loading Loading @@ -90,14 +91,14 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener { } @Override public final void onAnimationCanceled(boolean deferredWithScreenshot) { public final void onAnimationCanceled(ThumbnailData thumbnailData) { Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> { for (SwipeAnimationListener listener : getListeners()) { listener.onRecentsAnimationCanceled(); } }); // TODO: handle the transition better instead of simply using a transition delay. if (deferredWithScreenshot) { if (thumbnailData != null) { MAIN_THREAD_EXECUTOR.getHandler().postDelayed(() -> mController.cleanupScreenshot(), TRANSITION_DELAY); } Loading @@ -109,6 +110,6 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener { public void cancelListener() { mCancelled = true; onAnimationCanceled(false); onAnimationCanceled(null); } } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsAnimationWrapper.java +2 −2 Original line number Diff line number Diff line Loading @@ -188,9 +188,9 @@ public class RecentsAnimationWrapper { return true; } public void setCancelWithDeferredScreenshot(boolean deferredWithScreenshot) { public void setDeferCancelUntilNextTransition(boolean defer, boolean screenshot) { if (targetSet != null) { targetSet.controller.setCancelWithDeferredScreenshot(deferredWithScreenshot); targetSet.controller.setDeferCancelUntilNextTransition(defer, screenshot); } } Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +30 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_H import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NAV_BAR_HIDDEN; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_OVERVIEW_DISABLED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_SCREEN_PINNING; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_STATUS_BAR_KEYGUARD_SHOWING_OCCLUDED; import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_ASSISTANT; Loading Loading @@ -68,6 +69,7 @@ import android.view.WindowManager; import androidx.annotation.BinderThread; import androidx.annotation.UiThread; import androidx.annotation.WorkerThread; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.MainThreadExecutor; Loading Loading @@ -145,6 +147,11 @@ public class TouchInteractionService extends Service implements private static final String TAG = "TouchInteractionService"; private static final String KEY_BACK_NOTIFICATION_COUNT = "backNotificationCount"; private static final String NOTIFY_ACTION_BACK = "com.android.quickstep.action.BACK_GESTURE"; private static final int MAX_BACK_NOTIFICATION_COUNT = 3; private int mBackGestureNotificationCounter = -1; private final IBinder mMyBinder = new IOverviewProxy.Stub() { public void onActiveNavBarRegionChanges(Region region) { Loading Loading @@ -205,6 +212,10 @@ public class TouchInteractionService extends Service implements mOverviewComponentObserver.getActivityControlHelper(); UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY, isButton, gestureSwipeLeft, activityControl.getContainerType()); if (completed && !isButton && shouldNotifyBackGesture()) { BACKGROUND_EXECUTOR.execute(TouchInteractionService.this::tryNotifyBackGesture); } } public void onSystemUiStateChanged(int stateFlags) { Loading Loading @@ -479,6 +490,8 @@ public class TouchInteractionService extends Service implements // Temporarily disable model preload // new ModelPreload().start(this); mBackGestureNotificationCounter = Math.max(0, Utilities.getDevicePrefs(this) .getInt(KEY_BACK_NOTIFICATION_COUNT, MAX_BACK_NOTIFICATION_COUNT)); Utilities.unregisterReceiverSafely(this, mUserUnlockedReceiver); } Loading Loading @@ -569,6 +582,7 @@ public class TouchInteractionService extends Service implements private boolean validSystemUiFlags() { return (mSystemUiStateFlags & SYSUI_STATE_NAV_BAR_HIDDEN) == 0 && (mSystemUiStateFlags & SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED) == 0 && (mSystemUiStateFlags & SYSUI_STATE_QUICK_SETTINGS_EXPANDED) == 0 && ((mSystemUiStateFlags & SYSUI_STATE_HOME_DISABLED) == 0 || (mSystemUiStateFlags & SYSUI_STATE_OVERVIEW_DISABLED) == 0); } Loading Loading @@ -864,6 +878,22 @@ public class TouchInteractionService extends Service implements mRecentsModel, mInputConsumer, isLikelyToStartNewTask, continuingLastGesture); } protected boolean shouldNotifyBackGesture() { return mBackGestureNotificationCounter > 0 && mGestureBlockingActivity != null; } @WorkerThread protected void tryNotifyBackGesture() { if (shouldNotifyBackGesture()) { mBackGestureNotificationCounter--; Utilities.getDevicePrefs(this).edit() .putInt(KEY_BACK_NOTIFICATION_COUNT, mBackGestureNotificationCounter).apply(); sendBroadcast(new Intent(NOTIFY_ACTION_BACK).setPackage( mGestureBlockingActivity.getPackageName())); } } public static void startRecentsActivityAsync(Intent intent, RecentsAnimationListener listener) { BACKGROUND_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance() .startRecentsActivity(intent, null, listener, null, null)); Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java +2 −1 Original line number Diff line number Diff line Loading @@ -1186,7 +1186,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> private void setupLauncherUiAfterSwipeUpToRecentsAnimation() { endLauncherTransitionController(); mActivityControlHelper.onSwipeUpToRecentsComplete(mActivity); mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true); mRecentsAnimationWrapper.setDeferCancelUntilNextTransition(true /* defer */, true /* screenshot */); mRecentsView.onSwipeUpAnimationSuccess(); RecentsModel.INSTANCE.get(mContext).onOverviewShown(false, TAG); Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/FallbackNoButtonInputConsumer.java +3 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import com.android.quickstep.fallback.FallbackRecentsView; import com.android.quickstep.util.ObjectWrapper; import com.android.quickstep.util.RectFSpringAnim; import com.android.quickstep.util.SwipeAnimationTargetSet; import com.android.quickstep.views.RecentsView; import com.android.quickstep.views.TaskView; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.ActivityManagerWrapper; Loading Loading @@ -335,7 +336,8 @@ public class FallbackNoButtonInputConsumer extends ThumbnailData thumbnail = mRecentsAnimationWrapper.targetSet.controller.screenshotTask(mRunningTaskId); mRecentsAnimationWrapper.setCancelWithDeferredScreenshot(true); mRecentsAnimationWrapper.setDeferCancelUntilNextTransition(true /* defer */, false /* screenshot */); ActivityOptions options = ActivityOptions.makeCustomAnimation(mContext, 0, 0); ActivityOptionsCompat.setFreezeRecentTasksList(options); Loading
quickstep/recents_ui_overrides/src/com/android/quickstep/util/RecentsAnimationListenerSet.java +5 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import android.util.ArraySet; import com.android.launcher3.Utilities; import com.android.launcher3.util.Preconditions; import com.android.quickstep.util.SwipeAnimationTargetSet.SwipeAnimationListener; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.RecentsAnimationControllerCompat; import com.android.systemui.shared.system.RecentsAnimationListener; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; Loading @@ -39,7 +40,7 @@ import androidx.annotation.UiThread; public class RecentsAnimationListenerSet implements RecentsAnimationListener { // The actual app surface is replaced by a screenshot upon recents animation cancelation when // deferredWithScreenshot is true. Launcher takes the responsibility to clean up this screenshot // the thumbnailData exists. Launcher takes the responsibility to clean up this screenshot // after app transition is finished. This delay is introduced to cover the app transition // period of time. private final int TRANSITION_DELAY = 100; Loading Loading @@ -90,14 +91,14 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener { } @Override public final void onAnimationCanceled(boolean deferredWithScreenshot) { public final void onAnimationCanceled(ThumbnailData thumbnailData) { Utilities.postAsyncCallback(MAIN_THREAD_EXECUTOR.getHandler(), () -> { for (SwipeAnimationListener listener : getListeners()) { listener.onRecentsAnimationCanceled(); } }); // TODO: handle the transition better instead of simply using a transition delay. if (deferredWithScreenshot) { if (thumbnailData != null) { MAIN_THREAD_EXECUTOR.getHandler().postDelayed(() -> mController.cleanupScreenshot(), TRANSITION_DELAY); } Loading @@ -109,6 +110,6 @@ public class RecentsAnimationListenerSet implements RecentsAnimationListener { public void cancelListener() { mCancelled = true; onAnimationCanceled(false); onAnimationCanceled(null); } }