Loading core/java/android/view/IWindowManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -788,6 +788,12 @@ interface IWindowManager void updateDisplayWindowRequestedVisibleTypes(int displayId, int visibleTypes, int mask, in @nullable ImeTracker.Token statsToken); /** * Updates the currently animating insets types of a remote process. */ @EnforcePermission("MANAGE_APP_TOKENS") void updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes); /** * Called to get the expected window insets. * Loading core/java/android/view/IWindowSession.aidl +9 −10 Original line number Diff line number Diff line Loading @@ -271,6 +271,15 @@ interface IWindowSession { oneway void updateRequestedVisibleTypes(IWindow window, int requestedVisibleTypes, in @nullable ImeTracker.Token imeStatsToken); /** * Notifies WindowState what insets types are currently running within the Window. * see {@link com.android.server.wm.WindowState#mInsetsAnimationRunning). * * @param window The window that is insets animaiton is running. * @param animatingTypes Indicates the currently animating insets types. */ oneway void updateAnimatingTypes(IWindow window, int animatingTypes); /** * Called when the system gesture exclusion has changed. */ Loading Loading @@ -372,14 +381,4 @@ interface IWindowSession { */ oneway void notifyImeWindowVisibilityChangedFromClient(IWindow window, boolean visible, in ImeTracker.Token statsToken); /** * Notifies WindowState whether inset animations are currently running within the Window. * This value is used by the server to vote for refresh rate. * see {@link com.android.server.wm.WindowState#mInsetsAnimationRunning). * * @param window The window that is insets animaiton is running. * @param running Indicates the insets animation state. */ oneway void notifyInsetsAnimationRunningStateChanged(IWindow window, boolean running); } core/java/android/view/InsetsController.java +17 −20 Original line number Diff line number Diff line Loading @@ -211,12 +211,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } /** * Notifies when the state of running animation is changed. The state is either "running" or * "idle". * Notifies when the insets types of running animation have changed. The animatingTypes * contain all types, which have an ongoing animation. * * @param running {@code true} if there is any animation running; {@code false} otherwise. * @param animatingTypes the {@link InsetsType}s that are currently animating */ default void notifyAnimationRunningStateChanged(boolean running) {} default void updateAnimatingTypes(@InsetsType int animatingTypes) {} /** @see ViewRootImpl#isHandlingPointerEvent */ default boolean isHandlingPointerEvent() { Loading Loading @@ -665,6 +665,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation /** Set of inset types which are requested visible which are reported to the host */ private @InsetsType int mReportedRequestedVisibleTypes = WindowInsets.Type.defaultVisible(); /** Set of insets types which are currently animating */ private @InsetsType int mAnimatingTypes = 0; /** Set of inset types that we have controls of */ private @InsetsType int mControllableTypes; Loading Loading @@ -745,9 +748,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mFrame, mFromState, mToState, RESIZE_INTERPOLATOR, ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this); if (mRunningAnimations.isEmpty()) { mHost.notifyAnimationRunningStateChanged(true); mHost.updateAnimatingTypes(runner.getTypes()); } mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType())); mAnimatingTypes |= runner.getTypes(); } }; Loading Loading @@ -1564,9 +1568,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING); if (mRunningAnimations.isEmpty()) { mHost.notifyAnimationRunningStateChanged(true); } mAnimatingTypes |= runner.getTypes(); mHost.updateAnimatingTypes(mAnimatingTypes); mRunningAnimations.add(new RunningAnimation(runner, animationType)); if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: " + useInsetsAnimationThread); Loading Loading @@ -1827,7 +1830,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation dispatchAnimationEnd(runningAnimation.runner.getAnimation()); } else { if (Flags.refactorInsetsController()) { if (removedTypes == ime() if ((removedTypes & ime()) != 0 && control.getAnimationType() == ANIMATION_TYPE_HIDE) { if (mHost != null) { // if the (hide) animation is cancelled, the Loading @@ -1842,9 +1845,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation break; } } if (mRunningAnimations.isEmpty()) { mHost.notifyAnimationRunningStateChanged(false); if (removedTypes > 0) { mAnimatingTypes &= ~removedTypes; mHost.updateAnimatingTypes(mAnimatingTypes); } onAnimationStateChanged(removedTypes, false /* running */); } Loading Loading @@ -1969,14 +1974,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation return animatingTypes; } private @InsetsType int computeAnimatingTypes() { int animatingTypes = 0; for (int i = 0; i < mRunningAnimations.size(); i++) { animatingTypes |= mRunningAnimations.get(i).runner.getTypes(); } return animatingTypes; } /** * Called when finishing setting requested visible types or finishing setting controls. * Loading @@ -1989,7 +1986,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation // report its requested visibility at the end of the animation, otherwise we would // lose the leash, and it would disappear during the animation // TODO(b/326377046) revisit this part and see if we can make it more general typesToReport = mRequestedVisibleTypes | (computeAnimatingTypes() & ime()); typesToReport = mRequestedVisibleTypes | (mAnimatingTypes & ime()); } else { typesToReport = mRequestedVisibleTypes; } Loading core/java/android/view/ViewRootImpl.java +4 −3 Original line number Diff line number Diff line Loading @@ -2540,11 +2540,12 @@ public final class ViewRootImpl implements ViewParent, } /** * Notify the when the running state of a insets animation changed. * Notify the when the animating insets types have changed. */ @VisibleForTesting public void notifyInsetsAnimationRunningStateChanged(boolean running) { public void updateAnimatingTypes(@InsetsType int animatingTypes) { if (sToolkitSetFrameRateReadOnlyFlagValue) { boolean running = animatingTypes != 0; if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) { Trace.instant(Trace.TRACE_TAG_VIEW, TextUtils.formatSimple("notifyInsetsAnimationRunningStateChanged(%s)", Loading @@ -2552,7 +2553,7 @@ public final class ViewRootImpl implements ViewParent, } mInsetsAnimationRunning = running; try { mWindowSession.notifyInsetsAnimationRunningStateChanged(mWindow, running); mWindowSession.updateAnimatingTypes(mWindow, animatingTypes); } catch (RemoteException e) { } } Loading core/java/android/view/ViewRootInsetsControllerHost.java +7 −7 Original line number Diff line number Diff line Loading @@ -170,6 +170,13 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host { } } @Override public void updateAnimatingTypes(@WindowInsets.Type.InsetsType int animatingTypes) { if (mViewRoot != null) { mViewRoot.updateAnimatingTypes(animatingTypes); } } @Override public boolean hasAnimationCallbacks() { if (mViewRoot.mView == null) { Loading Loading @@ -274,13 +281,6 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host { return null; } @Override public void notifyAnimationRunningStateChanged(boolean running) { if (mViewRoot != null) { mViewRoot.notifyInsetsAnimationRunningStateChanged(running); } } @Override public boolean isHandlingPointerEvent() { return mViewRoot != null && mViewRoot.isHandlingPointerEvent(); Loading Loading
core/java/android/view/IWindowManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -788,6 +788,12 @@ interface IWindowManager void updateDisplayWindowRequestedVisibleTypes(int displayId, int visibleTypes, int mask, in @nullable ImeTracker.Token statsToken); /** * Updates the currently animating insets types of a remote process. */ @EnforcePermission("MANAGE_APP_TOKENS") void updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes); /** * Called to get the expected window insets. * Loading
core/java/android/view/IWindowSession.aidl +9 −10 Original line number Diff line number Diff line Loading @@ -271,6 +271,15 @@ interface IWindowSession { oneway void updateRequestedVisibleTypes(IWindow window, int requestedVisibleTypes, in @nullable ImeTracker.Token imeStatsToken); /** * Notifies WindowState what insets types are currently running within the Window. * see {@link com.android.server.wm.WindowState#mInsetsAnimationRunning). * * @param window The window that is insets animaiton is running. * @param animatingTypes Indicates the currently animating insets types. */ oneway void updateAnimatingTypes(IWindow window, int animatingTypes); /** * Called when the system gesture exclusion has changed. */ Loading Loading @@ -372,14 +381,4 @@ interface IWindowSession { */ oneway void notifyImeWindowVisibilityChangedFromClient(IWindow window, boolean visible, in ImeTracker.Token statsToken); /** * Notifies WindowState whether inset animations are currently running within the Window. * This value is used by the server to vote for refresh rate. * see {@link com.android.server.wm.WindowState#mInsetsAnimationRunning). * * @param window The window that is insets animaiton is running. * @param running Indicates the insets animation state. */ oneway void notifyInsetsAnimationRunningStateChanged(IWindow window, boolean running); }
core/java/android/view/InsetsController.java +17 −20 Original line number Diff line number Diff line Loading @@ -211,12 +211,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } /** * Notifies when the state of running animation is changed. The state is either "running" or * "idle". * Notifies when the insets types of running animation have changed. The animatingTypes * contain all types, which have an ongoing animation. * * @param running {@code true} if there is any animation running; {@code false} otherwise. * @param animatingTypes the {@link InsetsType}s that are currently animating */ default void notifyAnimationRunningStateChanged(boolean running) {} default void updateAnimatingTypes(@InsetsType int animatingTypes) {} /** @see ViewRootImpl#isHandlingPointerEvent */ default boolean isHandlingPointerEvent() { Loading Loading @@ -665,6 +665,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation /** Set of inset types which are requested visible which are reported to the host */ private @InsetsType int mReportedRequestedVisibleTypes = WindowInsets.Type.defaultVisible(); /** Set of insets types which are currently animating */ private @InsetsType int mAnimatingTypes = 0; /** Set of inset types that we have controls of */ private @InsetsType int mControllableTypes; Loading Loading @@ -745,9 +748,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mFrame, mFromState, mToState, RESIZE_INTERPOLATOR, ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this); if (mRunningAnimations.isEmpty()) { mHost.notifyAnimationRunningStateChanged(true); mHost.updateAnimatingTypes(runner.getTypes()); } mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType())); mAnimatingTypes |= runner.getTypes(); } }; Loading Loading @@ -1564,9 +1568,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING); if (mRunningAnimations.isEmpty()) { mHost.notifyAnimationRunningStateChanged(true); } mAnimatingTypes |= runner.getTypes(); mHost.updateAnimatingTypes(mAnimatingTypes); mRunningAnimations.add(new RunningAnimation(runner, animationType)); if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: " + useInsetsAnimationThread); Loading Loading @@ -1827,7 +1830,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation dispatchAnimationEnd(runningAnimation.runner.getAnimation()); } else { if (Flags.refactorInsetsController()) { if (removedTypes == ime() if ((removedTypes & ime()) != 0 && control.getAnimationType() == ANIMATION_TYPE_HIDE) { if (mHost != null) { // if the (hide) animation is cancelled, the Loading @@ -1842,9 +1845,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation break; } } if (mRunningAnimations.isEmpty()) { mHost.notifyAnimationRunningStateChanged(false); if (removedTypes > 0) { mAnimatingTypes &= ~removedTypes; mHost.updateAnimatingTypes(mAnimatingTypes); } onAnimationStateChanged(removedTypes, false /* running */); } Loading Loading @@ -1969,14 +1974,6 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation return animatingTypes; } private @InsetsType int computeAnimatingTypes() { int animatingTypes = 0; for (int i = 0; i < mRunningAnimations.size(); i++) { animatingTypes |= mRunningAnimations.get(i).runner.getTypes(); } return animatingTypes; } /** * Called when finishing setting requested visible types or finishing setting controls. * Loading @@ -1989,7 +1986,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation // report its requested visibility at the end of the animation, otherwise we would // lose the leash, and it would disappear during the animation // TODO(b/326377046) revisit this part and see if we can make it more general typesToReport = mRequestedVisibleTypes | (computeAnimatingTypes() & ime()); typesToReport = mRequestedVisibleTypes | (mAnimatingTypes & ime()); } else { typesToReport = mRequestedVisibleTypes; } Loading
core/java/android/view/ViewRootImpl.java +4 −3 Original line number Diff line number Diff line Loading @@ -2540,11 +2540,12 @@ public final class ViewRootImpl implements ViewParent, } /** * Notify the when the running state of a insets animation changed. * Notify the when the animating insets types have changed. */ @VisibleForTesting public void notifyInsetsAnimationRunningStateChanged(boolean running) { public void updateAnimatingTypes(@InsetsType int animatingTypes) { if (sToolkitSetFrameRateReadOnlyFlagValue) { boolean running = animatingTypes != 0; if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) { Trace.instant(Trace.TRACE_TAG_VIEW, TextUtils.formatSimple("notifyInsetsAnimationRunningStateChanged(%s)", Loading @@ -2552,7 +2553,7 @@ public final class ViewRootImpl implements ViewParent, } mInsetsAnimationRunning = running; try { mWindowSession.notifyInsetsAnimationRunningStateChanged(mWindow, running); mWindowSession.updateAnimatingTypes(mWindow, animatingTypes); } catch (RemoteException e) { } } Loading
core/java/android/view/ViewRootInsetsControllerHost.java +7 −7 Original line number Diff line number Diff line Loading @@ -170,6 +170,13 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host { } } @Override public void updateAnimatingTypes(@WindowInsets.Type.InsetsType int animatingTypes) { if (mViewRoot != null) { mViewRoot.updateAnimatingTypes(animatingTypes); } } @Override public boolean hasAnimationCallbacks() { if (mViewRoot.mView == null) { Loading Loading @@ -274,13 +281,6 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host { return null; } @Override public void notifyAnimationRunningStateChanged(boolean running) { if (mViewRoot != null) { mViewRoot.notifyInsetsAnimationRunningStateChanged(running); } } @Override public boolean isHandlingPointerEvent() { return mViewRoot != null && mViewRoot.isHandlingPointerEvent(); Loading