Merge "Notify sysui of side swipe gestures that will show the bars transiently" into sc-v2-dev am: f80552b605

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16422448

Change-Id: Ic9b733c5273d1fe566da756584f499cfe34f5839
This commit is contained in:
Winson Chung
2022-01-07 21:45:30 +00:00
committed by Automerger Merge Worker
13 changed files with 129 additions and 66 deletions

View File

@@ -205,8 +205,10 @@ oneway interface IStatusBar
* *
* @param displayId the ID of the display to notify. * @param displayId the ID of the display to notify.
* @param types the internal insets types of the bars are about to show transiently. * @param types the internal insets types of the bars are about to show transiently.
* @param isGestureOnSystemBar whether the gesture to show the transient bar was a gesture on
* one of the bars itself.
*/ */
void showTransient(int displayId, in int[] types); void showTransient(int displayId, in int[] types, boolean isGestureOnSystemBar);
/** /**
* Notifies System UI to abort the transient state of system bars, which prevents the bars being * Notifies System UI to abort the transient state of system bars, which prevents the bars being

View File

@@ -228,6 +228,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
private @Behavior int mBehavior; private @Behavior int mBehavior;
private boolean mTransientShown; private boolean mTransientShown;
private boolean mTransientShownFromGestureOnSystemBar;
private int mNavBarMode = NAV_BAR_MODE_3BUTTON; private int mNavBarMode = NAV_BAR_MODE_3BUTTON;
private LightBarController mLightBarController; private LightBarController mLightBarController;
private final LightBarController mMainLightBarController; private final LightBarController mMainLightBarController;
@@ -872,6 +873,9 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
+ windowStateToString(mNavigationBarWindowState)); + windowStateToString(mNavigationBarWindowState));
pw.println(" mNavigationBarMode=" pw.println(" mNavigationBarMode="
+ BarTransitions.modeToString(mNavigationBarMode)); + BarTransitions.modeToString(mNavigationBarMode));
pw.println(" mTransientShown=" + mTransientShown);
pw.println(" mTransientShownFromGestureOnSystemBar="
+ mTransientShownFromGestureOnSystemBar);
dumpBarTransitions(pw, "mNavigationBarView", mNavigationBarView.getBarTransitions()); dumpBarTransitions(pw, "mNavigationBarView", mNavigationBarView.getBarTransitions());
mNavigationBarView.dump(pw); mNavigationBarView.dump(pw);
} }
@@ -990,7 +994,8 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
} }
@Override @Override
public void showTransient(int displayId, @InternalInsetsType int[] types) { public void showTransient(int displayId, @InternalInsetsType int[] types,
boolean isGestureOnSystemBar) {
if (displayId != mDisplayId) { if (displayId != mDisplayId) {
return; return;
} }
@@ -999,6 +1004,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
} }
if (!mTransientShown) { if (!mTransientShown) {
mTransientShown = true; mTransientShown = true;
mTransientShownFromGestureOnSystemBar = isGestureOnSystemBar;
handleTransientChanged(); handleTransientChanged();
} }
} }
@@ -1017,12 +1023,14 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
private void clearTransient() { private void clearTransient() {
if (mTransientShown) { if (mTransientShown) {
mTransientShown = false; mTransientShown = false;
mTransientShownFromGestureOnSystemBar = false;
handleTransientChanged(); handleTransientChanged();
} }
} }
private void handleTransientChanged() { private void handleTransientChanged() {
mNavigationBarView.onTransientStateChanged(mTransientShown); mNavigationBarView.onTransientStateChanged(mTransientShown,
mTransientShownFromGestureOnSystemBar);
final int barMode = barMode(mTransientShown, mAppearance); final int barMode = barMode(mTransientShown, mAppearance);
if (updateBarMode(barMode) && mLightBarController != null) { if (updateBarMode(barMode) && mLightBarController != null) {
mLightBarController.onNavigationBarModeChanged(barMode); mLightBarController.onNavigationBarModeChanged(barMode);

View File

@@ -447,12 +447,17 @@ public class NavigationBarView extends FrameLayout implements
mRegionSamplingHelper.setWindowHasBlurs(hasBlurs); mRegionSamplingHelper.setWindowHasBlurs(hasBlurs);
} }
void onTransientStateChanged(boolean isTransient) { void onTransientStateChanged(boolean isTransient, boolean isGestureOnSystemBar) {
mEdgeBackGestureHandler.onNavBarTransientStateChanged(isTransient); mEdgeBackGestureHandler.onNavBarTransientStateChanged(isTransient);
// The visibility of the navigation bar buttons is dependent on the transient state of // The visibility of the navigation bar buttons is dependent on the transient state of
// the navigation bar. // the navigation bar.
if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) { if (mNavBarOverlayController.isNavigationBarOverlayEnabled()) {
// Always allow the overlay if in non-gestural nav mode, otherwise, only allow showing
// the overlay if the user is swiping directly over a system bar
boolean allowNavBarOverlay = !QuickStepContract.isGesturalMode(mNavBarMode)
|| isGestureOnSystemBar;
isTransient = isTransient && allowNavBarOverlay;
mNavBarOverlayController.setButtonState(isTransient, /* force */ false); mNavBarOverlayController.setButtonState(isTransient, /* force */ false);
} }
} }

View File

@@ -350,7 +350,7 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
} }
@Override @Override
public void showTransient(int displayId, int[] types) { public void showTransient(int displayId, int[] types, boolean isGestureOnSystemBar) {
if (displayId != mDisplayId) { if (displayId != mDisplayId) {
return; return;
} }

View File

@@ -343,10 +343,18 @@ public class CommandQueue extends IStatusBar.Stub implements
String packageName) { } String packageName) { }
/** /**
* @see IStatusBar#showTransient(int, int[]). * @see IStatusBar#showTransient(int, int[], boolean).
*/ */
default void showTransient(int displayId, @InternalInsetsType int[] types) { } default void showTransient(int displayId, @InternalInsetsType int[] types) { }
/**
* @see IStatusBar#showTransient(int, int[], boolean).
*/
default void showTransient(int displayId, @InternalInsetsType int[] types,
boolean isGestureOnSystemBar) {
showTransient(displayId, types);
}
/** /**
* @see IStatusBar#abortTransient(int, int[]). * @see IStatusBar#abortTransient(int, int[]).
*/ */
@@ -1019,9 +1027,10 @@ public class CommandQueue extends IStatusBar.Stub implements
} }
@Override @Override
public void showTransient(int displayId, int[] types) { public void showTransient(int displayId, int[] types, boolean isGestureOnSystemBar) {
synchronized (mLock) { synchronized (mLock) {
mHandler.obtainMessage(MSG_SHOW_TRANSIENT, displayId, 0, types).sendToTarget(); mHandler.obtainMessage(MSG_SHOW_TRANSIENT, displayId, isGestureOnSystemBar ? 1 : 0,
types).sendToTarget();
} }
} }
@@ -1404,8 +1413,9 @@ public class CommandQueue extends IStatusBar.Stub implements
case MSG_SHOW_TRANSIENT: { case MSG_SHOW_TRANSIENT: {
final int displayId = msg.arg1; final int displayId = msg.arg1;
final int[] types = (int[]) msg.obj; final int[] types = (int[]) msg.obj;
final boolean isGestureOnSystemBar = msg.arg2 != 0;
for (int i = 0; i < mCallbacks.size(); i++) { for (int i = 0; i < mCallbacks.size(); i++) {
mCallbacks.get(i).showTransient(displayId, types); mCallbacks.get(i).showTransient(displayId, types, isGestureOnSystemBar);
} }
break; break;
} }

View File

@@ -495,7 +495,8 @@ public class StatusBarCommandQueueCallbacks implements CommandQueue.Callbacks {
} }
@Override @Override
public void showTransient(int displayId, @InternalInsetsType int[] types) { public void showTransient(int displayId, @InternalInsetsType int[] types,
boolean isGestureOnSystemBar) {
if (displayId != mDisplayId) { if (displayId != mDisplayId) {
return; return;
} }

View File

@@ -151,17 +151,17 @@ public class CommandQueueTest extends SysuiTestCase {
@Test @Test
public void testShowTransient() { public void testShowTransient() {
int[] types = new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR}; int[] types = new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR};
mCommandQueue.showTransient(DEFAULT_DISPLAY, types); mCommandQueue.showTransient(DEFAULT_DISPLAY, types, true /* isGestureOnSystemBar */);
waitForIdleSync(); waitForIdleSync();
verify(mCallbacks).showTransient(eq(DEFAULT_DISPLAY), eq(types)); verify(mCallbacks).showTransient(eq(DEFAULT_DISPLAY), eq(types), eq(true));
} }
@Test @Test
public void testShowTransientForSecondaryDisplay() { public void testShowTransientForSecondaryDisplay() {
int[] types = new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR}; int[] types = new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR};
mCommandQueue.showTransient(SECONDARY_DISPLAY, types); mCommandQueue.showTransient(SECONDARY_DISPLAY, types, true /* isGestureOnSystemBar */);
waitForIdleSync(); waitForIdleSync();
verify(mCallbacks).showTransient(eq(SECONDARY_DISPLAY), eq(types)); verify(mCallbacks).showTransient(eq(SECONDARY_DISPLAY), eq(types), eq(true));
} }
@Test @Test

View File

@@ -136,7 +136,8 @@ public interface StatusBarManagerInternal {
@Behavior int behavior, InsetsVisibilities requestedVisibilities, String packageName); @Behavior int behavior, InsetsVisibilities requestedVisibilities, String packageName);
/** @see com.android.internal.statusbar.IStatusBar#showTransient */ /** @see com.android.internal.statusbar.IStatusBar#showTransient */
void showTransient(int displayId, @InternalInsetsType int[] types); void showTransient(int displayId, @InternalInsetsType int[] types,
boolean isGestureOnSystemBar);
/** @see com.android.internal.statusbar.IStatusBar#abortTransient */ /** @see com.android.internal.statusbar.IStatusBar#abortTransient */
void abortTransient(int displayId, @InternalInsetsType int[] types); void abortTransient(int displayId, @InternalInsetsType int[] types);

View File

@@ -540,11 +540,12 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D
} }
@Override @Override
public void showTransient(int displayId, @InternalInsetsType int[] types) { public void showTransient(int displayId, @InternalInsetsType int[] types,
boolean isGestureOnSystemBar) {
getUiState(displayId).showTransient(types); getUiState(displayId).showTransient(types);
if (mBar != null) { if (mBar != null) {
try { try {
mBar.showTransient(displayId, types); mBar.showTransient(displayId, types, isGestureOnSystemBar);
} catch (RemoteException ex) { } } catch (RemoteException ex) { }
} }
} }

View File

@@ -429,7 +429,7 @@ public class DisplayPolicy {
WindowState targetBar = (msg.arg1 == MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS) WindowState targetBar = (msg.arg1 == MSG_REQUEST_TRANSIENT_BARS_ARG_STATUS)
? getStatusBar() : getNavigationBar(); ? getStatusBar() : getNavigationBar();
if (targetBar != null) { if (targetBar != null) {
requestTransientBars(targetBar); requestTransientBars(targetBar, true /* isGestureOnSystemBar */);
} }
} }
break; break;
@@ -480,26 +480,25 @@ public class DisplayPolicy {
// TODO(b/181821798) Migrate SystemGesturesPointerEventListener to use window context. // TODO(b/181821798) Migrate SystemGesturesPointerEventListener to use window context.
mSystemGestures = new SystemGesturesPointerEventListener(mUiContext, mHandler, mSystemGestures = new SystemGesturesPointerEventListener(mUiContext, mHandler,
new SystemGesturesPointerEventListener.Callbacks() { new SystemGesturesPointerEventListener.Callbacks() {
@Override @Override
public void onSwipeFromTop() { public void onSwipeFromTop() {
synchronized (mLock) { synchronized (mLock) {
if (mStatusBar != null) { final WindowState bar = mStatusBar != null
requestTransientBars(mStatusBar); ? mStatusBar
} : findAltBarMatchingPosition(ALT_BAR_TOP);
checkAltBarSwipeForTransientBars(ALT_BAR_TOP, requestTransientBars(bar, true /* isGestureOnSystemBar */);
false /* allowForAllPositions */);
} }
} }
@Override @Override
public void onSwipeFromBottom() { public void onSwipeFromBottom() {
synchronized (mLock) { synchronized (mLock) {
if (mNavigationBar != null final WindowState bar = mNavigationBar != null
&& mNavigationBarPosition == NAV_BAR_BOTTOM) { && mNavigationBarPosition == NAV_BAR_BOTTOM
requestTransientBars(mNavigationBar); ? mNavigationBar
} : findAltBarMatchingPosition(ALT_BAR_BOTTOM);
checkAltBarSwipeForTransientBars(ALT_BAR_BOTTOM, requestTransientBars(bar, true /* isGestureOnSystemBar */);
false /* allowForAllPositions */);
} }
} }
@@ -509,13 +508,8 @@ public class DisplayPolicy {
synchronized (mLock) { synchronized (mLock) {
mDisplayContent.calculateSystemGestureExclusion( mDisplayContent.calculateSystemGestureExclusion(
excludedRegion, null /* outUnrestricted */); excludedRegion, null /* outUnrestricted */);
final boolean allowSideSwipe = mNavigationBarAlwaysShowOnSideGesture && requestTransientBarsForSideSwipe(excludedRegion, NAV_BAR_RIGHT,
!mSystemGestures.currentGestureStartedInRegion(excludedRegion); ALT_BAR_RIGHT);
if (mNavigationBar != null && (mNavigationBarPosition == NAV_BAR_RIGHT
|| allowSideSwipe)) {
requestTransientBars(mNavigationBar);
}
checkAltBarSwipeForTransientBars(ALT_BAR_RIGHT, allowSideSwipe);
} }
excludedRegion.recycle(); excludedRegion.recycle();
} }
@@ -526,17 +520,33 @@ public class DisplayPolicy {
synchronized (mLock) { synchronized (mLock) {
mDisplayContent.calculateSystemGestureExclusion( mDisplayContent.calculateSystemGestureExclusion(
excludedRegion, null /* outUnrestricted */); excludedRegion, null /* outUnrestricted */);
final boolean allowSideSwipe = mNavigationBarAlwaysShowOnSideGesture && requestTransientBarsForSideSwipe(excludedRegion, NAV_BAR_LEFT,
!mSystemGestures.currentGestureStartedInRegion(excludedRegion); ALT_BAR_LEFT);
if (mNavigationBar != null && (mNavigationBarPosition == NAV_BAR_LEFT
|| allowSideSwipe)) {
requestTransientBars(mNavigationBar);
}
checkAltBarSwipeForTransientBars(ALT_BAR_LEFT, allowSideSwipe);
} }
excludedRegion.recycle(); excludedRegion.recycle();
} }
private void requestTransientBarsForSideSwipe(Region excludedRegion,
int navBarSide, int altBarSide) {
final WindowState barMatchingSide = mNavigationBar != null
&& mNavigationBarPosition == navBarSide
? mNavigationBar
: findAltBarMatchingPosition(altBarSide);
final boolean allowSideSwipe = mNavigationBarAlwaysShowOnSideGesture &&
!mSystemGestures.currentGestureStartedInRegion(excludedRegion);
if (barMatchingSide == null && !allowSideSwipe) {
return;
}
// Request transient bars on the matching bar, or any bar if we always allow
// side swipes to show the bars
final boolean isGestureOnSystemBar = barMatchingSide != null;
final WindowState bar = barMatchingSide != null
? barMatchingSide
: findTransientNavOrAltBar();
requestTransientBars(bar, isGestureOnSystemBar);
}
@Override @Override
public void onFling(int duration) { public void onFling(int duration) {
if (mService.mPowerManagerInternal != null) { if (mService.mPowerManagerInternal != null) {
@@ -686,21 +696,39 @@ public class DisplayPolicy {
mHandler.post(mGestureNavigationSettingsObserver::register); mHandler.post(mGestureNavigationSettingsObserver::register);
} }
private void checkAltBarSwipeForTransientBars(@WindowManagerPolicy.AltBarPosition int pos, /**
boolean allowForAllPositions) { * Returns the first non-null alt bar window matching the given position.
if (mStatusBarAlt != null && (mStatusBarAltPosition == pos || allowForAllPositions)) { */
requestTransientBars(mStatusBarAlt); private WindowState findAltBarMatchingPosition(@WindowManagerPolicy.AltBarPosition int pos) {
if (mStatusBarAlt != null && mStatusBarAltPosition == pos) {
return mStatusBarAlt;
} }
if (mNavigationBarAlt != null if (mNavigationBarAlt != null && mNavigationBarAltPosition == pos) {
&& (mNavigationBarAltPosition == pos || allowForAllPositions)) { return mNavigationBarAlt;
requestTransientBars(mNavigationBarAlt);
} }
if (mClimateBarAlt != null && (mClimateBarAltPosition == pos || allowForAllPositions)) { if (mClimateBarAlt != null && mClimateBarAltPosition == pos) {
requestTransientBars(mClimateBarAlt); return mClimateBarAlt;
} }
if (mExtraNavBarAlt != null && (mExtraNavBarAltPosition == pos || allowForAllPositions)) { if (mExtraNavBarAlt != null && mExtraNavBarAltPosition == pos) {
requestTransientBars(mExtraNavBarAlt); return mExtraNavBarAlt;
} }
return null;
}
/**
* Finds the first non-null nav bar to request transient for.
*/
private WindowState findTransientNavOrAltBar() {
if (mNavigationBar != null) {
return mNavigationBar;
}
if (mNavigationBarAlt != null) {
return mNavigationBarAlt;
}
if (mExtraNavBarAlt != null) {
return mExtraNavBarAlt;
}
return null;
} }
void systemReady() { void systemReady() {
@@ -2626,8 +2654,8 @@ public class DisplayPolicy {
updateSystemBarAttributes(); updateSystemBarAttributes();
} }
private void requestTransientBars(WindowState swipeTarget) { private void requestTransientBars(WindowState swipeTarget, boolean isGestureOnSystemBar) {
if (!mService.mPolicy.isUserSetupComplete()) { if (swipeTarget == null || !mService.mPolicy.isUserSetupComplete()) {
// Swipe-up for navigation bar is disabled during setup // Swipe-up for navigation bar is disabled during setup
return; return;
} }
@@ -2663,7 +2691,8 @@ public class DisplayPolicy {
if (controlTarget.canShowTransient()) { if (controlTarget.canShowTransient()) {
// Show transient bars if they are hidden; restore position if they are visible. // Show transient bars if they are hidden; restore position if they are visible.
mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_SWIPE); mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_SWIPE,
isGestureOnSystemBar);
controlTarget.showInsets(restorePositionTypes, false); controlTarget.showInsets(restorePositionTypes, false);
} else { } else {
// Restore visibilities and positions of system bars. // Restore visibilities and positions of system bars.
@@ -2885,7 +2914,8 @@ public class DisplayPolicy {
// we're no longer on the Keyguard and the screen is ready. We can now request the bars. // we're no longer on the Keyguard and the screen is ready. We can now request the bars.
mPendingPanicGestureUptime = 0; mPendingPanicGestureUptime = 0;
if (!isNavBarEmpty(disableFlags)) { if (!isNavBarEmpty(disableFlags)) {
mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_PANIC); mDisplayContent.getInsetsPolicy().showTransient(SHOW_TYPES_FOR_PANIC,
true /* isGestureOnSystemBar */);
} }
} }

View File

@@ -159,7 +159,7 @@ class InsetsPolicy {
return provider != null && provider.hasWindow() && !provider.getSource().isVisible(); return provider != null && provider.hasWindow() && !provider.getSource().isVisible();
} }
void showTransient(@InternalInsetsType int[] types) { void showTransient(@InternalInsetsType int[] types, boolean isGestureOnSystemBar) {
boolean changed = false; boolean changed = false;
for (int i = types.length - 1; i >= 0; i--) { for (int i = types.length - 1; i >= 0; i--) {
final @InternalInsetsType int type = types[i]; final @InternalInsetsType int type = types[i];
@@ -176,8 +176,8 @@ class InsetsPolicy {
StatusBarManagerInternal statusBarManagerInternal = StatusBarManagerInternal statusBarManagerInternal =
mPolicy.getStatusBarManagerInternal(); mPolicy.getStatusBarManagerInternal();
if (statusBarManagerInternal != null) { if (statusBarManagerInternal != null) {
statusBarManagerInternal.showTransient( statusBarManagerInternal.showTransient(mDisplayContent.getDisplayId(),
mDisplayContent.getDisplayId(), mShowingTransientTypes.toArray()); mShowingTransientTypes.toArray(), isGestureOnSystemBar);
} }
updateBarControlTarget(mFocusedWin); updateBarControlTarget(mFocusedWin);

View File

@@ -291,7 +291,8 @@ public class InsetsPolicyTest extends WindowTestsBase {
assertFalse(mDisplayContent.getInsetsStateController().getRawInsetsState() assertFalse(mDisplayContent.getInsetsStateController().getRawInsetsState()
.getSource(ITYPE_NAVIGATION_BAR).isVisible()); .getSource(ITYPE_NAVIGATION_BAR).isVisible());
policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR}); policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR},
true /* isGestureOnSystemBar */);
waitUntilWindowAnimatorIdle(); waitUntilWindowAnimatorIdle();
final InsetsSourceControl[] controls = final InsetsSourceControl[] controls =
mDisplayContent.getInsetsStateController().getControlsForDispatch(mAppWindow); mDisplayContent.getInsetsStateController().getControlsForDispatch(mAppWindow);
@@ -319,7 +320,8 @@ public class InsetsPolicyTest extends WindowTestsBase {
final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy()); final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
doNothing().when(policy).startAnimation(anyBoolean(), any()); doNothing().when(policy).startAnimation(anyBoolean(), any());
policy.updateBarControlTarget(mAppWindow); policy.updateBarControlTarget(mAppWindow);
policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR}); policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR},
true /* isGestureOnSystemBar */);
waitUntilWindowAnimatorIdle(); waitUntilWindowAnimatorIdle();
final InsetsSourceControl[] controls = final InsetsSourceControl[] controls =
mDisplayContent.getInsetsStateController().getControlsForDispatch(mAppWindow); mDisplayContent.getInsetsStateController().getControlsForDispatch(mAppWindow);
@@ -351,7 +353,8 @@ public class InsetsPolicyTest extends WindowTestsBase {
final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy()); final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
doNothing().when(policy).startAnimation(anyBoolean(), any()); doNothing().when(policy).startAnimation(anyBoolean(), any());
policy.updateBarControlTarget(mAppWindow); policy.updateBarControlTarget(mAppWindow);
policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR}); policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR},
true /* isGestureOnSystemBar */);
waitUntilWindowAnimatorIdle(); waitUntilWindowAnimatorIdle();
InsetsSourceControl[] controls = InsetsSourceControl[] controls =
mDisplayContent.getInsetsStateController().getControlsForDispatch(mAppWindow); mDisplayContent.getInsetsStateController().getControlsForDispatch(mAppWindow);
@@ -402,7 +405,8 @@ public class InsetsPolicyTest extends WindowTestsBase {
final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy()); final InsetsPolicy policy = spy(mDisplayContent.getInsetsPolicy());
doNothing().when(policy).startAnimation(anyBoolean(), any()); doNothing().when(policy).startAnimation(anyBoolean(), any());
policy.updateBarControlTarget(app); policy.updateBarControlTarget(app);
policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR}); policy.showTransient(new int[]{ITYPE_STATUS_BAR, ITYPE_NAVIGATION_BAR},
true /* isGestureOnSystemBar */);
final InsetsSourceControl[] controls = final InsetsSourceControl[] controls =
mDisplayContent.getInsetsStateController().getControlsForDispatch(app); mDisplayContent.getInsetsStateController().getControlsForDispatch(app);
policy.updateBarControlTarget(app2); policy.updateBarControlTarget(app2);

View File

@@ -332,7 +332,8 @@ public class InsetsStateControllerTest extends WindowTestsBase {
assertTrue(rotatedState.getSource(ITYPE_STATUS_BAR).isVisible()); assertTrue(rotatedState.getSource(ITYPE_STATUS_BAR).isVisible());
provider.getSource().setVisible(false); provider.getSource().setVisible(false);
mDisplayContent.getInsetsPolicy().showTransient(new int[] { ITYPE_STATUS_BAR }); mDisplayContent.getInsetsPolicy().showTransient(new int[] { ITYPE_STATUS_BAR },
true /* isGestureOnSystemBar */);
assertTrue(mDisplayContent.getInsetsPolicy().isTransient(ITYPE_STATUS_BAR)); assertTrue(mDisplayContent.getInsetsPolicy().isTransient(ITYPE_STATUS_BAR));
assertFalse(app.getInsetsState().getSource(ITYPE_STATUS_BAR).isVisible()); assertFalse(app.getInsetsState().getSource(ITYPE_STATUS_BAR).isVisible());