diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 5b912ade65..097609f2d9 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -1161,7 +1161,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener new LauncherAnimationRunner(mHandler, mWallpaperOpenTransitionRunner, false /* startAtFrontOfQueue */), mLauncher.getIApplicationThread()); mLauncherOpenTransition.addHomeOpenCheck(mLauncher.getComponentName()); - SystemUiProxy.INSTANCE.getNoCreate().registerRemoteTransition(mLauncherOpenTransition); + SystemUiProxy.INSTANCE.get(mLauncher).registerRemoteTransition(mLauncherOpenTransition); } if (mBackAnimationController != null) { mBackAnimationController.registerBackCallbacks(mHandler); @@ -1172,7 +1172,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener unregisterRemoteAnimations(); unregisterRemoteTransitions(); mStartingWindowListener.setTransitionManager(null); - SystemUiProxy.INSTANCE.getNoCreate().setStartingWindowListener(null); + SystemUiProxy.INSTANCE.get(mLauncher).setStartingWindowListener(null); } private void unregisterRemoteAnimations() { @@ -1196,7 +1196,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener } if (hasControlRemoteAppTransitionPermission()) { if (mLauncherOpenTransition == null) return; - SystemUiProxy.INSTANCE.getNoCreate().unregisterRemoteTransition( + SystemUiProxy.INSTANCE.get(mLauncher).unregisterRemoteTransition( mLauncherOpenTransition); mLauncherOpenTransition = null; mWallpaperOpenTransitionRunner = null; diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 7ca76399a6..b073b90baf 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -770,7 +770,7 @@ public abstract class AbsSwipeUpHandler, // We will handle the sysui flags based on the centermost task view. mRecentsAnimationController.setUseLauncherSystemBarFlags(swipeUpThresholdPassed || (quickswitchThresholdPassed && centermostTaskFlags != 0)); - mRecentsAnimationController.setSplitScreenMinimized(swipeUpThresholdPassed); + mRecentsAnimationController.setSplitScreenMinimized(mContext, swipeUpThresholdPassed); // Provide a hint to WM the direction that we will be settling in case the animation // needs to be canceled mRecentsAnimationController.setWillFinishToHome(swipeUpThresholdPassed); diff --git a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java index cc79f4a1d8..921674a2d4 100644 --- a/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java +++ b/quickstep/src/com/android/quickstep/LauncherBackAnimationController.java @@ -29,7 +29,6 @@ import android.graphics.PointF; import android.graphics.Rect; import android.graphics.RectF; import android.os.Handler; -import android.util.Log; import android.util.MathUtils; import android.util.Pair; import android.view.RemoteAnimationTarget; @@ -55,7 +54,7 @@ import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat; * the app window and plays the rest of app close transitions in one go. * * This animation is used only for apps that enable back dispatching via - * {@link android.view.OnBackInvokedDispatcher}. The controller registers + * {@link android.window.OnBackInvokedDispatcher}. The controller registers * an {@link IOnBackInvokedCallback} with WM Shell and receives back dispatches when a back * navigation to launcher starts. * @@ -66,7 +65,6 @@ import com.android.systemui.shared.system.SyncRtSurfaceTransactionApplierCompat; public class LauncherBackAnimationController { private static final int CANCEL_TRANSITION_DURATION = 233; private static final float MIN_WINDOW_SCALE = 0.7f; - private static final String TAG = "LauncherBackAnimationController"; private final QuickstepTransitionManager mQuickstepTransitionManager; private final Matrix mTransformMatrix = new Matrix(); /** The window position at the beginning of the back animation. */ @@ -115,12 +113,7 @@ public class LauncherBackAnimationController { * @param handler Handler to the thread to run the animations on. */ public void registerBackCallbacks(Handler handler) { - SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.getNoCreate(); - if (systemUiProxy == null) { - Log.e(TAG, "SystemUiProxy is null. Skip registering back invocation callbacks"); - return; - } - systemUiProxy.setBackToLauncherCallback( + SystemUiProxy.INSTANCE.get(mLauncher).setBackToLauncherCallback( new IOnBackInvokedCallback.Stub() { @Override public void onBackCancelled() { @@ -170,10 +163,7 @@ public class LauncherBackAnimationController { /** Unregisters the back to launcher callback in shell. */ public void unregisterBackCallbacks() { - SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.getNoCreate(); - if (systemUiProxy != null) { - systemUiProxy.clearBackToLauncherCallback(); - } + SystemUiProxy.INSTANCE.get(mLauncher).clearBackToLauncherCallback(); } private void startBack(BackEvent backEvent) { @@ -298,10 +288,7 @@ public class LauncherBackAnimationController { mInitialTouchPos.set(0, 0); mAnimatorSetInProgress = false; mSpringAnimationInProgress = false; - SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.getNoCreate(); - if (systemUiProxy != null) { - SystemUiProxy.INSTANCE.getNoCreate().onBackToLauncherAnimationFinished(); - } + SystemUiProxy.INSTANCE.get(mLauncher).onBackToLauncherAnimationFinished(); } private void startTransitionAnimations(RectFSpringAnim springAnim, AnimatorSet anim) { diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationController.java b/quickstep/src/com/android/quickstep/RecentsAnimationController.java index c120b32543..2007ee1ebd 100644 --- a/quickstep/src/com/android/quickstep/RecentsAnimationController.java +++ b/quickstep/src/com/android/quickstep/RecentsAnimationController.java @@ -19,6 +19,7 @@ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.quickstep.TaskAnimationManager.ENABLE_SHELL_TRANSITIONS; +import android.content.Context; import android.os.RemoteException; import android.util.Log; import android.view.IRecentsAnimationController; @@ -97,24 +98,20 @@ public class RecentsAnimationController { * Indicates that the gesture has crossed the window boundary threshold and we should minimize * if we are in splitscreen. */ - public void setSplitScreenMinimized(boolean splitScreenMinimized) { + public void setSplitScreenMinimized(Context context, boolean splitScreenMinimized) { if (!mAllowMinimizeSplitScreen) { return; } if (mSplitScreenMinimized != splitScreenMinimized) { mSplitScreenMinimized = splitScreenMinimized; - UI_HELPER_EXECUTOR.execute(() -> { - SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate(); - if (p != null) { - p.setSplitScreenMinimized(splitScreenMinimized); - } - }); + UI_HELPER_EXECUTOR.execute(() -> SystemUiProxy.INSTANCE.get(context) + .setSplitScreenMinimized(splitScreenMinimized)); } } /** * Remove task remote animation target from - * {@link RecentsAnimationCallbacks#onTaskAppeared(RemoteAnimationTargetCompat)}}. + * {@link RecentsAnimationCallbacks#onTasksAppeared}}. */ @UiThread public void removeTaskTarget(@NonNull RemoteAnimationTargetCompat target) { diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java index b8334a9ae8..f094d712a1 100644 --- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java +++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java @@ -177,9 +177,8 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn ((RecentsActivity) activityInterface.getCreatedActivity()).startHome(); return; } - RemoteAnimationTarget[] nonAppTargets = - SystemUiProxy.INSTANCE.getNoCreate() - .onGoingToRecentsLegacy(false, nonHomeApps); + RemoteAnimationTarget[] nonAppTargets = SystemUiProxy.INSTANCE.get(mCtx) + .onGoingToRecentsLegacy(false, nonHomeApps); if (ENABLE_QUICKSTEP_LIVE_TILE.get() && activityInterface.isInLiveTileMode() && activityInterface.getCreatedActivity() != null) { diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 6f49989396..5f715f812f 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -4498,10 +4498,7 @@ public abstract class RecentsView