Secure => global bubble settings pt 2
Follow up to http://ag/8222583 - Replace references to Secure.NOTIFICATION_BUBBLES with Global.NOTIFICATION_BUBBLES Fixes: 136034310 Bug: 129158983 Test: atest SystemUITests Test: manual - work profile bubbles show up Change-Id: I03ffd7f1126f2c20d819f741cd4f7dcced81a405
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.notification;
|
package com.android.settings.notification;
|
||||||
|
|
||||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
|
||||||
|
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -113,7 +113,7 @@ public class BubblePreferenceController extends NotificationPreferenceController
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isGloballyEnabled() {
|
private boolean isGloballyEnabled() {
|
||||||
return Settings.Secure.getInt(mContext.getContentResolver(),
|
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF) == SYSTEM_WIDE_ON;
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF) == SYSTEM_WIDE_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ public class BubblePreferenceController extends NotificationPreferenceController
|
|||||||
backend.setAllowBubbles(pkg, uid, false);
|
backend.setAllowBubbles(pkg, uid, false);
|
||||||
// changing the global settings will cause the observer on the host page to reload
|
// changing the global settings will cause the observer on the host page to reload
|
||||||
// correct preference state
|
// correct preference state
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ public class BubblePreferenceController extends NotificationPreferenceController
|
|||||||
backend.setAllowBubbles(pkg, uid, true);
|
backend.setAllowBubbles(pkg, uid, true);
|
||||||
// changing the global settings will cause the observer on the host page to reload
|
// changing the global settings will cause the observer on the host page to reload
|
||||||
// correct preference state
|
// correct preference state
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.notification;
|
package com.android.settings.notification;
|
||||||
|
|
||||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
|
||||||
|
|
||||||
import android.app.settings.SettingsEnums;
|
import android.app.settings.SettingsEnums;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -100,7 +100,7 @@ public class BubbleSummaryPreferenceController extends NotificationPreferenceCon
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isGloballyEnabled() {
|
private boolean isGloballyEnabled() {
|
||||||
return Settings.Secure.getInt(mContext.getContentResolver(),
|
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF) == SYSTEM_WIDE_ON;
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF) == SYSTEM_WIDE_ON;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.settings.notification;
|
package com.android.settings.notification;
|
||||||
|
|
||||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
@@ -47,8 +47,8 @@ public class GlobalBubblePermissionObserverMixin extends ContentObserver {
|
|||||||
|
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
mContext.getContentResolver().registerContentObserver(
|
mContext.getContentResolver().registerContentObserver(
|
||||||
Settings.Secure.getUriFor(
|
Settings.Global.getUriFor(
|
||||||
Settings.Secure.NOTIFICATION_BUBBLES),
|
Settings.Global.NOTIFICATION_BUBBLES),
|
||||||
false /* notifyForDescendants */,
|
false /* notifyForDescendants */,
|
||||||
this /* observer */);
|
this /* observer */);
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.development;
|
package com.android.settings.development;
|
||||||
|
|
||||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
|
||||||
|
|
||||||
import static com.android.settings.development.BubbleGlobalPreferenceController.OFF;
|
import static com.android.settings.development.BubbleGlobalPreferenceController.OFF;
|
||||||
import static com.android.settings.development.BubbleGlobalPreferenceController.ON;
|
import static com.android.settings.development.BubbleGlobalPreferenceController.ON;
|
||||||
@@ -77,7 +77,7 @@ public class BubbleGlobalPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_settingEnabled_preferenceShouldBeChecked() {
|
public void updateState_settingEnabled_preferenceShouldBeChecked() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, 1 /* enabled */);
|
NOTIFICATION_BUBBLES, 1 /* enabled */);
|
||||||
mController.updateState(mPreference);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ public class BubbleGlobalPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void updateState_settingReset_defaultDisabled_preferenceShouldNotBeChecked() {
|
public void updateState_settingReset_defaultDisabled_preferenceShouldNotBeChecked() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, 0 /* enabled */);
|
NOTIFICATION_BUBBLES, 0 /* enabled */);
|
||||||
mController.updateState(mPreference);
|
mController.updateState(mPreference);
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public class BubbleGlobalPreferenceControllerTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSettingEnabled() {
|
private boolean isSettingEnabled() {
|
||||||
return Settings.Secure.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
return Settings.Global.getInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
||||||
OFF /* default off */) == ON;
|
OFF /* default off */) == ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,7 +20,7 @@ import static android.app.NotificationChannel.DEFAULT_CHANNEL_ID;
|
|||||||
import static android.app.NotificationManager.IMPORTANCE_HIGH;
|
import static android.app.NotificationManager.IMPORTANCE_HIGH;
|
||||||
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
||||||
import static android.app.NotificationManager.IMPORTANCE_NONE;
|
import static android.app.NotificationManager.IMPORTANCE_NONE;
|
||||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
|
||||||
|
|
||||||
import static com.android.settings.notification.BubblePreferenceController.SYSTEM_WIDE_OFF;
|
import static com.android.settings.notification.BubblePreferenceController.SYSTEM_WIDE_OFF;
|
||||||
import static com.android.settings.notification.BubblePreferenceController.SYSTEM_WIDE_ON;
|
import static com.android.settings.notification.BubblePreferenceController.SYSTEM_WIDE_ON;
|
||||||
@@ -103,7 +103,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAvailable_notIfAppBlocked() {
|
public void testIsAvailable_notIfAppBlocked() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.banned = true;
|
appRow.banned = true;
|
||||||
mController.onResume(appRow, mock(NotificationChannel.class), null, null);
|
mController.onResume(appRow, mock(NotificationChannel.class), null, null);
|
||||||
@@ -112,7 +112,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAvailable_notIfChannelBlocked() {
|
public void testIsAvailable_notIfChannelBlocked() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
|
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
|
||||||
@@ -122,7 +122,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAvailable_channel_notIfAppOff() {
|
public void testIsAvailable_channel_notIfAppOff() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.allowBubbles = false;
|
appRow.allowBubbles = false;
|
||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
@@ -136,7 +136,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
public void testIsNotAvailable_ifOffGlobally_app() {
|
public void testIsNotAvailable_ifOffGlobally_app() {
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
||||||
|
|
||||||
assertFalse(mController.isAvailable());
|
assertFalse(mController.isAvailable());
|
||||||
@@ -148,7 +148,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
||||||
mController.onResume(appRow, channel, null, null);
|
mController.onResume(appRow, channel, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
||||||
|
|
||||||
assertFalse(mController.isAvailable());
|
assertFalse(mController.isAvailable());
|
||||||
@@ -158,7 +158,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
public void testIsAvailable_app_evenIfOffGlobally() {
|
public void testIsAvailable_app_evenIfOffGlobally() {
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
mAppPageController.onResume(appRow, null, null, null);
|
mAppPageController.onResume(appRow, null, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
||||||
|
|
||||||
assertTrue(mAppPageController.isAvailable());
|
assertTrue(mAppPageController.isAvailable());
|
||||||
@@ -168,7 +168,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
public void testIsAvailable_app() {
|
public void testIsAvailable_app() {
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
|
|
||||||
assertTrue(mController.isAvailable());
|
assertTrue(mController.isAvailable());
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
||||||
when(channel.getId()).thenReturn(DEFAULT_CHANNEL_ID);
|
when(channel.getId()).thenReturn(DEFAULT_CHANNEL_ID);
|
||||||
mController.onResume(appRow, channel, null, null);
|
mController.onResume(appRow, channel, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
|
|
||||||
assertTrue(mController.isAvailable());
|
assertTrue(mController.isAvailable());
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
||||||
mController.onResume(appRow, channel, null, null);
|
mController.onResume(appRow, channel, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
|
|
||||||
assertTrue(mController.isAvailable());
|
assertTrue(mController.isAvailable());
|
||||||
}
|
}
|
||||||
@@ -205,7 +205,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
||||||
mController.onResume(appRow, channel, null, null);
|
mController.onResume(appRow, channel, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
|
|
||||||
assertFalse(mController.isAvailable());
|
assertFalse(mController.isAvailable());
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateState_channelNotBlockable() {
|
public void testUpdateState_channelNotBlockable() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
when(channel.isImportanceLockedByCriticalDeviceFunction()).thenReturn(true);
|
when(channel.isImportanceLockedByCriticalDeviceFunction()).thenReturn(true);
|
||||||
@@ -239,7 +239,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateState_channel() {
|
public void testUpdateState_channel() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
when(channel.canBubble()).thenReturn(true);
|
when(channel.canBubble()).thenReturn(true);
|
||||||
@@ -259,7 +259,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateState_app() {
|
public void testUpdateState_app() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.label = "App!";
|
appRow.label = "App!";
|
||||||
appRow.allowBubbles = true;
|
appRow.allowBubbles = true;
|
||||||
@@ -281,7 +281,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateState_app_offGlobally() {
|
public void testUpdateState_app_offGlobally() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(),
|
Settings.Global.putInt(mContext.getContentResolver(),
|
||||||
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.label = "App!";
|
appRow.label = "App!";
|
||||||
@@ -295,7 +295,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnPreferenceChange_on_channel() {
|
public void testOnPreferenceChange_on_channel() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.allowBubbles = true;
|
appRow.allowBubbles = true;
|
||||||
NotificationChannel channel =
|
NotificationChannel channel =
|
||||||
@@ -315,7 +315,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnPreferenceChange_off_channel() {
|
public void testOnPreferenceChange_off_channel() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.allowBubbles = true;
|
appRow.allowBubbles = true;
|
||||||
NotificationChannel channel =
|
NotificationChannel channel =
|
||||||
@@ -335,7 +335,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnPreferenceChange_on_app() {
|
public void testOnPreferenceChange_on_app() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.allowBubbles = false;
|
appRow.allowBubbles = false;
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
@@ -353,7 +353,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnPreferenceChange_off_app() {
|
public void testOnPreferenceChange_off_app() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.allowBubbles = true;
|
appRow.allowBubbles = true;
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
@@ -371,7 +371,7 @@ public class BubblePreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOnPreferenceChange_on_app_offGlobally() {
|
public void testOnPreferenceChange_on_app_offGlobally() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
||||||
SYSTEM_WIDE_OFF);
|
SYSTEM_WIDE_OFF);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.allowBubbles = false;
|
appRow.allowBubbles = false;
|
||||||
|
@@ -20,7 +20,7 @@ import static android.app.NotificationChannel.DEFAULT_CHANNEL_ID;
|
|||||||
import static android.app.NotificationManager.IMPORTANCE_HIGH;
|
import static android.app.NotificationManager.IMPORTANCE_HIGH;
|
||||||
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
||||||
import static android.app.NotificationManager.IMPORTANCE_NONE;
|
import static android.app.NotificationManager.IMPORTANCE_NONE;
|
||||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
|
||||||
|
|
||||||
import static com.android.settings.notification.BubbleSummaryPreferenceController.SYSTEM_WIDE_OFF;
|
import static com.android.settings.notification.BubbleSummaryPreferenceController.SYSTEM_WIDE_OFF;
|
||||||
import static com.android.settings.notification.BubbleSummaryPreferenceController.SYSTEM_WIDE_ON;
|
import static com.android.settings.notification.BubbleSummaryPreferenceController.SYSTEM_WIDE_ON;
|
||||||
@@ -98,7 +98,7 @@ public class BubbleSummaryPreferenceControllerTest {
|
|||||||
NotificationChannel channel = mock(NotificationChannel.class);
|
NotificationChannel channel = mock(NotificationChannel.class);
|
||||||
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
||||||
mController.onResume(appRow, channel, null, null);
|
mController.onResume(appRow, channel, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
||||||
SYSTEM_WIDE_OFF);
|
SYSTEM_WIDE_OFF);
|
||||||
|
|
||||||
assertFalse(mController.isAvailable());
|
assertFalse(mController.isAvailable());
|
||||||
@@ -108,7 +108,7 @@ public class BubbleSummaryPreferenceControllerTest {
|
|||||||
public void testIsAvailable_app() {
|
public void testIsAvailable_app() {
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
|
|
||||||
assertTrue(mController.isAvailable());
|
assertTrue(mController.isAvailable());
|
||||||
}
|
}
|
||||||
@@ -117,7 +117,7 @@ public class BubbleSummaryPreferenceControllerTest {
|
|||||||
public void testIsNotAvailable_app_globalOff() {
|
public void testIsNotAvailable_app_globalOff() {
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
||||||
SYSTEM_WIDE_OFF);
|
SYSTEM_WIDE_OFF);
|
||||||
|
|
||||||
assertFalse(mController.isAvailable());
|
assertFalse(mController.isAvailable());
|
||||||
@@ -131,7 +131,7 @@ public class BubbleSummaryPreferenceControllerTest {
|
|||||||
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
|
||||||
when(channel.getId()).thenReturn(DEFAULT_CHANNEL_ID);
|
when(channel.getId()).thenReturn(DEFAULT_CHANNEL_ID);
|
||||||
mController.onResume(appRow, channel, null, null);
|
mController.onResume(appRow, channel, null, null);
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
|
|
||||||
assertTrue(mController.isAvailable());
|
assertTrue(mController.isAvailable());
|
||||||
}
|
}
|
||||||
@@ -149,18 +149,18 @@ public class BubbleSummaryPreferenceControllerTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetSummary() {
|
public void testGetSummary() {
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
|
||||||
appRow.allowBubbles = true;
|
appRow.allowBubbles = true;
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
|
|
||||||
assertEquals("On", mController.getSummary());
|
assertEquals("On", mController.getSummary());
|
||||||
|
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
|
||||||
SYSTEM_WIDE_OFF);
|
SYSTEM_WIDE_OFF);
|
||||||
assertEquals("Off", mController.getSummary());
|
assertEquals("Off", mController.getSummary());
|
||||||
|
|
||||||
Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
|
||||||
appRow.allowBubbles = false;
|
appRow.allowBubbles = false;
|
||||||
mController.onResume(appRow, null, null, null);
|
mController.onResume(appRow, null, null, null);
|
||||||
|
|
||||||
|
@@ -16,20 +16,11 @@
|
|||||||
|
|
||||||
package com.android.settings.notification;
|
package com.android.settings.notification;
|
||||||
|
|
||||||
import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
|
|
||||||
|
|
||||||
import static com.android.settings.notification.BadgingNotificationPreferenceController.OFF;
|
|
||||||
import static com.android.settings.notification.BadgingNotificationPreferenceController.ON;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
|
||||||
|
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
import com.android.settings.R;
|
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
|
Reference in New Issue
Block a user