use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.
the class ChannelPanelActivity method onCreate.
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!getIntent().hasExtra(Settings.EXTRA_CHANNEL_FILTER_LIST)) {
launchFullSettings();
}
getApplicationContext().getTheme().rebase();
createOrUpdatePanel();
getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
}
use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.
the class SettingsHomepageActivityTest method onStart_isNotDebuggable_shouldHideSystemOverlay.
@Test
@Config(shadows = { BatteryFixSliceTest.ShadowBatteryTipLoader.class })
public void onStart_isNotDebuggable_shouldHideSystemOverlay() {
ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
final ActivityController<SettingsHomepageActivity> activityController = Robolectric.buildActivity(SettingsHomepageActivity.class).create();
final SettingsHomepageActivity activity = spy(activityController.get());
final Window window = mock(Window.class);
when(activity.getWindow()).thenReturn(window);
activity.getLifecycle().addObserver(new HideNonSystemOverlayMixin(activity));
activityController.start();
verify(window).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
}
use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.
the class SettingsHomepageActivityTest method onStop_isNotDebuggable_shouldRemoveHideSystemOverlay.
@Test
@Config(shadows = { BatteryFixSliceTest.ShadowBatteryTipLoader.class })
public void onStop_isNotDebuggable_shouldRemoveHideSystemOverlay() {
ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
final ActivityController<SettingsHomepageActivity> activityController = Robolectric.buildActivity(SettingsHomepageActivity.class).create();
final SettingsHomepageActivity activity = spy(activityController.get());
final Window window = mock(Window.class);
when(activity.getWindow()).thenReturn(window);
activity.getLifecycle().addObserver(new HideNonSystemOverlayMixin(activity));
activityController.start();
verify(window).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
when(window.getAttributes()).thenReturn(layoutParams);
activityController.stop();
final ArgumentCaptor<WindowManager.LayoutParams> paramCaptor = ArgumentCaptor.forClass(WindowManager.LayoutParams.class);
verify(window).setAttributes(paramCaptor.capture());
assertThat(paramCaptor.getValue().privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS).isEqualTo(0);
}
use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.
the class SettingsPanelActivityTest method onStart_isNotDebuggable_shouldHideSystemOverlay.
@Test
public void onStart_isNotDebuggable_shouldHideSystemOverlay() {
ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
final ActivityController<SettingsPanelActivity> activityController = Robolectric.buildActivity(SettingsPanelActivity.class).create();
final SettingsPanelActivity activity = spy(activityController.get());
final Window window = mock(Window.class);
when(activity.getWindow()).thenReturn(window);
activity.getLifecycle().addObserver(new HideNonSystemOverlayMixin(activity));
activityController.start();
verify(window).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
}
use of com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin in project android_packages_apps_Settings by omnirom.
the class SettingsPanelActivityTest method onStop_isNotDebuggable_shouldRemoveHideSystemOverlay.
@Test
public void onStop_isNotDebuggable_shouldRemoveHideSystemOverlay() {
ReflectionHelpers.setStaticField(Build.class, "IS_DEBUGGABLE", false);
final ActivityController<SettingsPanelActivity> activityController = Robolectric.buildActivity(SettingsPanelActivity.class).create();
final SettingsPanelActivity activity = spy(activityController.get());
final Window window = mock(Window.class);
when(activity.getWindow()).thenReturn(window);
activity.getLifecycle().addObserver(new HideNonSystemOverlayMixin(activity));
activityController.start();
verify(window).addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
final WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
when(window.getAttributes()).thenReturn(layoutParams);
activityController.stop();
final ArgumentCaptor<WindowManager.LayoutParams> paramCaptor = ArgumentCaptor.forClass(WindowManager.LayoutParams.class);
verify(window).setAttributes(paramCaptor.capture());
assertThat(paramCaptor.getValue().privateFlags & SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS).isEqualTo(0);
}
Aggregations