Loading libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +8 −13 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont /** Tracks if we should start the back gesture on the next motion move event */ private boolean mShouldStartOnNextMoveEvent = false; private boolean mOnBackStartDispatched = false; private boolean mPointerPilfered = false; private final FlingAnimationUtils mFlingAnimationUtils; Loading Loading @@ -404,11 +405,12 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @VisibleForTesting void onPilferPointers() { mPointerPilfered = true; // Dispatch onBackStarted, only to app callbacks. // System callbacks will receive onBackStarted when the remote animation starts. if (!shouldDispatchToAnimator() && mActiveCallback != null) { mCurrentTracker.updateStartLocation(); tryDispatchAppOnBackStarted(mActiveCallback, mCurrentTracker.createStartEvent(null)); tryDispatchOnBackStarted(mActiveCallback, mCurrentTracker.createStartEvent(null)); } } Loading Loading @@ -511,7 +513,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mActiveCallback = mBackNavigationInfo.getOnBackInvokedCallback(); // App is handling back animation. Cancel system animation latency tracking. cancelLatencyTracking(); tryDispatchAppOnBackStarted(mActiveCallback, touchTracker.createStartEvent(null)); tryDispatchOnBackStarted(mActiveCallback, touchTracker.createStartEvent(null)); } } Loading Loading @@ -555,14 +557,13 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont && mBackNavigationInfo.isPrepareRemoteAnimation(); } private void tryDispatchAppOnBackStarted( private void tryDispatchOnBackStarted( IOnBackInvokedCallback callback, BackMotionEvent backEvent) { if (mOnBackStartDispatched && callback != null) { if (mOnBackStartDispatched || callback == null || !mPointerPilfered) { return; } dispatchOnBackStarted(callback, backEvent); mOnBackStartDispatched = true; } private void dispatchOnBackStarted( Loading @@ -573,6 +574,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont } try { callback.onBackStarted(backEvent); mOnBackStartDispatched = true; } catch (RemoteException e) { Log.e(TAG, "dispatchOnBackStarted error: ", e); } Loading Loading @@ -872,6 +874,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mActiveCallback = null; mShouldStartOnNextMoveEvent = false; mOnBackStartDispatched = false; mPointerPilfered = false; mShellBackAnimationRegistry.resetDefaultCrossActivity(); cancelLatencyTracking(); if (mBackNavigationInfo != null) { Loading Loading @@ -957,15 +960,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mCurrentTracker.updateStartLocation(); BackMotionEvent startEvent = mCurrentTracker.createStartEvent(apps[0]); // {@code mActiveCallback} is the callback from // the BackAnimationRunners and not a real app-side // callback. We also dispatch to the app-side callback // (which should be a system callback with PRIORITY_SYSTEM) // to keep consistent with app registered callbacks. dispatchOnBackStarted(mActiveCallback, startEvent); tryDispatchAppOnBackStarted( mBackNavigationInfo.getOnBackInvokedCallback(), startEvent); } // Dispatch the first progress after animation start for Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/back/BackAnimationController.java +8 −13 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont /** Tracks if we should start the back gesture on the next motion move event */ private boolean mShouldStartOnNextMoveEvent = false; private boolean mOnBackStartDispatched = false; private boolean mPointerPilfered = false; private final FlingAnimationUtils mFlingAnimationUtils; Loading Loading @@ -404,11 +405,12 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont @VisibleForTesting void onPilferPointers() { mPointerPilfered = true; // Dispatch onBackStarted, only to app callbacks. // System callbacks will receive onBackStarted when the remote animation starts. if (!shouldDispatchToAnimator() && mActiveCallback != null) { mCurrentTracker.updateStartLocation(); tryDispatchAppOnBackStarted(mActiveCallback, mCurrentTracker.createStartEvent(null)); tryDispatchOnBackStarted(mActiveCallback, mCurrentTracker.createStartEvent(null)); } } Loading Loading @@ -511,7 +513,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mActiveCallback = mBackNavigationInfo.getOnBackInvokedCallback(); // App is handling back animation. Cancel system animation latency tracking. cancelLatencyTracking(); tryDispatchAppOnBackStarted(mActiveCallback, touchTracker.createStartEvent(null)); tryDispatchOnBackStarted(mActiveCallback, touchTracker.createStartEvent(null)); } } Loading Loading @@ -555,14 +557,13 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont && mBackNavigationInfo.isPrepareRemoteAnimation(); } private void tryDispatchAppOnBackStarted( private void tryDispatchOnBackStarted( IOnBackInvokedCallback callback, BackMotionEvent backEvent) { if (mOnBackStartDispatched && callback != null) { if (mOnBackStartDispatched || callback == null || !mPointerPilfered) { return; } dispatchOnBackStarted(callback, backEvent); mOnBackStartDispatched = true; } private void dispatchOnBackStarted( Loading @@ -573,6 +574,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont } try { callback.onBackStarted(backEvent); mOnBackStartDispatched = true; } catch (RemoteException e) { Log.e(TAG, "dispatchOnBackStarted error: ", e); } Loading Loading @@ -872,6 +874,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mActiveCallback = null; mShouldStartOnNextMoveEvent = false; mOnBackStartDispatched = false; mPointerPilfered = false; mShellBackAnimationRegistry.resetDefaultCrossActivity(); cancelLatencyTracking(); if (mBackNavigationInfo != null) { Loading Loading @@ -957,15 +960,7 @@ public class BackAnimationController implements RemoteCallable<BackAnimationCont mCurrentTracker.updateStartLocation(); BackMotionEvent startEvent = mCurrentTracker.createStartEvent(apps[0]); // {@code mActiveCallback} is the callback from // the BackAnimationRunners and not a real app-side // callback. We also dispatch to the app-side callback // (which should be a system callback with PRIORITY_SYSTEM) // to keep consistent with app registered callbacks. dispatchOnBackStarted(mActiveCallback, startEvent); tryDispatchAppOnBackStarted( mBackNavigationInfo.getOnBackInvokedCallback(), startEvent); } // Dispatch the first progress after animation start for Loading