Merge "Fixing potential NullPointer exceptions when Launcher is created before TouchInteractionService is initialized" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d880a4fa63
@@ -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;
|
||||
|
||||
@@ -770,7 +770,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
||||
// 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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -4498,10 +4498,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
// Reset the minimized state since we force-toggled the minimized state when entering
|
||||
// overview, but never actually finished the recents animation. This is a catch all for
|
||||
// cases where we haven't already reset it.
|
||||
SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
|
||||
if (p != null) {
|
||||
p.setSplitScreenMinimized(false);
|
||||
}
|
||||
SystemUiProxy.INSTANCE.get(getContext()).setSplitScreenMinimized(false);
|
||||
}
|
||||
|
||||
if (mRecentsAnimationController == null) {
|
||||
|
||||
@@ -20,7 +20,6 @@ import static android.view.Display.DEFAULT_DISPLAY;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
|
||||
import static com.android.launcher3.AbstractFloatingView.TYPE_TASK_MENU;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
||||
import static com.android.launcher3.Utilities.comp;
|
||||
import static com.android.launcher3.Utilities.getDescendantCoordRelativeToAncestor;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||
@@ -628,10 +627,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
|
||||
// Reset the minimized state since we force-toggled the minimized state when entering
|
||||
// overview, but never actually finished the recents animation
|
||||
SystemUiProxy p = SystemUiProxy.INSTANCE.getNoCreate();
|
||||
if (p != null) {
|
||||
p.setSplitScreenMinimized(false);
|
||||
}
|
||||
SystemUiProxy.INSTANCE.get(getContext()).setSplitScreenMinimized(false);
|
||||
|
||||
mIsClickableAsLiveTile = false;
|
||||
RemoteAnimationTargets targets;
|
||||
|
||||
Reference in New Issue
Block a user