Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +105 −85 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import android.os.SystemClock; import android.util.Log; import android.view.MotionEvent; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; import android.view.View; import android.view.View.OnApplyWindowInsetsListener; import android.view.ViewGroup; Loading Loading @@ -179,7 +180,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, protected @Nullable RecentsAnimationController mRecentsAnimationController; protected @Nullable RecentsAnimationController mDeferredCleanupRecentsAnimationController; protected RecentsAnimationTargets mRecentsAnimationTargets; protected T mActivity; protected @Nullable T mActivity; protected @Nullable Q mRecentsView; protected Runnable mGestureEndCallback; protected MultiStateCallback mStateCallback; Loading Loading @@ -549,7 +550,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, private void onLauncherStart() { final T activity = mActivityInterface.getCreatedActivity(); if (mActivity != activity) { if (activity == null || mActivity != activity) { return; } if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) { Loading Loading @@ -922,6 +923,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // needs to be canceled mRecentsAnimationController.setWillFinishToHome(swipeUpThresholdPassed); if (mActivity == null) return; if (swipeUpThresholdPassed) { mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); } else { Loading Loading @@ -1497,7 +1499,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (mGestureState.getEndTarget().isLauncher) { // This is also called when the launcher is resumed, in order to clear the pending // widgets that have yet to be configured. if (mActivity != null) { DragView.removeAllViews(mActivity); } TaskStackChangeListeners.getInstance().registerTaskStackListener( mActivityRestartListener); Loading Loading @@ -1860,11 +1864,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } public void onConsumerAboutToBeSwitched() { if (mActivity != null) { // In the off chance that the gesture ends before Launcher is started, we should clear // the callback here so that it doesn't update with the wrong state resetLauncherListeners(); } if (mGestureState.isRecentsAnimationRunning() && mGestureState.getEndTarget() != null && !mGestureState.getEndTarget().isLauncher) { // Continued quick switch. Loading Loading @@ -1999,11 +2001,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, * continued quick switch gesture, which cancels the previous handler but doesn't invalidate it. */ private void resetLauncherListeners() { if (mActivity != null) { mActivity.removeEventCallback(EVENT_STARTED, mLauncherOnStartCallback); mActivity.removeEventCallback(EVENT_DESTROYED, mLauncherOnDestroyCallback); mActivity.getRootView().setOnApplyWindowInsetsListener(null); } if (mRecentsView != null) { mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener); } Loading Loading @@ -2039,10 +2042,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // Update the screenshot of the task if (shouldUpdate) { UI_HELPER_EXECUTOR.execute(() -> { if (mRecentsAnimationController == null) return; RecentsAnimationController recentsAnimationController = mRecentsAnimationController; if (recentsAnimationController == null) return; for (int id : runningTaskIds) { mTaskSnapshotCache.put( id, mRecentsAnimationController.screenshotTask(id)); id, recentsAnimationController.screenshotTask(id)); } MAIN_EXECUTOR.execute(() -> { Loading Loading @@ -2312,7 +2317,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } @Override public void onRecentsAnimationFinished(RecentsAnimationController controller) { public void onRecentsAnimationFinished(@NonNull RecentsAnimationController controller) { mRecentsAnimationController = null; mRecentsAnimationTargets = null; if (mRecentsView != null) { Loading @@ -2322,7 +2327,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, @Override public void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets) { if (mRecentsAnimationController != null) { if (mRecentsAnimationController == null) { return; } boolean hasStartedTaskBefore = Arrays.stream(appearedTaskTargets).anyMatch( mGestureState.mLastStartedTaskIdPredicate); if (!mStateCallback.hasStates(STATE_GESTURE_COMPLETED) && !hasStartedTaskBefore) { Loading @@ -2337,7 +2344,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, .append(" pkg=") .append(taskInfo.baseIntent.getComponent().getPackageName())); finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); } else if (handleTaskAppeared(appearedTaskTargets)) { return; } if (!handleTaskAppeared(appearedTaskTargets)) { return; } Optional<RemoteAnimationTarget> taskTargetOptional = Arrays.stream(appearedTaskTargets) .filter(mGestureState.mLastStartedTaskIdPredicate) Loading @@ -2355,10 +2366,21 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); return; } if (mActivity == null) { ActiveGestureLog.INSTANCE.addLog("Activity destroyed"); finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); return; } animateSplashScreenExit(mActivity, appearedTaskTargets, taskTarget.leash); } ViewGroup splashView = mActivity.getDragLayer(); final QuickstepLauncher quickstepLauncher = mActivity instanceof QuickstepLauncher ? (QuickstepLauncher) mActivity : null; private void animateSplashScreenExit( @NonNull T activity, @NonNull RemoteAnimationTarget[] appearedTaskTargets, @NonNull SurfaceControl leash) { ViewGroup splashView = activity.getDragLayer(); final QuickstepLauncher quickstepLauncher = activity instanceof QuickstepLauncher ? (QuickstepLauncher) activity : null; if (quickstepLauncher != null) { quickstepLauncher.getDepthController().pauseBlursOnWindows(true); } Loading @@ -2373,7 +2395,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } surfaceApplier.scheduleApply(transaction); SplashScreenExitAnimationUtils.startAnimations(splashView, taskTarget.leash, SplashScreenExitAnimationUtils.startAnimations(splashView, leash, mSplashMainWindowShiftLength, new TransactionPool(), new Rect(), SPLASH_ANIMATION_DURATION, SPLASH_FADE_OUT_DURATION, /* iconStartAlpha= */ 0, /* brandingStartAlpha= */ 0, Loading @@ -2394,8 +2416,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } }); } } } private void finishRecentsAnimationOnTasksAppeared(Runnable onFinishComplete) { if (mRecentsAnimationController != null) { Loading src/com/android/launcher3/dragndrop/DragView.java +2 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.dynamicanimation.animation.FloatPropertyCompat; import androidx.dynamicanimation.animation.SpringAnimation; Loading Loading @@ -614,7 +615,7 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram /** * Removes any stray DragView from the DragLayer. */ public static void removeAllViews(ActivityContext activity) { public static void removeAllViews(@NonNull ActivityContext activity) { BaseDragLayer dragLayer = activity.getDragLayer(); // Iterate in reverse order. DragView is added later to the dragLayer, // and will be one of the last views. Loading Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +105 −85 Original line number Diff line number Diff line Loading @@ -81,6 +81,7 @@ import android.os.SystemClock; import android.util.Log; import android.view.MotionEvent; import android.view.RemoteAnimationTarget; import android.view.SurfaceControl; import android.view.View; import android.view.View.OnApplyWindowInsetsListener; import android.view.ViewGroup; Loading Loading @@ -179,7 +180,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, protected @Nullable RecentsAnimationController mRecentsAnimationController; protected @Nullable RecentsAnimationController mDeferredCleanupRecentsAnimationController; protected RecentsAnimationTargets mRecentsAnimationTargets; protected T mActivity; protected @Nullable T mActivity; protected @Nullable Q mRecentsView; protected Runnable mGestureEndCallback; protected MultiStateCallback mStateCallback; Loading Loading @@ -549,7 +550,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, private void onLauncherStart() { final T activity = mActivityInterface.getCreatedActivity(); if (mActivity != activity) { if (activity == null || mActivity != activity) { return; } if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) { Loading Loading @@ -922,6 +923,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // needs to be canceled mRecentsAnimationController.setWillFinishToHome(swipeUpThresholdPassed); if (mActivity == null) return; if (swipeUpThresholdPassed) { mActivity.getSystemUiController().updateUiState(UI_STATE_FULLSCREEN_TASK, 0); } else { Loading Loading @@ -1497,7 +1499,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (mGestureState.getEndTarget().isLauncher) { // This is also called when the launcher is resumed, in order to clear the pending // widgets that have yet to be configured. if (mActivity != null) { DragView.removeAllViews(mActivity); } TaskStackChangeListeners.getInstance().registerTaskStackListener( mActivityRestartListener); Loading Loading @@ -1860,11 +1864,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } public void onConsumerAboutToBeSwitched() { if (mActivity != null) { // In the off chance that the gesture ends before Launcher is started, we should clear // the callback here so that it doesn't update with the wrong state resetLauncherListeners(); } if (mGestureState.isRecentsAnimationRunning() && mGestureState.getEndTarget() != null && !mGestureState.getEndTarget().isLauncher) { // Continued quick switch. Loading Loading @@ -1999,11 +2001,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, * continued quick switch gesture, which cancels the previous handler but doesn't invalidate it. */ private void resetLauncherListeners() { if (mActivity != null) { mActivity.removeEventCallback(EVENT_STARTED, mLauncherOnStartCallback); mActivity.removeEventCallback(EVENT_DESTROYED, mLauncherOnDestroyCallback); mActivity.getRootView().setOnApplyWindowInsetsListener(null); } if (mRecentsView != null) { mRecentsView.removeOnScrollChangedListener(mOnRecentsScrollListener); } Loading Loading @@ -2039,10 +2042,12 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // Update the screenshot of the task if (shouldUpdate) { UI_HELPER_EXECUTOR.execute(() -> { if (mRecentsAnimationController == null) return; RecentsAnimationController recentsAnimationController = mRecentsAnimationController; if (recentsAnimationController == null) return; for (int id : runningTaskIds) { mTaskSnapshotCache.put( id, mRecentsAnimationController.screenshotTask(id)); id, recentsAnimationController.screenshotTask(id)); } MAIN_EXECUTOR.execute(() -> { Loading Loading @@ -2312,7 +2317,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } @Override public void onRecentsAnimationFinished(RecentsAnimationController controller) { public void onRecentsAnimationFinished(@NonNull RecentsAnimationController controller) { mRecentsAnimationController = null; mRecentsAnimationTargets = null; if (mRecentsView != null) { Loading @@ -2322,7 +2327,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, @Override public void onTasksAppeared(@NonNull RemoteAnimationTarget[] appearedTaskTargets) { if (mRecentsAnimationController != null) { if (mRecentsAnimationController == null) { return; } boolean hasStartedTaskBefore = Arrays.stream(appearedTaskTargets).anyMatch( mGestureState.mLastStartedTaskIdPredicate); if (!mStateCallback.hasStates(STATE_GESTURE_COMPLETED) && !hasStartedTaskBefore) { Loading @@ -2337,7 +2344,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, .append(" pkg=") .append(taskInfo.baseIntent.getComponent().getPackageName())); finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); } else if (handleTaskAppeared(appearedTaskTargets)) { return; } if (!handleTaskAppeared(appearedTaskTargets)) { return; } Optional<RemoteAnimationTarget> taskTargetOptional = Arrays.stream(appearedTaskTargets) .filter(mGestureState.mLastStartedTaskIdPredicate) Loading @@ -2355,10 +2366,21 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); return; } if (mActivity == null) { ActiveGestureLog.INSTANCE.addLog("Activity destroyed"); finishRecentsAnimationOnTasksAppeared(null /* onFinishComplete */); return; } animateSplashScreenExit(mActivity, appearedTaskTargets, taskTarget.leash); } ViewGroup splashView = mActivity.getDragLayer(); final QuickstepLauncher quickstepLauncher = mActivity instanceof QuickstepLauncher ? (QuickstepLauncher) mActivity : null; private void animateSplashScreenExit( @NonNull T activity, @NonNull RemoteAnimationTarget[] appearedTaskTargets, @NonNull SurfaceControl leash) { ViewGroup splashView = activity.getDragLayer(); final QuickstepLauncher quickstepLauncher = activity instanceof QuickstepLauncher ? (QuickstepLauncher) activity : null; if (quickstepLauncher != null) { quickstepLauncher.getDepthController().pauseBlursOnWindows(true); } Loading @@ -2373,7 +2395,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } surfaceApplier.scheduleApply(transaction); SplashScreenExitAnimationUtils.startAnimations(splashView, taskTarget.leash, SplashScreenExitAnimationUtils.startAnimations(splashView, leash, mSplashMainWindowShiftLength, new TransactionPool(), new Rect(), SPLASH_ANIMATION_DURATION, SPLASH_FADE_OUT_DURATION, /* iconStartAlpha= */ 0, /* brandingStartAlpha= */ 0, Loading @@ -2394,8 +2416,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } }); } } } private void finishRecentsAnimationOnTasksAppeared(Runnable onFinishComplete) { if (mRecentsAnimationController != null) { Loading
src/com/android/launcher3/dragndrop/DragView.java +2 −1 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.dynamicanimation.animation.FloatPropertyCompat; import androidx.dynamicanimation.animation.SpringAnimation; Loading Loading @@ -614,7 +615,7 @@ public abstract class DragView<T extends Context & ActivityContext> extends Fram /** * Removes any stray DragView from the DragLayer. */ public static void removeAllViews(ActivityContext activity) { public static void removeAllViews(@NonNull ActivityContext activity) { BaseDragLayer dragLayer = activity.getDragLayer(); // Iterate in reverse order. DragView is added later to the dragLayer, // and will be one of the last views. Loading