App Bubble control page should always be available, even if off globally

There is API to open up the app-specific bubble page, therefor, we should
always show the toggle. The previous work to move bubbles to developer
settings broke this.

This CL adds a param to the controller to note whether it's the app
specific page or not (since controller is also used for channel settings)
to enable this behaviour.

Added a test for this situation.

Test: make -j40 RunSettingsRoboTests ROBOTEST_FILTER=Bubble
Bug: 131846917
Change-Id: I72b1f4b5b033d1b24281061cfa6bed4d734dfcb1
This commit is contained in:
Mady Mellor
2019-05-22 10:38:40 -07:00
parent ddec88774a
commit 2c960fca1a
4 changed files with 21 additions and 5 deletions

View File

@@ -78,6 +78,7 @@ public class BubblePreferenceControllerTest {
private FragmentManager mFragmentManager;
private BubblePreferenceController mController;
private BubblePreferenceController mAppPageController;
@Before
public void setUp() {
@@ -87,7 +88,10 @@ public class BubblePreferenceControllerTest {
shadowApplication.setSystemService(Context.USER_SERVICE, mUm);
mContext = RuntimeEnvironment.application;
when(mFragmentManager.beginTransaction()).thenReturn(mock(FragmentTransaction.class));
mController = spy(new BubblePreferenceController(mContext, mFragmentManager, mBackend));
mController = spy(new BubblePreferenceController(mContext, mFragmentManager, mBackend,
false /* isAppPage */));
mAppPageController = spy(new BubblePreferenceController(mContext, mFragmentManager,
mBackend, true /* isAppPage */));
}
@Test
@@ -150,6 +154,16 @@ public class BubblePreferenceControllerTest {
assertFalse(mController.isAvailable());
}
@Test
public void testIsAvailable_app_evenIfOffGlobally() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
mAppPageController.onResume(appRow, null, null, null);
Settings.Secure.putInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
assertTrue(mAppPageController.isAvailable());
}
@Test
public void testIsAvailable_app() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();