Search in sources :

Example 1 with HideNonSystemOverlayMixin

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));
}
Also used : HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin)

Example 2 with HideNonSystemOverlayMixin

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);
}
Also used : Window(android.view.Window) HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin) BatteryFixSliceTest(com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 3 with HideNonSystemOverlayMixin

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);
}
Also used : Window(android.view.Window) HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin) WindowManager(android.view.WindowManager) BatteryFixSliceTest(com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Example 4 with HideNonSystemOverlayMixin

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);
}
Also used : Window(android.view.Window) HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin) Test(org.junit.Test)

Example 5 with HideNonSystemOverlayMixin

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);
}
Also used : Window(android.view.Window) HideNonSystemOverlayMixin(com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin) WindowManager(android.view.WindowManager) Test(org.junit.Test)

Aggregations

HideNonSystemOverlayMixin (com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin)10 Window (android.view.Window)5 Test (org.junit.Test)4 WindowManager (android.view.WindowManager)2 Toolbar (android.widget.Toolbar)2 BatteryFixSliceTest (com.android.settings.homepage.contextualcards.slices.BatteryFixSliceTest)2 Config (org.robolectric.annotation.Config)2 TypedArray (android.content.res.TypedArray)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 LockPatternUtils (com.android.internal.widget.LockPatternUtils)1 SubSettings (com.android.settings.SubSettings)1 AvatarViewMixin (com.android.settings.accounts.AvatarViewMixin)1 CategoryMixin (com.android.settings.core.CategoryMixin)1 ContextualCardsFragment (com.android.settings.homepage.contextualcards.ContextualCardsFragment)1