Loading core/java/android/view/IWindowManager.aidl +2 −1 Original line number Original line Diff line number Diff line Loading @@ -809,7 +809,8 @@ interface IWindowManager * Updates the currently animating insets types of a remote process. * Updates the currently animating insets types of a remote process. */ */ @EnforcePermission("MANAGE_APP_TOKENS") @EnforcePermission("MANAGE_APP_TOKENS") void updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes); void updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes, in @nullable ImeTracker.Token statsToken); /** /** * Called to get the expected window insets. * Called to get the expected window insets. Loading core/java/android/view/IWindowSession.aidl +3 −1 Original line number Original line Diff line number Diff line Loading @@ -277,8 +277,10 @@ interface IWindowSession { * * * @param window The window that is insets animaiton is running. * @param window The window that is insets animaiton is running. * @param animatingTypes Indicates the currently animating insets types. * @param animatingTypes Indicates the currently animating insets types. * @param imeStatsToken the token tracking the current IME request or {@code null} otherwise. */ */ oneway void updateAnimatingTypes(IWindow window, int animatingTypes); oneway void updateAnimatingTypes(IWindow window, int animatingTypes, in @nullable ImeTracker.Token imeStatsToken); /** /** * Called when the system gesture exclusion has changed. * Called when the system gesture exclusion has changed. Loading core/java/android/view/InsetsController.java +24 −6 Original line number Original line Diff line number Diff line Loading @@ -215,8 +215,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation * contain all types, which have an ongoing animation. * contain all types, which have an ongoing animation. * * * @param animatingTypes the {@link InsetsType}s that are currently animating * @param animatingTypes the {@link InsetsType}s that are currently animating * @param statsToken the token tracking the current IME request or {@code null} otherwise. */ */ default void updateAnimatingTypes(@InsetsType int animatingTypes) {} default void updateAnimatingTypes(@InsetsType int animatingTypes, @Nullable ImeTracker.Token statsToken) { } /** @see ViewRootImpl#isHandlingPointerEvent */ /** @see ViewRootImpl#isHandlingPointerEvent */ default boolean isHandlingPointerEvent() { default boolean isHandlingPointerEvent() { Loading Loading @@ -748,7 +751,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mFrame, mFromState, mToState, RESIZE_INTERPOLATOR, mFrame, mFromState, mToState, RESIZE_INTERPOLATOR, ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this); ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this); if (mRunningAnimations.isEmpty()) { if (mRunningAnimations.isEmpty()) { mHost.updateAnimatingTypes(runner.getTypes()); mHost.updateAnimatingTypes(runner.getTypes(), runner.getAnimationType() == ANIMATION_TYPE_HIDE ? runner.getStatsToken() : null); } } mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType())); mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType())); mAnimatingTypes |= runner.getTypes(); mAnimatingTypes |= runner.getTypes(); Loading Loading @@ -1421,6 +1426,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (DEBUG) Log.d(TAG, "no types to animate in controlAnimationUnchecked"); if (DEBUG) Log.d(TAG, "no types to animate in controlAnimationUnchecked"); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApi", 0); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApi", 0); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApiToImeReady", 0); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApiToImeReady", 0); ImeTracker.forLogging().onFailed(statsToken, ImeTracker.PHASE_CLIENT_CONTROL_ANIMATION); return; return; } } if (DEBUG) Log.d(TAG, "controlAnimation types: " + types); if (DEBUG) Log.d(TAG, "controlAnimation types: " + types); Loading Loading @@ -1569,7 +1575,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING); ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING); mAnimatingTypes |= runner.getTypes(); mAnimatingTypes |= runner.getTypes(); mHost.updateAnimatingTypes(mAnimatingTypes); mHost.updateAnimatingTypes(mAnimatingTypes, null /* statsToken */); mRunningAnimations.add(new RunningAnimation(runner, animationType)); mRunningAnimations.add(new RunningAnimation(runner, animationType)); if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: " if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: " + useInsetsAnimationThread); + useInsetsAnimationThread); Loading Loading @@ -1778,7 +1784,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation ImeTracker.forLogging().onHidden(statsToken); ImeTracker.forLogging().onHidden(statsToken); } } } } reportRequestedVisibleTypes(shown ? null : runner.getStatsToken()); reportRequestedVisibleTypes(null /* statsToken */); } } @Override @Override Loading Loading @@ -1835,7 +1841,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (mHost != null) { if (mHost != null) { // if the (hide) animation is cancelled, the // if the (hide) animation is cancelled, the // requestedVisibleTypes should be reported at this point. // requestedVisibleTypes should be reported at this point. reportRequestedVisibleTypes(control.getStatsToken()); reportRequestedVisibleTypes(!Flags.reportAnimatingInsetsTypes() ? control.getStatsToken() : null); mHost.getInputMethodManager().removeImeSurface( mHost.getInputMethodManager().removeImeSurface( mHost.getWindowToken()); mHost.getWindowToken()); } } Loading @@ -1847,7 +1854,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } if (removedTypes > 0) { if (removedTypes > 0) { mAnimatingTypes &= ~removedTypes; mAnimatingTypes &= ~removedTypes; mHost.updateAnimatingTypes(mAnimatingTypes); if (mHost != null) { final boolean dispatchStatsToken = Flags.reportAnimatingInsetsTypes() && (removedTypes & ime()) != 0 && control.getAnimationType() == ANIMATION_TYPE_HIDE; mHost.updateAnimatingTypes(mAnimatingTypes, dispatchStatsToken ? control.getStatsToken() : null); } } } onAnimationStateChanged(removedTypes, false /* running */); onAnimationStateChanged(removedTypes, false /* running */); Loading Loading @@ -2003,6 +2016,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (Flags.refactorInsetsController()) { if (Flags.refactorInsetsController()) { ImeTracker.forLogging().onProgress(statsToken, ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_REPORT_REQUESTED_VISIBLE_TYPES); ImeTracker.PHASE_CLIENT_REPORT_REQUESTED_VISIBLE_TYPES); if (Flags.reportAnimatingInsetsTypes() && (typesToReport & ime()) == 0) { // The IME hide animating flow should not be followed from here, but after // the hide animation has finished and Host.updateAnimatingTypes is called. statsToken = null; } } } mReportedRequestedVisibleTypes = mRequestedVisibleTypes; mReportedRequestedVisibleTypes = mRequestedVisibleTypes; mHost.updateRequestedVisibleTypes(mReportedRequestedVisibleTypes, statsToken); mHost.updateRequestedVisibleTypes(mReportedRequestedVisibleTypes, statsToken); Loading core/java/android/view/ViewRootImpl.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -2555,9 +2555,11 @@ public final class ViewRootImpl implements ViewParent, /** /** * Notify the when the animating insets types have changed. * Notify the when the animating insets types have changed. * * @hide */ */ @VisibleForTesting public void updateAnimatingTypes(@InsetsType int animatingTypes, public void updateAnimatingTypes(@InsetsType int animatingTypes) { @Nullable ImeTracker.Token statsToken) { if (sToolkitSetFrameRateReadOnlyFlagValue) { if (sToolkitSetFrameRateReadOnlyFlagValue) { boolean running = animatingTypes != 0; boolean running = animatingTypes != 0; if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) { Loading @@ -2567,7 +2569,7 @@ public final class ViewRootImpl implements ViewParent, } } mInsetsAnimationRunning = running; mInsetsAnimationRunning = running; try { try { mWindowSession.updateAnimatingTypes(mWindow, animatingTypes); mWindowSession.updateAnimatingTypes(mWindow, animatingTypes, statsToken); } catch (RemoteException e) { } catch (RemoteException e) { } } } } Loading core/java/android/view/ViewRootInsetsControllerHost.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -171,9 +171,15 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host { } } @Override @Override public void updateAnimatingTypes(@WindowInsets.Type.InsetsType int animatingTypes) { public void updateAnimatingTypes(@WindowInsets.Type.InsetsType int animatingTypes, @Nullable ImeTracker.Token statsToken) { if (mViewRoot != null) { if (mViewRoot != null) { mViewRoot.updateAnimatingTypes(animatingTypes); ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_UPDATE_ANIMATING_TYPES); mViewRoot.updateAnimatingTypes(animatingTypes, statsToken); } else { ImeTracker.forLogging().onFailed(statsToken, ImeTracker.PHASE_CLIENT_UPDATE_ANIMATING_TYPES); } } } } Loading Loading
core/java/android/view/IWindowManager.aidl +2 −1 Original line number Original line Diff line number Diff line Loading @@ -809,7 +809,8 @@ interface IWindowManager * Updates the currently animating insets types of a remote process. * Updates the currently animating insets types of a remote process. */ */ @EnforcePermission("MANAGE_APP_TOKENS") @EnforcePermission("MANAGE_APP_TOKENS") void updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes); void updateDisplayWindowAnimatingTypes(int displayId, int animatingTypes, in @nullable ImeTracker.Token statsToken); /** /** * Called to get the expected window insets. * Called to get the expected window insets. Loading
core/java/android/view/IWindowSession.aidl +3 −1 Original line number Original line Diff line number Diff line Loading @@ -277,8 +277,10 @@ interface IWindowSession { * * * @param window The window that is insets animaiton is running. * @param window The window that is insets animaiton is running. * @param animatingTypes Indicates the currently animating insets types. * @param animatingTypes Indicates the currently animating insets types. * @param imeStatsToken the token tracking the current IME request or {@code null} otherwise. */ */ oneway void updateAnimatingTypes(IWindow window, int animatingTypes); oneway void updateAnimatingTypes(IWindow window, int animatingTypes, in @nullable ImeTracker.Token imeStatsToken); /** /** * Called when the system gesture exclusion has changed. * Called when the system gesture exclusion has changed. Loading
core/java/android/view/InsetsController.java +24 −6 Original line number Original line Diff line number Diff line Loading @@ -215,8 +215,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation * contain all types, which have an ongoing animation. * contain all types, which have an ongoing animation. * * * @param animatingTypes the {@link InsetsType}s that are currently animating * @param animatingTypes the {@link InsetsType}s that are currently animating * @param statsToken the token tracking the current IME request or {@code null} otherwise. */ */ default void updateAnimatingTypes(@InsetsType int animatingTypes) {} default void updateAnimatingTypes(@InsetsType int animatingTypes, @Nullable ImeTracker.Token statsToken) { } /** @see ViewRootImpl#isHandlingPointerEvent */ /** @see ViewRootImpl#isHandlingPointerEvent */ default boolean isHandlingPointerEvent() { default boolean isHandlingPointerEvent() { Loading Loading @@ -748,7 +751,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mFrame, mFromState, mToState, RESIZE_INTERPOLATOR, mFrame, mFromState, mToState, RESIZE_INTERPOLATOR, ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this); ANIMATION_DURATION_RESIZE, mTypes, InsetsController.this); if (mRunningAnimations.isEmpty()) { if (mRunningAnimations.isEmpty()) { mHost.updateAnimatingTypes(runner.getTypes()); mHost.updateAnimatingTypes(runner.getTypes(), runner.getAnimationType() == ANIMATION_TYPE_HIDE ? runner.getStatsToken() : null); } } mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType())); mRunningAnimations.add(new RunningAnimation(runner, runner.getAnimationType())); mAnimatingTypes |= runner.getTypes(); mAnimatingTypes |= runner.getTypes(); Loading Loading @@ -1421,6 +1426,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (DEBUG) Log.d(TAG, "no types to animate in controlAnimationUnchecked"); if (DEBUG) Log.d(TAG, "no types to animate in controlAnimationUnchecked"); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApi", 0); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApi", 0); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApiToImeReady", 0); Trace.asyncTraceEnd(TRACE_TAG_VIEW, "IC.showRequestFromApiToImeReady", 0); ImeTracker.forLogging().onFailed(statsToken, ImeTracker.PHASE_CLIENT_CONTROL_ANIMATION); return; return; } } if (DEBUG) Log.d(TAG, "controlAnimation types: " + types); if (DEBUG) Log.d(TAG, "controlAnimation types: " + types); Loading Loading @@ -1569,7 +1575,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING); ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_ANIMATION_RUNNING); mAnimatingTypes |= runner.getTypes(); mAnimatingTypes |= runner.getTypes(); mHost.updateAnimatingTypes(mAnimatingTypes); mHost.updateAnimatingTypes(mAnimatingTypes, null /* statsToken */); mRunningAnimations.add(new RunningAnimation(runner, animationType)); mRunningAnimations.add(new RunningAnimation(runner, animationType)); if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: " if (DEBUG) Log.d(TAG, "Animation added to runner. useInsetsAnimationThread: " + useInsetsAnimationThread); + useInsetsAnimationThread); Loading Loading @@ -1778,7 +1784,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation ImeTracker.forLogging().onHidden(statsToken); ImeTracker.forLogging().onHidden(statsToken); } } } } reportRequestedVisibleTypes(shown ? null : runner.getStatsToken()); reportRequestedVisibleTypes(null /* statsToken */); } } @Override @Override Loading Loading @@ -1835,7 +1841,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (mHost != null) { if (mHost != null) { // if the (hide) animation is cancelled, the // if the (hide) animation is cancelled, the // requestedVisibleTypes should be reported at this point. // requestedVisibleTypes should be reported at this point. reportRequestedVisibleTypes(control.getStatsToken()); reportRequestedVisibleTypes(!Flags.reportAnimatingInsetsTypes() ? control.getStatsToken() : null); mHost.getInputMethodManager().removeImeSurface( mHost.getInputMethodManager().removeImeSurface( mHost.getWindowToken()); mHost.getWindowToken()); } } Loading @@ -1847,7 +1854,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } } if (removedTypes > 0) { if (removedTypes > 0) { mAnimatingTypes &= ~removedTypes; mAnimatingTypes &= ~removedTypes; mHost.updateAnimatingTypes(mAnimatingTypes); if (mHost != null) { final boolean dispatchStatsToken = Flags.reportAnimatingInsetsTypes() && (removedTypes & ime()) != 0 && control.getAnimationType() == ANIMATION_TYPE_HIDE; mHost.updateAnimatingTypes(mAnimatingTypes, dispatchStatsToken ? control.getStatsToken() : null); } } } onAnimationStateChanged(removedTypes, false /* running */); onAnimationStateChanged(removedTypes, false /* running */); Loading Loading @@ -2003,6 +2016,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (Flags.refactorInsetsController()) { if (Flags.refactorInsetsController()) { ImeTracker.forLogging().onProgress(statsToken, ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_REPORT_REQUESTED_VISIBLE_TYPES); ImeTracker.PHASE_CLIENT_REPORT_REQUESTED_VISIBLE_TYPES); if (Flags.reportAnimatingInsetsTypes() && (typesToReport & ime()) == 0) { // The IME hide animating flow should not be followed from here, but after // the hide animation has finished and Host.updateAnimatingTypes is called. statsToken = null; } } } mReportedRequestedVisibleTypes = mRequestedVisibleTypes; mReportedRequestedVisibleTypes = mRequestedVisibleTypes; mHost.updateRequestedVisibleTypes(mReportedRequestedVisibleTypes, statsToken); mHost.updateRequestedVisibleTypes(mReportedRequestedVisibleTypes, statsToken); Loading
core/java/android/view/ViewRootImpl.java +5 −3 Original line number Original line Diff line number Diff line Loading @@ -2555,9 +2555,11 @@ public final class ViewRootImpl implements ViewParent, /** /** * Notify the when the animating insets types have changed. * Notify the when the animating insets types have changed. * * @hide */ */ @VisibleForTesting public void updateAnimatingTypes(@InsetsType int animatingTypes, public void updateAnimatingTypes(@InsetsType int animatingTypes) { @Nullable ImeTracker.Token statsToken) { if (sToolkitSetFrameRateReadOnlyFlagValue) { if (sToolkitSetFrameRateReadOnlyFlagValue) { boolean running = animatingTypes != 0; boolean running = animatingTypes != 0; if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) { if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) { Loading @@ -2567,7 +2569,7 @@ public final class ViewRootImpl implements ViewParent, } } mInsetsAnimationRunning = running; mInsetsAnimationRunning = running; try { try { mWindowSession.updateAnimatingTypes(mWindow, animatingTypes); mWindowSession.updateAnimatingTypes(mWindow, animatingTypes, statsToken); } catch (RemoteException e) { } catch (RemoteException e) { } } } } Loading
core/java/android/view/ViewRootInsetsControllerHost.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -171,9 +171,15 @@ public class ViewRootInsetsControllerHost implements InsetsController.Host { } } @Override @Override public void updateAnimatingTypes(@WindowInsets.Type.InsetsType int animatingTypes) { public void updateAnimatingTypes(@WindowInsets.Type.InsetsType int animatingTypes, @Nullable ImeTracker.Token statsToken) { if (mViewRoot != null) { if (mViewRoot != null) { mViewRoot.updateAnimatingTypes(animatingTypes); ImeTracker.forLogging().onProgress(statsToken, ImeTracker.PHASE_CLIENT_UPDATE_ANIMATING_TYPES); mViewRoot.updateAnimatingTypes(animatingTypes, statsToken); } else { ImeTracker.forLogging().onFailed(statsToken, ImeTracker.PHASE_CLIENT_UPDATE_ANIMATING_TYPES); } } } } Loading