Loading core/java/android/view/InsetsAnimationControlImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro private boolean mReadyDispatched; private Boolean mPerceptible; @VisibleForTesting @VisibleForTesting(visibility = PACKAGE) public InsetsAnimationControlImpl(SparseArray<InsetsSourceControl> controls, @Nullable Rect frame, InsetsState state, WindowInsetsAnimationControlListener listener, @InsetsType int types, InsetsAnimationControlCallbacks controller, Loading core/java/android/view/InsetsController.java +44 −38 Original line number Diff line number Diff line Loading @@ -161,14 +161,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation /** * If this host is a view hierarchy, adds a pre-draw runnable to ensure proper ordering as * described in {@link WindowInsetsAnimation.Callback#onPrepare}. * * If this host isn't a view hierarchy, the runnable can be executed immediately. * described in {@link WindowInsetsAnimation.Callback#onPrepare}. If this host isn't a * view hierarchy, the runnable can be executed immediately. */ void addOnPreDrawRunnable(Runnable r); /** * Adds a runnbale to be executed during {@link Choreographer#CALLBACK_INSETS_ANIMATION} * Adds a runnable to be executed during {@link Choreographer#CALLBACK_INSETS_ANIMATION} * phase. */ void postInsetsAnimationCallback(Runnable r); Loading Loading @@ -333,7 +332,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation /** * Translation animation evaluator. */ private static TypeEvaluator<Insets> sEvaluator = (fraction, startValue, endValue) -> Insets.of( private static final TypeEvaluator<Insets> sEvaluator = (fraction, startValue, endValue) -> Insets.of( (int) (startValue.left + fraction * (endValue.left - startValue.left)), (int) (startValue.top + fraction * (endValue.top - startValue.top)), (int) (startValue.right + fraction * (endValue.right - startValue.right)), Loading @@ -346,7 +346,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private final InputMethodJankContext mJankContext = new InputMethodJankContext() { @Override public Context getDisplayContext() { return mHost != null ? mHost.getRootViewContext() : null; return mHost.getRootViewContext(); } @Override Loading @@ -357,7 +357,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public String getHostPackageName() { return mHost != null ? mHost.getRootViewContext().getPackageName() : null; return mHost.getRootViewContext().getPackageName(); } }; Loading Loading @@ -394,7 +394,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @Override public void onReady(WindowInsetsAnimationController controller, int types) { public void onReady(@NonNull WindowInsetsAnimationController controller, int types) { mController = controller; if (DEBUG) Log.d(TAG, "default animation onReady types: " + types); if (mLoggingListener != null) { Loading Loading @@ -464,7 +464,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @Override public void onFinished(WindowInsetsAnimationController controller) { public void onFinished(@NonNull WindowInsetsAnimationController controller) { if (DEBUG) Log.d(TAG, "InternalAnimationControlListener onFinished types:" + Type.toString(mRequestedTypes)); if (mLoggingListener != null) { Loading Loading @@ -615,11 +615,15 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private final InsetsState mLastDispatchedState = new InsetsState(); private final Rect mFrame = new Rect(); @NonNull private final TriFunction<InsetsController, Integer, Integer, InsetsSourceConsumer> mConsumerCreator; private final SparseArray<InsetsSourceConsumer> mSourceConsumers = new SparseArray<>(); @NonNull private final InsetsSourceConsumer mImeSourceConsumer; @NonNull private final Host mHost; @NonNull private final Handler mHandler; private final SparseArray<InsetsSourceControl> mTmpControlArray = new SparseArray<>(); Loading @@ -628,6 +632,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private boolean mAnimCallbackScheduled; @NonNull private final Runnable mAnimCallback; /** Pending control request that is waiting on IME to be ready to be shown */ Loading Loading @@ -760,7 +765,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } }; public InsetsController(Host host) { public InsetsController(@NonNull Host host) { this(host, (controller, id, type) -> { if (!Flags.refactorInsetsController() && type == ime()) { return new ImeInsetsSourceConsumer(id, controller.mState, controller); Loading @@ -771,9 +776,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @VisibleForTesting public InsetsController(Host host, TriFunction<InsetsController, Integer, Integer, InsetsSourceConsumer> consumerCreator, Handler handler) { public InsetsController(@NonNull Host host, @NonNull TriFunction<InsetsController, Integer, Integer, InsetsSourceConsumer> consumerCreator, @NonNull Handler handler) { mHost = host; mConsumerCreator = consumerCreator; mHandler = handler; Loading Loading @@ -840,6 +846,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @Override @NonNull public InsetsState getState() { return mState; } Loading @@ -849,6 +856,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation return mRequestedVisibleTypes; } @NonNull public InsetsState getLastDispatchedState() { return mLastDispatchedState; } Loading Loading @@ -1738,7 +1746,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } private void cancelExistingControllers(@InsetsType int types) { final int originalmTypesBeingCancelled = mTypesBeingCancelled; final int originalTypesBeingCancelled = mTypesBeingCancelled; mTypesBeingCancelled |= types; try { for (int i = mRunningAnimations.size() - 1; i >= 0; i--) { Loading @@ -1751,7 +1759,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation abortPendingImeControlRequest(); } } finally { mTypesBeingCancelled = originalmTypesBeingCancelled; mTypesBeingCancelled = originalTypesBeingCancelled; } } Loading Loading @@ -1845,14 +1853,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (Flags.refactorInsetsController()) { if ((removedTypes & ime()) != 0 && runner.getAnimationType() == ANIMATION_TYPE_HIDE) { if (mHost != null) { // if the (hide) animation is cancelled, the // requestedVisibleTypes should be reported at this point. // if the (hide) animation is cancelled, the requestedVisibleTypes // should be reported at this point. reportRequestedVisibleTypes(!Flags.reportAnimatingInsetsTypes() ? runner.getStatsToken() : null); mHost.getInputMethodManager().removeImeSurface( mHost.getWindowToken()); } mHost.getInputMethodManager().removeImeSurface(mHost.getWindowToken()); } } } Loading @@ -1861,14 +1866,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } if (removedTypes > 0) { mAnimatingTypes &= ~removedTypes; if (mHost != null) { final boolean dispatchStatsToken = Flags.reportAnimatingInsetsTypes() && (removedTypes & ime()) != 0 && runner.getAnimationType() == ANIMATION_TYPE_HIDE; mHost.updateAnimatingTypes(mAnimatingTypes, dispatchStatsToken ? runner.getStatsToken() : null); } } onAnimationStateChanged(removedTypes, false /* running */); } Loading Loading @@ -1903,6 +1906,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (consumer != null) { return consumer; } // ImeSourceConsumer is created using getSourceConsumer, so it is initially null here. if (type == ime() && mImeSourceConsumer != null) { // WindowInsets.Type.ime() should be only provided by one source. mSourceConsumers.remove(mImeSourceConsumer.getId()); Loading @@ -1916,7 +1920,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @VisibleForTesting public @NonNull InsetsSourceConsumer getImeSourceConsumer() { @NonNull public InsetsSourceConsumer getImeSourceConsumer() { return mImeSourceConsumer; } Loading Loading @@ -2048,7 +2053,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mReportedRequestedVisibleTypes = mRequestedVisibleTypes; mHost.updateRequestedVisibleTypes(mReportedRequestedVisibleTypes, statsToken); } else if (Flags.refactorInsetsController()) { if ((typesToReport & ime()) != 0 && mImeSourceConsumer != null) { if ((typesToReport & ime()) != 0) { InsetsSourceControl control = mImeSourceConsumer.getControl(); if (control == null || control.getLeash() == null) { // If the IME was requested to show twice, and we didn't receive the controls Loading Loading @@ -2293,7 +2298,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public void addOnControllableInsetsChangedListener( OnControllableInsetsChangedListener listener) { @NonNull OnControllableInsetsChangedListener listener) { Objects.requireNonNull(listener); mControllableInsetsChangedListeners.add(listener); listener.onControllableInsetsChanged(this, calculateControllableTypes()); Loading @@ -2301,7 +2306,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public void removeOnControllableInsetsChangedListener( OnControllableInsetsChangedListener listener) { @NonNull OnControllableInsetsChangedListener listener) { Objects.requireNonNull(listener); mControllableInsetsChangedListeners.remove(listener); } Loading @@ -2323,6 +2328,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @VisibleForTesting(visibility = PACKAGE) @NonNull public Host getHost() { return mHost; } Loading core/java/android/view/InsetsState.java +1 −1 Original line number Diff line number Diff line Loading @@ -715,7 +715,7 @@ public class InsetsState implements Parcelable { * not visible. * @return {@code true} if the two InsetsState objects are equal, {@code false} otherwise. */ @VisibleForTesting @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public boolean equals(@Nullable Object o, boolean excludesCaptionBar, boolean excludesInvisibleIme) { if (this == o) { return true; } Loading core/java/android/view/PendingInsetsController.java +1 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public class PendingInsetsController implements WindowInsetsController { } @Override @NonNull public InsetsState getState() { return mDummyState; } Loading core/java/android/view/WindowInsetsController.java +1 −0 Original line number Diff line number Diff line Loading @@ -322,6 +322,7 @@ public interface WindowInsetsController { /** * @hide */ @NonNull InsetsState getState(); /** Loading Loading
core/java/android/view/InsetsAnimationControlImpl.java +1 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro private boolean mReadyDispatched; private Boolean mPerceptible; @VisibleForTesting @VisibleForTesting(visibility = PACKAGE) public InsetsAnimationControlImpl(SparseArray<InsetsSourceControl> controls, @Nullable Rect frame, InsetsState state, WindowInsetsAnimationControlListener listener, @InsetsType int types, InsetsAnimationControlCallbacks controller, Loading
core/java/android/view/InsetsController.java +44 −38 Original line number Diff line number Diff line Loading @@ -161,14 +161,13 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation /** * If this host is a view hierarchy, adds a pre-draw runnable to ensure proper ordering as * described in {@link WindowInsetsAnimation.Callback#onPrepare}. * * If this host isn't a view hierarchy, the runnable can be executed immediately. * described in {@link WindowInsetsAnimation.Callback#onPrepare}. If this host isn't a * view hierarchy, the runnable can be executed immediately. */ void addOnPreDrawRunnable(Runnable r); /** * Adds a runnbale to be executed during {@link Choreographer#CALLBACK_INSETS_ANIMATION} * Adds a runnable to be executed during {@link Choreographer#CALLBACK_INSETS_ANIMATION} * phase. */ void postInsetsAnimationCallback(Runnable r); Loading Loading @@ -333,7 +332,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation /** * Translation animation evaluator. */ private static TypeEvaluator<Insets> sEvaluator = (fraction, startValue, endValue) -> Insets.of( private static final TypeEvaluator<Insets> sEvaluator = (fraction, startValue, endValue) -> Insets.of( (int) (startValue.left + fraction * (endValue.left - startValue.left)), (int) (startValue.top + fraction * (endValue.top - startValue.top)), (int) (startValue.right + fraction * (endValue.right - startValue.right)), Loading @@ -346,7 +346,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private final InputMethodJankContext mJankContext = new InputMethodJankContext() { @Override public Context getDisplayContext() { return mHost != null ? mHost.getRootViewContext() : null; return mHost.getRootViewContext(); } @Override Loading @@ -357,7 +357,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public String getHostPackageName() { return mHost != null ? mHost.getRootViewContext().getPackageName() : null; return mHost.getRootViewContext().getPackageName(); } }; Loading Loading @@ -394,7 +394,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @Override public void onReady(WindowInsetsAnimationController controller, int types) { public void onReady(@NonNull WindowInsetsAnimationController controller, int types) { mController = controller; if (DEBUG) Log.d(TAG, "default animation onReady types: " + types); if (mLoggingListener != null) { Loading Loading @@ -464,7 +464,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @Override public void onFinished(WindowInsetsAnimationController controller) { public void onFinished(@NonNull WindowInsetsAnimationController controller) { if (DEBUG) Log.d(TAG, "InternalAnimationControlListener onFinished types:" + Type.toString(mRequestedTypes)); if (mLoggingListener != null) { Loading Loading @@ -615,11 +615,15 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private final InsetsState mLastDispatchedState = new InsetsState(); private final Rect mFrame = new Rect(); @NonNull private final TriFunction<InsetsController, Integer, Integer, InsetsSourceConsumer> mConsumerCreator; private final SparseArray<InsetsSourceConsumer> mSourceConsumers = new SparseArray<>(); @NonNull private final InsetsSourceConsumer mImeSourceConsumer; @NonNull private final Host mHost; @NonNull private final Handler mHandler; private final SparseArray<InsetsSourceControl> mTmpControlArray = new SparseArray<>(); Loading @@ -628,6 +632,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation private boolean mAnimCallbackScheduled; @NonNull private final Runnable mAnimCallback; /** Pending control request that is waiting on IME to be ready to be shown */ Loading Loading @@ -760,7 +765,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } }; public InsetsController(Host host) { public InsetsController(@NonNull Host host) { this(host, (controller, id, type) -> { if (!Flags.refactorInsetsController() && type == ime()) { return new ImeInsetsSourceConsumer(id, controller.mState, controller); Loading @@ -771,9 +776,10 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @VisibleForTesting public InsetsController(Host host, TriFunction<InsetsController, Integer, Integer, InsetsSourceConsumer> consumerCreator, Handler handler) { public InsetsController(@NonNull Host host, @NonNull TriFunction<InsetsController, Integer, Integer, InsetsSourceConsumer> consumerCreator, @NonNull Handler handler) { mHost = host; mConsumerCreator = consumerCreator; mHandler = handler; Loading Loading @@ -840,6 +846,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @Override @NonNull public InsetsState getState() { return mState; } Loading @@ -849,6 +856,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation return mRequestedVisibleTypes; } @NonNull public InsetsState getLastDispatchedState() { return mLastDispatchedState; } Loading Loading @@ -1738,7 +1746,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } private void cancelExistingControllers(@InsetsType int types) { final int originalmTypesBeingCancelled = mTypesBeingCancelled; final int originalTypesBeingCancelled = mTypesBeingCancelled; mTypesBeingCancelled |= types; try { for (int i = mRunningAnimations.size() - 1; i >= 0; i--) { Loading @@ -1751,7 +1759,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation abortPendingImeControlRequest(); } } finally { mTypesBeingCancelled = originalmTypesBeingCancelled; mTypesBeingCancelled = originalTypesBeingCancelled; } } Loading Loading @@ -1845,14 +1853,11 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (Flags.refactorInsetsController()) { if ((removedTypes & ime()) != 0 && runner.getAnimationType() == ANIMATION_TYPE_HIDE) { if (mHost != null) { // if the (hide) animation is cancelled, the // requestedVisibleTypes should be reported at this point. // if the (hide) animation is cancelled, the requestedVisibleTypes // should be reported at this point. reportRequestedVisibleTypes(!Flags.reportAnimatingInsetsTypes() ? runner.getStatsToken() : null); mHost.getInputMethodManager().removeImeSurface( mHost.getWindowToken()); } mHost.getInputMethodManager().removeImeSurface(mHost.getWindowToken()); } } } Loading @@ -1861,14 +1866,12 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } if (removedTypes > 0) { mAnimatingTypes &= ~removedTypes; if (mHost != null) { final boolean dispatchStatsToken = Flags.reportAnimatingInsetsTypes() && (removedTypes & ime()) != 0 && runner.getAnimationType() == ANIMATION_TYPE_HIDE; mHost.updateAnimatingTypes(mAnimatingTypes, dispatchStatsToken ? runner.getStatsToken() : null); } } onAnimationStateChanged(removedTypes, false /* running */); } Loading Loading @@ -1903,6 +1906,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation if (consumer != null) { return consumer; } // ImeSourceConsumer is created using getSourceConsumer, so it is initially null here. if (type == ime() && mImeSourceConsumer != null) { // WindowInsets.Type.ime() should be only provided by one source. mSourceConsumers.remove(mImeSourceConsumer.getId()); Loading @@ -1916,7 +1920,8 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @VisibleForTesting public @NonNull InsetsSourceConsumer getImeSourceConsumer() { @NonNull public InsetsSourceConsumer getImeSourceConsumer() { return mImeSourceConsumer; } Loading Loading @@ -2048,7 +2053,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation mReportedRequestedVisibleTypes = mRequestedVisibleTypes; mHost.updateRequestedVisibleTypes(mReportedRequestedVisibleTypes, statsToken); } else if (Flags.refactorInsetsController()) { if ((typesToReport & ime()) != 0 && mImeSourceConsumer != null) { if ((typesToReport & ime()) != 0) { InsetsSourceControl control = mImeSourceConsumer.getControl(); if (control == null || control.getLeash() == null) { // If the IME was requested to show twice, and we didn't receive the controls Loading Loading @@ -2293,7 +2298,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public void addOnControllableInsetsChangedListener( OnControllableInsetsChangedListener listener) { @NonNull OnControllableInsetsChangedListener listener) { Objects.requireNonNull(listener); mControllableInsetsChangedListeners.add(listener); listener.onControllableInsetsChanged(this, calculateControllableTypes()); Loading @@ -2301,7 +2306,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation @Override public void removeOnControllableInsetsChangedListener( OnControllableInsetsChangedListener listener) { @NonNull OnControllableInsetsChangedListener listener) { Objects.requireNonNull(listener); mControllableInsetsChangedListeners.remove(listener); } Loading @@ -2323,6 +2328,7 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } @VisibleForTesting(visibility = PACKAGE) @NonNull public Host getHost() { return mHost; } Loading
core/java/android/view/InsetsState.java +1 −1 Original line number Diff line number Diff line Loading @@ -715,7 +715,7 @@ public class InsetsState implements Parcelable { * not visible. * @return {@code true} if the two InsetsState objects are equal, {@code false} otherwise. */ @VisibleForTesting @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) public boolean equals(@Nullable Object o, boolean excludesCaptionBar, boolean excludesInvisibleIme) { if (this == o) { return true; } Loading
core/java/android/view/PendingInsetsController.java +1 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,7 @@ public class PendingInsetsController implements WindowInsetsController { } @Override @NonNull public InsetsState getState() { return mDummyState; } Loading
core/java/android/view/WindowInsetsController.java +1 −0 Original line number Diff line number Diff line Loading @@ -322,6 +322,7 @@ public interface WindowInsetsController { /** * @hide */ @NonNull InsetsState getState(); /** Loading