diff options
| author | Tiger Huang <tigerhuang@google.com> | 2019-10-29 23:21:27 +0800 |
|---|---|---|
| committer | Tiger Huang <tigerhuang@google.com> | 2019-11-18 17:31:42 +0800 |
| commit | 332793ba05e286dec2ba83bc0ccd8bb2e4162099 (patch) | |
| tree | de80d723a96c767386c925e0865f1bcce7c2078a /core/java/android/view/InsetsController.java | |
| parent | b61af00a0e2f3456df8811dbefa3cd6bf24ff32f (diff) | |
Window Manager Flag Migration (6/n)
Refactor the insets APIs:
- Remove top/side in the names of types
- Add a type for the caption bar
- Rename InsetSide to InternalInsetsSide which is a enumeration, so that
we can have a public @InsetsSide which is a bit-wise variable
- Fix the naming about insets: inset --> insets
Bug: 118118435
Test: atest InsetsSourceProviderTest InsetsStateControllerTest
InsetsPolicyTest WindowStateTests CommandQueueTest
RegisterStatusBarResultTest InsetsFlagsTest
LightBarControllerTest RegisterStatusBarResultTest
Change-Id: I27a066299eea9927ce61f6cb5d489ad79bca42ba
Diffstat (limited to 'core/java/android/view/InsetsController.java')
| -rw-r--r-- | core/java/android/view/InsetsController.java | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java index eca6dcb1daac..3c93bb7a59b2 100644 --- a/core/java/android/view/InsetsController.java +++ b/core/java/android/view/InsetsController.java @@ -16,7 +16,7 @@ package android.view; -import static android.view.InsetsState.TYPE_IME; +import static android.view.InsetsState.ITYPE_IME; import static android.view.InsetsState.toPublicType; import static android.view.WindowInsets.Type.all; @@ -35,10 +35,10 @@ import android.util.Pair; import android.util.Property; import android.util.SparseArray; import android.view.InsetsSourceConsumer.ShowResult; -import android.view.InsetsState.InternalInsetType; +import android.view.InsetsState.InternalInsetsType; import android.view.SurfaceControl.Transaction; import android.view.WindowInsets.Type; -import android.view.WindowInsets.Type.InsetType; +import android.view.WindowInsets.Type.InsetsType; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; @@ -220,11 +220,11 @@ public class InsetsController implements WindowInsetsController { } @Override - public void show(@InsetType int types) { + public void show(@InsetsType int types) { show(types, false /* fromIme */); } - void show(@InsetType int types, boolean fromIme) { + void show(@InsetsType int types, boolean fromIme) { // TODO: Support a ResultReceiver for IME. // TODO(b/123718661): Make show() work for multi-session IME. int typesReady = 0; @@ -232,7 +232,7 @@ public class InsetsController implements WindowInsetsController { for (int i = internalTypes.size() - 1; i >= 0; i--) { InsetsSourceConsumer consumer = getSourceConsumer(internalTypes.valueAt(i)); if (mAnimationDirection == DIRECTION_HIDE) { - // Only one animator (with multiple InsetType) can run at a time. + // Only one animator (with multiple InsetsType) can run at a time. // previous one should be cancelled for simplicity. cancelExistingAnimation(); } else if (consumer.isVisible() @@ -250,11 +250,11 @@ public class InsetsController implements WindowInsetsController { } @Override - public void hide(@InsetType int types) { + public void hide(@InsetsType int types) { hide(types, false /* fromIme */); } - void hide(@InsetType int types, boolean fromIme) { + void hide(@InsetsType int types, boolean fromIme) { int typesReady = 0; final ArraySet<Integer> internalTypes = InsetsState.toInternalType(types); for (int i = internalTypes.size() - 1; i >= 0; i--) { @@ -273,12 +273,12 @@ public class InsetsController implements WindowInsetsController { } @Override - public void controlWindowInsetsAnimation(@InsetType int types, + public void controlWindowInsetsAnimation(@InsetsType int types, WindowInsetsAnimationControlListener listener) { controlWindowInsetsAnimation(types, listener, false /* fromIme */); } - private void controlWindowInsetsAnimation(@InsetType int types, + private void controlWindowInsetsAnimation(@InsetsType int types, WindowInsetsAnimationControlListener listener, boolean fromIme) { // If the frame of our window doesn't span the entire display, the control API makes very // little sense, as we don't deal with negative insets. So just cancel immediately. @@ -289,7 +289,7 @@ public class InsetsController implements WindowInsetsController { controlAnimationUnchecked(types, listener, mFrame, fromIme); } - private void controlAnimationUnchecked(@InsetType int types, + private void controlAnimationUnchecked(@InsetsType int types, WindowInsetsAnimationControlListener listener, Rect frame, boolean fromIme) { if (types == 0) { // nothing to animate. @@ -350,7 +350,7 @@ public class InsetsController implements WindowInsetsController { // with animation of other types. if (mPendingTypesToShow != 0) { // remove IME from pending because view no longer has focus. - mPendingTypesToShow &= ~InsetsState.toPublicType(TYPE_IME); + mPendingTypesToShow &= ~InsetsState.toPublicType(ITYPE_IME); } break; } @@ -368,7 +368,7 @@ public class InsetsController implements WindowInsetsController { return new Pair<>(typesReady, isReady); } - private int collectPendingConsumers(@InsetType int typesReady, + private int collectPendingConsumers(@InsetsType int typesReady, SparseArray<InsetsSourceConsumer> consumers) { if (mPendingTypesToShow != 0) { typesReady |= mPendingTypesToShow; @@ -382,7 +382,7 @@ public class InsetsController implements WindowInsetsController { return typesReady; } - private void cancelExistingControllers(@InsetType int types) { + private void cancelExistingControllers(@InsetsType int types) { for (int i = mAnimationControls.size() - 1; i >= 0; i--) { InsetsAnimationControlImpl control = mAnimationControls.get(i); if ((control.getTypes() & types) != 0) { @@ -420,7 +420,7 @@ public class InsetsController implements WindowInsetsController { } @VisibleForTesting - public @NonNull InsetsSourceConsumer getSourceConsumer(@InternalInsetType int type) { + public @NonNull InsetsSourceConsumer getSourceConsumer(@InternalInsetsType int type) { InsetsSourceConsumer controller = mSourceConsumers.get(type); if (controller != null) { return controller; @@ -440,14 +440,14 @@ public class InsetsController implements WindowInsetsController { * Called when current window gains focus. */ public void onWindowFocusGained() { - getSourceConsumer(TYPE_IME).onWindowFocusGained(); + getSourceConsumer(ITYPE_IME).onWindowFocusGained(); } /** * Called when current window loses focus. */ public void onWindowFocusLost() { - getSourceConsumer(TYPE_IME).onWindowFocusLost(); + getSourceConsumer(ITYPE_IME).onWindowFocusLost(); } ViewRootImpl getViewRoot() { @@ -468,7 +468,7 @@ public class InsetsController implements WindowInsetsController { } private InsetsSourceConsumer createConsumerOfType(int type) { - if (type == TYPE_IME) { + if (type == ITYPE_IME) { return new ImeInsetsSourceConsumer(mState, Transaction::new, this); } else { return new InsetsSourceConsumer(type, mState, Transaction::new, this); @@ -495,7 +495,7 @@ public class InsetsController implements WindowInsetsController { } } - private void applyAnimation(@InsetType final int types, boolean show, boolean fromIme) { + private void applyAnimation(@InsetsType final int types, boolean show, boolean fromIme) { if (types == 0) { // nothing to animate. return; @@ -554,14 +554,14 @@ public class InsetsController implements WindowInsetsController { controlAnimationUnchecked(types, listener, mState.getDisplayFrame(), fromIme); } - private void hideDirectly(@InsetType int types) { + private void hideDirectly(@InsetsType int types) { final ArraySet<Integer> internalTypes = InsetsState.toInternalType(types); for (int i = internalTypes.size() - 1; i >= 0; i--) { getSourceConsumer(internalTypes.valueAt(i)).hide(); } } - private void showDirectly(@InsetType int types) { + private void showDirectly(@InsetsType int types) { final ArraySet<Integer> internalTypes = InsetsState.toInternalType(types); for (int i = internalTypes.size() - 1; i >= 0; i--) { getSourceConsumer(internalTypes.valueAt(i)).show(); @@ -569,7 +569,7 @@ public class InsetsController implements WindowInsetsController { } /** - * Cancel on-going animation to show/hide {@link InsetType}. + * Cancel on-going animation to show/hide {@link InsetsType}. */ @VisibleForTesting public void cancelExistingAnimation() { |
