Loading core/java/android/view/InsetsState.java +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ import java.util.StringJoiner; */ public class InsetsState implements Parcelable { public static final InsetsState EMPTY = new InsetsState(); /** * Internal representation of inset source types. This is different from the public API in * {@link WindowInsets.Type} as one type from the public API might indicate multiple windows Loading services/core/java/com/android/server/wm/DisplayPolicy.java +18 −10 Original line number Diff line number Diff line Loading @@ -241,6 +241,9 @@ public class DisplayPolicy { | View.STATUS_BAR_TRANSPARENT | View.NAVIGATION_BAR_TRANSPARENT; private static final int[] SHOW_TYPES_FOR_SWIPE = {ITYPE_NAVIGATION_BAR, ITYPE_STATUS_BAR}; private static final int[] SHOW_TYPES_FOR_PANIC = {ITYPE_NAVIGATION_BAR}; private final WindowManagerService mService; private final Context mContext; private final Context mUiContext; Loading Loading @@ -3215,8 +3218,15 @@ public class DisplayPolicy { return; } final InsetsState requestedState = controlTarget.getRequestedInsetsState(); final @InsetsType int restorePositionTypes = (requestedState.getSourceOrDefaultVisibility(ITYPE_NAVIGATION_BAR) ? Type.navigationBars() : 0) | (requestedState.getSourceOrDefaultVisibility(ITYPE_STATUS_BAR) ? Type.statusBars() : 0); if (swipeTarget == mNavigationBar && !getInsetsPolicy().isHidden(ITYPE_NAVIGATION_BAR)) { && (restorePositionTypes & Type.navigationBars()) != 0) { // Don't show status bar when swiping on already visible navigation bar. // But restore the position of navigation bar if it has been moved by the control // target. Loading @@ -3224,14 +3234,13 @@ public class DisplayPolicy { return; } int insetsTypesToShow = Type.systemBars(); if (controlTarget.canShowTransient()) { insetsTypesToShow &= ~mDisplayContent.getInsetsPolicy().showTransient(IntArray.wrap( new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR})); } if (insetsTypesToShow != 0) { controlTarget.showInsets(insetsTypesToShow, false); // Show transient bars if they are hidden; restore position if they are visible. mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_SWIPE); controlTarget.showInsets(restorePositionTypes, false); } else { // Restore visibilities and positions of system bars. controlTarget.showInsets(Type.statusBars() | Type.navigationBars(), false); } } else { boolean sb = mStatusBarController.checkShowTransientBarLw(); Loading Loading @@ -3809,8 +3818,7 @@ public class DisplayPolicy { mPendingPanicGestureUptime = SystemClock.uptimeMillis(); if (!isNavBarEmpty(mLastSystemUiFlags)) { mNavigationBarController.showTransient(); mDisplayContent.getInsetsPolicy().showTransient(IntArray.wrap( new int[] {ITYPE_NAVIGATION_BAR})); mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_PANIC); } } } Loading services/core/java/com/android/server/wm/InsetsControlTarget.java +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.wm; import android.inputmethodservice.InputMethodService; import android.view.InsetsState; import android.view.WindowInsets.Type.InsetsType; /** Loading @@ -37,6 +38,13 @@ interface InsetsControlTarget { return null; } /** * @return The requested {@link InsetsState} of this target. */ default InsetsState getRequestedInsetsState() { return InsetsState.EMPTY; } /** * Instructs the control target to show inset sources. * Loading services/core/java/com/android/server/wm/InsetsPolicy.java +3 −7 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ import android.view.InsetsState.InternalInsetsType; import android.view.SurfaceControl; import android.view.SyncRtSurfaceTransactionApplier; import android.view.ViewRootImpl; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsAnimation; import android.view.WindowInsetsAnimation.Bounds; import android.view.WindowInsetsAnimationControlListener; Loading Loading @@ -133,15 +132,13 @@ class InsetsPolicy { return provider != null && provider.hasWindow() && !provider.getSource().isVisible(); } @InsetsType int showTransient(IntArray types) { @InsetsType int showingTransientTypes = 0; void showTransient(@InternalInsetsType int[] types) { boolean changed = false; for (int i = types.size() - 1; i >= 0; i--) { final int type = types.get(i); for (int i = types.length - 1; i >= 0; i--) { final @InternalInsetsType int type = types[i]; if (!isHidden(type)) { continue; } showingTransientTypes |= InsetsState.toPublicType(type); if (mShowingTransientTypes.indexOf(type) != -1) { continue; } Loading Loading @@ -169,7 +166,6 @@ class InsetsPolicy { } }); } return showingTransientTypes; } void hideTransient() { Loading services/core/java/com/android/server/wm/WindowState.java +2 −1 Original line number Diff line number Diff line Loading @@ -725,7 +725,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP * @return The insets state as requested by the client, i.e. the dispatched insets state * for which the visibilities are overridden with what the client requested. */ InsetsState getRequestedInsetsState() { @Override public InsetsState getRequestedInsetsState() { return mRequestedInsetsState; } Loading Loading
core/java/android/view/InsetsState.java +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ import java.util.StringJoiner; */ public class InsetsState implements Parcelable { public static final InsetsState EMPTY = new InsetsState(); /** * Internal representation of inset source types. This is different from the public API in * {@link WindowInsets.Type} as one type from the public API might indicate multiple windows Loading
services/core/java/com/android/server/wm/DisplayPolicy.java +18 −10 Original line number Diff line number Diff line Loading @@ -241,6 +241,9 @@ public class DisplayPolicy { | View.STATUS_BAR_TRANSPARENT | View.NAVIGATION_BAR_TRANSPARENT; private static final int[] SHOW_TYPES_FOR_SWIPE = {ITYPE_NAVIGATION_BAR, ITYPE_STATUS_BAR}; private static final int[] SHOW_TYPES_FOR_PANIC = {ITYPE_NAVIGATION_BAR}; private final WindowManagerService mService; private final Context mContext; private final Context mUiContext; Loading Loading @@ -3215,8 +3218,15 @@ public class DisplayPolicy { return; } final InsetsState requestedState = controlTarget.getRequestedInsetsState(); final @InsetsType int restorePositionTypes = (requestedState.getSourceOrDefaultVisibility(ITYPE_NAVIGATION_BAR) ? Type.navigationBars() : 0) | (requestedState.getSourceOrDefaultVisibility(ITYPE_STATUS_BAR) ? Type.statusBars() : 0); if (swipeTarget == mNavigationBar && !getInsetsPolicy().isHidden(ITYPE_NAVIGATION_BAR)) { && (restorePositionTypes & Type.navigationBars()) != 0) { // Don't show status bar when swiping on already visible navigation bar. // But restore the position of navigation bar if it has been moved by the control // target. Loading @@ -3224,14 +3234,13 @@ public class DisplayPolicy { return; } int insetsTypesToShow = Type.systemBars(); if (controlTarget.canShowTransient()) { insetsTypesToShow &= ~mDisplayContent.getInsetsPolicy().showTransient(IntArray.wrap( new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR})); } if (insetsTypesToShow != 0) { controlTarget.showInsets(insetsTypesToShow, false); // Show transient bars if they are hidden; restore position if they are visible. mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_SWIPE); controlTarget.showInsets(restorePositionTypes, false); } else { // Restore visibilities and positions of system bars. controlTarget.showInsets(Type.statusBars() | Type.navigationBars(), false); } } else { boolean sb = mStatusBarController.checkShowTransientBarLw(); Loading Loading @@ -3809,8 +3818,7 @@ public class DisplayPolicy { mPendingPanicGestureUptime = SystemClock.uptimeMillis(); if (!isNavBarEmpty(mLastSystemUiFlags)) { mNavigationBarController.showTransient(); mDisplayContent.getInsetsPolicy().showTransient(IntArray.wrap( new int[] {ITYPE_NAVIGATION_BAR})); mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_PANIC); } } } Loading
services/core/java/com/android/server/wm/InsetsControlTarget.java +8 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.wm; import android.inputmethodservice.InputMethodService; import android.view.InsetsState; import android.view.WindowInsets.Type.InsetsType; /** Loading @@ -37,6 +38,13 @@ interface InsetsControlTarget { return null; } /** * @return The requested {@link InsetsState} of this target. */ default InsetsState getRequestedInsetsState() { return InsetsState.EMPTY; } /** * Instructs the control target to show inset sources. * Loading
services/core/java/com/android/server/wm/InsetsPolicy.java +3 −7 Original line number Diff line number Diff line Loading @@ -42,7 +42,6 @@ import android.view.InsetsState.InternalInsetsType; import android.view.SurfaceControl; import android.view.SyncRtSurfaceTransactionApplier; import android.view.ViewRootImpl; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsAnimation; import android.view.WindowInsetsAnimation.Bounds; import android.view.WindowInsetsAnimationControlListener; Loading Loading @@ -133,15 +132,13 @@ class InsetsPolicy { return provider != null && provider.hasWindow() && !provider.getSource().isVisible(); } @InsetsType int showTransient(IntArray types) { @InsetsType int showingTransientTypes = 0; void showTransient(@InternalInsetsType int[] types) { boolean changed = false; for (int i = types.size() - 1; i >= 0; i--) { final int type = types.get(i); for (int i = types.length - 1; i >= 0; i--) { final @InternalInsetsType int type = types[i]; if (!isHidden(type)) { continue; } showingTransientTypes |= InsetsState.toPublicType(type); if (mShowingTransientTypes.indexOf(type) != -1) { continue; } Loading Loading @@ -169,7 +166,6 @@ class InsetsPolicy { } }); } return showingTransientTypes; } void hideTransient() { Loading
services/core/java/com/android/server/wm/WindowState.java +2 −1 Original line number Diff line number Diff line Loading @@ -725,7 +725,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP * @return The insets state as requested by the client, i.e. the dispatched insets state * for which the visibilities are overridden with what the client requested. */ InsetsState getRequestedInsetsState() { @Override public InsetsState getRequestedInsetsState() { return mRequestedInsetsState; } Loading