Merge "Updated InsetsPolicy to read config_forceShowSystemBars and prevent system bars from being hidden by applications if true." into rvc-dev am: 41db36ec48
Change-Id: I95ee8b2c2223b6714cad510d9aa948293f56db5a
This commit is contained in:
@@ -696,6 +696,10 @@ public class DisplayPolicy {
|
|||||||
mForceShowSystemBarsFromExternal = forceShowSystemBars;
|
mForceShowSystemBarsFromExternal = forceShowSystemBars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean getForceShowSystemBars() {
|
||||||
|
return mForceShowSystemBarsFromExternal;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasNavigationBar() {
|
public boolean hasNavigationBar() {
|
||||||
return mHasNavigationBar;
|
return mHasNavigationBar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -304,7 +304,10 @@ class InsetsPolicy {
|
|||||||
// We need to force system bars when the docked stack is visible, when the freeform stack
|
// We need to force system bars when the docked stack is visible, when the freeform stack
|
||||||
// is visible but also when we are resizing for the transitions when docked stack
|
// is visible but also when we are resizing for the transitions when docked stack
|
||||||
// visibility changes.
|
// visibility changes.
|
||||||
return isDockedStackVisible || isFreeformStackVisible || isResizing;
|
return isDockedStackVisible
|
||||||
|
|| isFreeformStackVisible
|
||||||
|
|| isResizing
|
||||||
|
|| mPolicy.getForceShowSystemBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
|
|||||||
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
|
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;
|
||||||
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
|
import static android.view.WindowManager.LayoutParams.TYPE_STATUS_BAR;
|
||||||
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@@ -41,7 +40,6 @@ import static org.mockito.ArgumentMatchers.anyBoolean;
|
|||||||
import static org.mockito.Mockito.doAnswer;
|
import static org.mockito.Mockito.doAnswer;
|
||||||
import static org.mockito.Mockito.doNothing;
|
import static org.mockito.Mockito.doNothing;
|
||||||
import static org.mockito.Mockito.spy;
|
import static org.mockito.Mockito.spy;
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
|
|
||||||
import android.platform.test.annotations.Presubmit;
|
import android.platform.test.annotations.Presubmit;
|
||||||
import android.util.IntArray;
|
import android.util.IntArray;
|
||||||
@@ -49,7 +47,6 @@ import android.view.InsetsSourceControl;
|
|||||||
import android.view.InsetsState;
|
import android.view.InsetsState;
|
||||||
import android.view.test.InsetsModeSession;
|
import android.view.test.InsetsModeSession;
|
||||||
|
|
||||||
import androidx.test.filters.FlakyTest;
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
@@ -167,6 +164,18 @@ public class InsetsPolicyTest extends WindowTestsBase {
|
|||||||
assertEquals(1, controls.length);
|
assertEquals(1, controls.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testControlsForDispatch_forceShowSystemBarsFromExternal_appHasNoControl() {
|
||||||
|
mDisplayContent.getDisplayPolicy().setForceShowSystemBars(true);
|
||||||
|
addWindow(TYPE_STATUS_BAR, "statusBar");
|
||||||
|
addWindow(TYPE_NAVIGATION_BAR, "navBar");
|
||||||
|
|
||||||
|
final InsetsSourceControl[] controls = addAppWindowAndGetControlsForDispatch();
|
||||||
|
|
||||||
|
// The focused app window cannot control system bars.
|
||||||
|
assertNull(controls);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShowTransientBars_bothCanBeTransient_appGetsBothFakeControls() {
|
public void testShowTransientBars_bothCanBeTransient_appGetsBothFakeControls() {
|
||||||
addNonFocusableWindow(TYPE_STATUS_BAR, "statusBar")
|
addNonFocusableWindow(TYPE_STATUS_BAR, "statusBar")
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
|
|||||||
mChildAppWindowBelow = createCommonWindow(mAppWindow,
|
mChildAppWindowBelow = createCommonWindow(mAppWindow,
|
||||||
TYPE_APPLICATION_MEDIA_OVERLAY,
|
TYPE_APPLICATION_MEDIA_OVERLAY,
|
||||||
"mChildAppWindowBelow");
|
"mChildAppWindowBelow");
|
||||||
|
mDisplayContent.getDisplayPolicy().setForceShowSystemBars(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adding a display will cause freezing the display. Make sure to wait until it's
|
// Adding a display will cause freezing the display. Make sure to wait until it's
|
||||||
|
|||||||
Reference in New Issue
Block a user