Loading core/java/android/view/IWindow.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -69,14 +69,14 @@ oneway interface IWindow { void insetsChanged(in InsetsState insetsState); /** * Called when this window retrieved control over a specified set of inset sources. * Called when this window retrieved control over a specified set of insets sources. */ void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls); /** * Called when a set of insets source window should be shown by policy. * * @param types internal inset types (WindowInsets.Type.InsetType) to show * @param types internal insets types (WindowInsets.Type.InsetsType) to show * @param fromIme true if this request originated from IME (InputMethodService). */ void showInsets(int types, boolean fromIme); Loading @@ -84,7 +84,7 @@ oneway interface IWindow { /** * Called when a set of insets source window should be hidden by policy. * * @param types internal inset types (WindowInsets.Type.InsetType) to hide * @param types internal insets types (WindowInsets.Type.InsetsType) to hide * @param fromIme true if this request originated from IME (InputMethodService). */ void hideInsets(int types, boolean fromIme); Loading core/java/android/view/ImeInsetsSourceConsumer.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package android.view; import static android.view.InsetsState.TYPE_IME; import static android.view.InsetsState.ITYPE_IME; import android.inputmethodservice.InputMethodService; import android.os.Parcel; Loading Loading @@ -46,7 +46,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { public ImeInsetsSourceConsumer( InsetsState state, Supplier<Transaction> transactionSupplier, InsetsController controller) { super(TYPE_IME, state, transactionSupplier, controller); super(ITYPE_IME, state, transactionSupplier, controller); } public void onPreRendered(EditorInfo info) { Loading core/java/android/view/InsetsAnimationControlImpl.java +25 −27 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ package android.view; import static android.view.InsetsState.INSET_SIDE_BOTTOM; import static android.view.InsetsState.INSET_SIDE_FLOATING; import static android.view.InsetsState.INSET_SIDE_LEFT; import static android.view.InsetsState.INSET_SIDE_RIGHT; import static android.view.InsetsState.INSET_SIDE_TOP; import static android.view.InsetsState.ISIDE_BOTTOM; import static android.view.InsetsState.ISIDE_FLOATING; import static android.view.InsetsState.ISIDE_LEFT; import static android.view.InsetsState.ISIDE_RIGHT; import static android.view.InsetsState.ISIDE_TOP; import static android.view.InsetsState.toPublicType; import android.annotation.Nullable; Loading @@ -31,9 +31,9 @@ import android.util.ArraySet; import android.util.SparseArray; import android.util.SparseIntArray; import android.util.SparseSetArray; import android.view.InsetsState.InsetSide; import android.view.InsetsState.InternalInsetsSide; import android.view.SyncRtSurfaceTransactionApplier.SurfaceParams; import android.view.WindowInsets.Type.InsetType; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsAnimationListener.InsetsAnimation; import android.view.WindowManager.LayoutParams; Loading Loading @@ -63,7 +63,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll private final Insets mShownInsets; private final Matrix mTmpMatrix = new Matrix(); private final InsetsState mInitialInsetsState; private final @InsetType int mTypes; private final @InsetsType int mTypes; private final Supplier<SyncRtSurfaceTransactionApplier> mTransactionApplierSupplier; private final InsetsController mController; private final WindowInsetsAnimationListener.InsetsAnimation mAnimation; Loading @@ -77,7 +77,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll @VisibleForTesting public InsetsAnimationControlImpl(SparseArray<InsetsSourceConsumer> consumers, Rect frame, InsetsState state, WindowInsetsAnimationControlListener listener, @InsetType int types, @InsetsType int types, Supplier<SyncRtSurfaceTransactionApplier> transactionApplierSupplier, InsetsController controller) { mConsumers = consumers; Loading Loading @@ -118,8 +118,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } @Override @InsetType public int getTypes() { @InsetsType public int getTypes() { return mTypes; } Loading Loading @@ -147,12 +146,11 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } final Insets offset = Insets.subtract(mShownInsets, mPendingInsets); ArrayList<SurfaceParams> params = new ArrayList<>(); updateLeashesForSide(INSET_SIDE_LEFT, offset.left, mPendingInsets.left, params, state); updateLeashesForSide(INSET_SIDE_TOP, offset.top, mPendingInsets.top, params, state); updateLeashesForSide(INSET_SIDE_RIGHT, offset.right, mPendingInsets.right, params, state); updateLeashesForSide(INSET_SIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params, state); updateLeashesForSide(INSET_SIDE_FLOATING, 0 /* offset */, 0 /* inset */, params, state); updateLeashesForSide(ISIDE_LEFT, offset.left, mPendingInsets.left, params, state); updateLeashesForSide(ISIDE_TOP, offset.top, mPendingInsets.top, params, state); updateLeashesForSide(ISIDE_RIGHT, offset.right, mPendingInsets.right, params, state); updateLeashesForSide(ISIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params, state); updateLeashesForSide(ISIDE_FLOATING, 0 /* offset */, 0 /* inset */, params, state); SyncRtSurfaceTransactionApplier applier = mTransactionApplierSupplier.get(); applier.scheduleApply(params.toArray(new SurfaceParams[params.size()])); Loading Loading @@ -195,7 +193,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll private Insets calculateInsets(InsetsState state, Rect frame, SparseArray<InsetsSourceConsumer> consumers, boolean shown, @Nullable @InsetSide SparseIntArray typeSideMap) { @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { for (int i = consumers.size() - 1; i >= 0; i--) { state.getSource(consumers.valueAt(i).getType()).setVisible(shown); } Loading @@ -203,7 +201,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } private Insets getInsetsFromState(InsetsState state, Rect frame, @Nullable @InsetSide SparseIntArray typeSideMap) { @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { return state.calculateInsets(frame, false /* isScreenRound */, false /* alwaysConsumerNavBar */, null /* displayCutout */, null /* legacyContentInsets */, null /* legacyStableInsets */, Loading @@ -215,7 +213,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return Insets.max(Insets.min(insets, mShownInsets), mHiddenInsets); } private void updateLeashesForSide(@InsetSide int side, int offset, int inset, private void updateLeashesForSide(@InternalInsetsSide int side, int offset, int inset, ArrayList<SurfaceParams> surfaceParams, InsetsState state) { ArraySet<InsetsSourceConsumer> items = mSideSourceMap.get(side); if (items == null) { Loading @@ -242,27 +240,27 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll if (leash != null) { surfaceParams.add(new SurfaceParams(leash, 1f /* alpha */, mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, side == INSET_SIDE_FLOATING ? consumer.isVisible() : inset != 0 /* visible */)); side == ISIDE_FLOATING ? consumer.isVisible() : inset != 0 /* visible */)); } } } private void addTranslationToMatrix(@InsetSide int side, int inset, Matrix m, Rect frame) { private void addTranslationToMatrix(@InternalInsetsSide int side, int inset, Matrix m, Rect frame) { switch (side) { case INSET_SIDE_LEFT: case ISIDE_LEFT: m.postTranslate(-inset, 0); frame.offset(-inset, 0); break; case INSET_SIDE_TOP: case ISIDE_TOP: m.postTranslate(0, -inset); frame.offset(0, -inset); break; case INSET_SIDE_RIGHT: case ISIDE_RIGHT: m.postTranslate(inset, 0); frame.offset(inset, 0); break; case INSET_SIDE_BOTTOM: case ISIDE_BOTTOM: m.postTranslate(0, inset); frame.offset(0, inset); break; Loading core/java/android/view/InsetsController.java +22 −22 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; Loading @@ -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() Loading @@ -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--) { Loading @@ -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. Loading @@ -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. Loading Loading @@ -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; } Loading @@ -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; Loading @@ -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) { Loading Loading @@ -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; Loading @@ -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() { Loading @@ -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); Loading @@ -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; Loading Loading @@ -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(); Loading @@ -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() { Loading core/java/android/view/InsetsFlags.java +20 −20 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ import static android.view.View.STATUS_BAR_TRANSPARENT; import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; import static android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_SIDE_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_TOP_BAR; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_SIDE_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_TOP_BAR; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_STATUS_BARS; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; Loading @@ -43,25 +43,25 @@ public class InsetsFlags { @ViewDebug.ExportedProperty(flagMapping = { @ViewDebug.FlagToString( mask = APPEARANCE_OPAQUE_TOP_BAR, equals = APPEARANCE_OPAQUE_TOP_BAR, name = "OPAQUE_TOP_BAR"), mask = APPEARANCE_OPAQUE_STATUS_BARS, equals = APPEARANCE_OPAQUE_STATUS_BARS, name = "OPAQUE_STATUS_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_OPAQUE_SIDE_BARS, equals = APPEARANCE_OPAQUE_SIDE_BARS, name = "OPAQUE_SIDE_BARS"), mask = APPEARANCE_OPAQUE_NAVIGATION_BARS, equals = APPEARANCE_OPAQUE_NAVIGATION_BARS, name = "OPAQUE_NAVIGATION_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_LOW_PROFILE_BARS, equals = APPEARANCE_LOW_PROFILE_BARS, name = "LOW_PROFILE_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_LIGHT_TOP_BAR, equals = APPEARANCE_LIGHT_TOP_BAR, name = "LIGHT_TOP_BAR"), mask = APPEARANCE_LIGHT_STATUS_BARS, equals = APPEARANCE_LIGHT_STATUS_BARS, name = "LIGHT_STATUS_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_LIGHT_SIDE_BARS, equals = APPEARANCE_LIGHT_SIDE_BARS, name = "LIGHT_SIDE_BARS") mask = APPEARANCE_LIGHT_NAVIGATION_BARS, equals = APPEARANCE_LIGHT_NAVIGATION_BARS, name = "LIGHT_NAVIGATION_BARS") }) public @Appearance int appearance; Loading @@ -88,14 +88,14 @@ public class InsetsFlags { appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LOW_PROFILE, APPEARANCE_LOW_PROFILE_BARS); appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, APPEARANCE_LIGHT_TOP_BAR); APPEARANCE_LIGHT_STATUS_BARS); appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, APPEARANCE_LIGHT_SIDE_BARS); APPEARANCE_LIGHT_NAVIGATION_BARS); appearance |= convertNoFlag(systemUiVisibility, STATUS_BAR_TRANSLUCENT | STATUS_BAR_TRANSPARENT, APPEARANCE_OPAQUE_TOP_BAR); STATUS_BAR_TRANSLUCENT | STATUS_BAR_TRANSPARENT, APPEARANCE_OPAQUE_STATUS_BARS); appearance |= convertNoFlag(systemUiVisibility, NAVIGATION_BAR_TRANSLUCENT | NAVIGATION_BAR_TRANSPARENT, APPEARANCE_OPAQUE_SIDE_BARS); APPEARANCE_OPAQUE_NAVIGATION_BARS); return appearance; } Loading Loading
core/java/android/view/IWindow.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -69,14 +69,14 @@ oneway interface IWindow { void insetsChanged(in InsetsState insetsState); /** * Called when this window retrieved control over a specified set of inset sources. * Called when this window retrieved control over a specified set of insets sources. */ void insetsControlChanged(in InsetsState insetsState, in InsetsSourceControl[] activeControls); /** * Called when a set of insets source window should be shown by policy. * * @param types internal inset types (WindowInsets.Type.InsetType) to show * @param types internal insets types (WindowInsets.Type.InsetsType) to show * @param fromIme true if this request originated from IME (InputMethodService). */ void showInsets(int types, boolean fromIme); Loading @@ -84,7 +84,7 @@ oneway interface IWindow { /** * Called when a set of insets source window should be hidden by policy. * * @param types internal inset types (WindowInsets.Type.InsetType) to hide * @param types internal insets types (WindowInsets.Type.InsetsType) to hide * @param fromIme true if this request originated from IME (InputMethodService). */ void hideInsets(int types, boolean fromIme); Loading
core/java/android/view/ImeInsetsSourceConsumer.java +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package android.view; import static android.view.InsetsState.TYPE_IME; import static android.view.InsetsState.ITYPE_IME; import android.inputmethodservice.InputMethodService; import android.os.Parcel; Loading Loading @@ -46,7 +46,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer { public ImeInsetsSourceConsumer( InsetsState state, Supplier<Transaction> transactionSupplier, InsetsController controller) { super(TYPE_IME, state, transactionSupplier, controller); super(ITYPE_IME, state, transactionSupplier, controller); } public void onPreRendered(EditorInfo info) { Loading
core/java/android/view/InsetsAnimationControlImpl.java +25 −27 Original line number Diff line number Diff line Loading @@ -16,11 +16,11 @@ package android.view; import static android.view.InsetsState.INSET_SIDE_BOTTOM; import static android.view.InsetsState.INSET_SIDE_FLOATING; import static android.view.InsetsState.INSET_SIDE_LEFT; import static android.view.InsetsState.INSET_SIDE_RIGHT; import static android.view.InsetsState.INSET_SIDE_TOP; import static android.view.InsetsState.ISIDE_BOTTOM; import static android.view.InsetsState.ISIDE_FLOATING; import static android.view.InsetsState.ISIDE_LEFT; import static android.view.InsetsState.ISIDE_RIGHT; import static android.view.InsetsState.ISIDE_TOP; import static android.view.InsetsState.toPublicType; import android.annotation.Nullable; Loading @@ -31,9 +31,9 @@ import android.util.ArraySet; import android.util.SparseArray; import android.util.SparseIntArray; import android.util.SparseSetArray; import android.view.InsetsState.InsetSide; import android.view.InsetsState.InternalInsetsSide; import android.view.SyncRtSurfaceTransactionApplier.SurfaceParams; import android.view.WindowInsets.Type.InsetType; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsAnimationListener.InsetsAnimation; import android.view.WindowManager.LayoutParams; Loading Loading @@ -63,7 +63,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll private final Insets mShownInsets; private final Matrix mTmpMatrix = new Matrix(); private final InsetsState mInitialInsetsState; private final @InsetType int mTypes; private final @InsetsType int mTypes; private final Supplier<SyncRtSurfaceTransactionApplier> mTransactionApplierSupplier; private final InsetsController mController; private final WindowInsetsAnimationListener.InsetsAnimation mAnimation; Loading @@ -77,7 +77,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll @VisibleForTesting public InsetsAnimationControlImpl(SparseArray<InsetsSourceConsumer> consumers, Rect frame, InsetsState state, WindowInsetsAnimationControlListener listener, @InsetType int types, @InsetsType int types, Supplier<SyncRtSurfaceTransactionApplier> transactionApplierSupplier, InsetsController controller) { mConsumers = consumers; Loading Loading @@ -118,8 +118,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } @Override @InsetType public int getTypes() { @InsetsType public int getTypes() { return mTypes; } Loading Loading @@ -147,12 +146,11 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } final Insets offset = Insets.subtract(mShownInsets, mPendingInsets); ArrayList<SurfaceParams> params = new ArrayList<>(); updateLeashesForSide(INSET_SIDE_LEFT, offset.left, mPendingInsets.left, params, state); updateLeashesForSide(INSET_SIDE_TOP, offset.top, mPendingInsets.top, params, state); updateLeashesForSide(INSET_SIDE_RIGHT, offset.right, mPendingInsets.right, params, state); updateLeashesForSide(INSET_SIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params, state); updateLeashesForSide(INSET_SIDE_FLOATING, 0 /* offset */, 0 /* inset */, params, state); updateLeashesForSide(ISIDE_LEFT, offset.left, mPendingInsets.left, params, state); updateLeashesForSide(ISIDE_TOP, offset.top, mPendingInsets.top, params, state); updateLeashesForSide(ISIDE_RIGHT, offset.right, mPendingInsets.right, params, state); updateLeashesForSide(ISIDE_BOTTOM, offset.bottom, mPendingInsets.bottom, params, state); updateLeashesForSide(ISIDE_FLOATING, 0 /* offset */, 0 /* inset */, params, state); SyncRtSurfaceTransactionApplier applier = mTransactionApplierSupplier.get(); applier.scheduleApply(params.toArray(new SurfaceParams[params.size()])); Loading Loading @@ -195,7 +193,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll private Insets calculateInsets(InsetsState state, Rect frame, SparseArray<InsetsSourceConsumer> consumers, boolean shown, @Nullable @InsetSide SparseIntArray typeSideMap) { @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { for (int i = consumers.size() - 1; i >= 0; i--) { state.getSource(consumers.valueAt(i).getType()).setVisible(shown); } Loading @@ -203,7 +201,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll } private Insets getInsetsFromState(InsetsState state, Rect frame, @Nullable @InsetSide SparseIntArray typeSideMap) { @Nullable @InternalInsetsSide SparseIntArray typeSideMap) { return state.calculateInsets(frame, false /* isScreenRound */, false /* alwaysConsumerNavBar */, null /* displayCutout */, null /* legacyContentInsets */, null /* legacyStableInsets */, Loading @@ -215,7 +213,7 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll return Insets.max(Insets.min(insets, mShownInsets), mHiddenInsets); } private void updateLeashesForSide(@InsetSide int side, int offset, int inset, private void updateLeashesForSide(@InternalInsetsSide int side, int offset, int inset, ArrayList<SurfaceParams> surfaceParams, InsetsState state) { ArraySet<InsetsSourceConsumer> items = mSideSourceMap.get(side); if (items == null) { Loading @@ -242,27 +240,27 @@ public class InsetsAnimationControlImpl implements WindowInsetsAnimationControll if (leash != null) { surfaceParams.add(new SurfaceParams(leash, 1f /* alpha */, mTmpMatrix, null /* windowCrop */, 0 /* layer */, 0f /* cornerRadius*/, side == INSET_SIDE_FLOATING ? consumer.isVisible() : inset != 0 /* visible */)); side == ISIDE_FLOATING ? consumer.isVisible() : inset != 0 /* visible */)); } } } private void addTranslationToMatrix(@InsetSide int side, int inset, Matrix m, Rect frame) { private void addTranslationToMatrix(@InternalInsetsSide int side, int inset, Matrix m, Rect frame) { switch (side) { case INSET_SIDE_LEFT: case ISIDE_LEFT: m.postTranslate(-inset, 0); frame.offset(-inset, 0); break; case INSET_SIDE_TOP: case ISIDE_TOP: m.postTranslate(0, -inset); frame.offset(0, -inset); break; case INSET_SIDE_RIGHT: case ISIDE_RIGHT: m.postTranslate(inset, 0); frame.offset(inset, 0); break; case INSET_SIDE_BOTTOM: case ISIDE_BOTTOM: m.postTranslate(0, inset); frame.offset(0, inset); break; Loading
core/java/android/view/InsetsController.java +22 −22 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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; Loading Loading @@ -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; Loading @@ -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() Loading @@ -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--) { Loading @@ -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. Loading @@ -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. Loading Loading @@ -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; } Loading @@ -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; Loading @@ -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) { Loading Loading @@ -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; Loading @@ -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() { Loading @@ -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); Loading @@ -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; Loading Loading @@ -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(); Loading @@ -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() { Loading
core/java/android/view/InsetsFlags.java +20 −20 Original line number Diff line number Diff line Loading @@ -23,11 +23,11 @@ import static android.view.View.STATUS_BAR_TRANSPARENT; import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR; import static android.view.View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR; import static android.view.View.SYSTEM_UI_FLAG_LOW_PROFILE; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_SIDE_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_TOP_BAR; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS; import static android.view.WindowInsetsController.APPEARANCE_LOW_PROFILE_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_SIDE_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_TOP_BAR; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_NAVIGATION_BARS; import static android.view.WindowInsetsController.APPEARANCE_OPAQUE_STATUS_BARS; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_BARS_BY_SWIPE; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; Loading @@ -43,25 +43,25 @@ public class InsetsFlags { @ViewDebug.ExportedProperty(flagMapping = { @ViewDebug.FlagToString( mask = APPEARANCE_OPAQUE_TOP_BAR, equals = APPEARANCE_OPAQUE_TOP_BAR, name = "OPAQUE_TOP_BAR"), mask = APPEARANCE_OPAQUE_STATUS_BARS, equals = APPEARANCE_OPAQUE_STATUS_BARS, name = "OPAQUE_STATUS_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_OPAQUE_SIDE_BARS, equals = APPEARANCE_OPAQUE_SIDE_BARS, name = "OPAQUE_SIDE_BARS"), mask = APPEARANCE_OPAQUE_NAVIGATION_BARS, equals = APPEARANCE_OPAQUE_NAVIGATION_BARS, name = "OPAQUE_NAVIGATION_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_LOW_PROFILE_BARS, equals = APPEARANCE_LOW_PROFILE_BARS, name = "LOW_PROFILE_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_LIGHT_TOP_BAR, equals = APPEARANCE_LIGHT_TOP_BAR, name = "LIGHT_TOP_BAR"), mask = APPEARANCE_LIGHT_STATUS_BARS, equals = APPEARANCE_LIGHT_STATUS_BARS, name = "LIGHT_STATUS_BARS"), @ViewDebug.FlagToString( mask = APPEARANCE_LIGHT_SIDE_BARS, equals = APPEARANCE_LIGHT_SIDE_BARS, name = "LIGHT_SIDE_BARS") mask = APPEARANCE_LIGHT_NAVIGATION_BARS, equals = APPEARANCE_LIGHT_NAVIGATION_BARS, name = "LIGHT_NAVIGATION_BARS") }) public @Appearance int appearance; Loading @@ -88,14 +88,14 @@ public class InsetsFlags { appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LOW_PROFILE, APPEARANCE_LOW_PROFILE_BARS); appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LIGHT_STATUS_BAR, APPEARANCE_LIGHT_TOP_BAR); APPEARANCE_LIGHT_STATUS_BARS); appearance |= convertFlag(systemUiVisibility, SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR, APPEARANCE_LIGHT_SIDE_BARS); APPEARANCE_LIGHT_NAVIGATION_BARS); appearance |= convertNoFlag(systemUiVisibility, STATUS_BAR_TRANSLUCENT | STATUS_BAR_TRANSPARENT, APPEARANCE_OPAQUE_TOP_BAR); STATUS_BAR_TRANSLUCENT | STATUS_BAR_TRANSPARENT, APPEARANCE_OPAQUE_STATUS_BARS); appearance |= convertNoFlag(systemUiVisibility, NAVIGATION_BAR_TRANSLUCENT | NAVIGATION_BAR_TRANSPARENT, APPEARANCE_OPAQUE_SIDE_BARS); APPEARANCE_OPAQUE_NAVIGATION_BARS); return appearance; } Loading