Merge "Change bubble settings to use Secure rather than Global" into sc-dev
diff --git a/src/com/android/settings/notification/BubbleNotificationPreferenceController.java b/src/com/android/settings/notification/BubbleNotificationPreferenceController.java
index 1c7b4df..67f0c7b 100644
--- a/src/com/android/settings/notification/BubbleNotificationPreferenceController.java
+++ b/src/com/android/settings/notification/BubbleNotificationPreferenceController.java
@@ -16,7 +16,7 @@
package com.android.settings.notification;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import android.app.ActivityManager;
import android.content.ContentResolver;
@@ -88,14 +88,14 @@
@Override
public boolean isChecked() {
- return Settings.Global.getInt(mContext.getContentResolver(),
+ return Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON) == ON;
}
@Override
public boolean setChecked(boolean isChecked) {
- return Settings.Global.putInt(mContext.getContentResolver(),
- NOTIFICATION_BUBBLES, isChecked ? ON : OFF);
+ return Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ isChecked ? ON : OFF);
}
@Override
@@ -106,7 +106,7 @@
class SettingObserver extends ContentObserver {
private final Uri NOTIFICATION_BUBBLES_URI =
- Settings.Global.getUriFor(NOTIFICATION_BUBBLES);
+ Settings.Secure.getUriFor(NOTIFICATION_BUBBLES);
private final Preference mPreference;
diff --git a/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceController.java b/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceController.java
index a99155f..3dac732 100644
--- a/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceController.java
+++ b/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceController.java
@@ -16,7 +16,7 @@
package com.android.settings.notification;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import android.app.ActivityManager;
import android.content.Context;
@@ -54,7 +54,7 @@
}
private boolean areBubblesEnabled() {
- return Settings.Global.getInt(mContext.getContentResolver(),
+ return Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON) == ON;
}
}
diff --git a/src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java b/src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java
index 43f0baa..ad3a10c 100644
--- a/src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java
+++ b/src/com/android/settings/notification/app/BubbleCategoryPreferenceController.java
@@ -16,7 +16,7 @@
package com.android.settings.notification.app;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import android.content.Context;
import android.content.Intent;
@@ -67,7 +67,7 @@
private boolean areBubblesEnabled() {
- return Settings.Global.getInt(mContext.getContentResolver(),
+ return Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON) == ON;
}
}
diff --git a/src/com/android/settings/notification/app/BubbleLinkPreferenceController.java b/src/com/android/settings/notification/app/BubbleLinkPreferenceController.java
index 3439543..0b9529b 100644
--- a/src/com/android/settings/notification/app/BubbleLinkPreferenceController.java
+++ b/src/com/android/settings/notification/app/BubbleLinkPreferenceController.java
@@ -16,7 +16,7 @@
package com.android.settings.notification.app;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import android.content.Context;
import android.content.Intent;
@@ -67,7 +67,7 @@
private boolean areBubblesEnabled() {
- return Settings.Global.getInt(mContext.getContentResolver(),
+ return Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON) == ON;
}
}
diff --git a/src/com/android/settings/notification/app/BubblePreferenceController.java b/src/com/android/settings/notification/app/BubblePreferenceController.java
index 6caa95e..351b463 100644
--- a/src/com/android/settings/notification/app/BubblePreferenceController.java
+++ b/src/com/android/settings/notification/app/BubblePreferenceController.java
@@ -17,10 +17,10 @@
package com.android.settings.notification.app;
import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
-import android.app.ActivityManager;
import android.annotation.Nullable;
+import android.app.ActivityManager;
import android.app.NotificationChannel;
import android.content.Context;
import android.provider.Settings;
@@ -72,7 +72,7 @@
if (!super.isAvailable()) {
return false;
}
- if (!mIsAppPage && !isGloballyEnabled()) {
+ if (!mIsAppPage && !isEnabled()) {
return false;
}
if (mChannel != null) {
@@ -101,7 +101,7 @@
BubblePreference pref = (BubblePreference) preference;
pref.setDisabledByAdmin(mAdmin);
pref.setSelectedVisibility(!mHasSentInvalidMsg || mNumConversations > 0);
- if (!isGloballyEnabled()) {
+ if (!isEnabled()) {
pref.setSelectedPreference(BUBBLE_PREFERENCE_NONE);
} else {
pref.setSelectedPreference(backEndPref);
@@ -110,7 +110,7 @@
// We're on the channel specific notification page which displays a toggle.
RestrictedSwitchPreference switchpref = (RestrictedSwitchPreference) preference;
switchpref.setDisabledByAdmin(mAdmin);
- switchpref.setChecked(mChannel.canBubble() && isGloballyEnabled());
+ switchpref.setChecked(mChannel.canBubble() && isEnabled());
}
}
@@ -125,7 +125,7 @@
BubblePreference pref = (BubblePreference) preference;
if (mAppRow != null && mFragmentManager != null) {
final int value = (int) newValue;
- if (!isGloballyEnabled()
+ if (!isEnabled()
&& pref.getSelectedPreference() == BUBBLE_PREFERENCE_NONE) {
// if the global setting is off, toggling app level permission requires extra
// confirmation
@@ -145,9 +145,9 @@
return true;
}
- private boolean isGloballyEnabled() {
+ private boolean isEnabled() {
ActivityManager am = mContext.getSystemService(ActivityManager.class);
- return !am.isLowRamDevice() && Settings.Global.getInt(mContext.getContentResolver(),
+ return !am.isLowRamDevice() && Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF) == SYSTEM_WIDE_ON;
}
@@ -155,25 +155,27 @@
* Used in app level prompt that confirms the user is ok with turning on bubbles
* globally. If they aren't, undo that.
*/
- public static void revertBubblesApproval(Context mContext, String pkg, int uid) {
+ public static void revertBubblesApproval(Context context, String pkg, int uid) {
NotificationBackend backend = new NotificationBackend();
backend.setAllowBubbles(pkg, uid, BUBBLE_PREFERENCE_NONE);
// changing the global settings will cause the observer on the host page to reload
// correct preference state
- Settings.Global.putInt(mContext.getContentResolver(),
- NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
+ Settings.Secure.putInt(context.getContentResolver(),
+ NOTIFICATION_BUBBLES,
+ SYSTEM_WIDE_OFF);
}
/**
* Apply global bubbles approval
*/
- public static void applyBubblesApproval(Context mContext, String pkg, int uid, int pref) {
+ public static void applyBubblesApproval(Context context, String pkg, int uid, int pref) {
NotificationBackend backend = new NotificationBackend();
backend.setAllowBubbles(pkg, uid, pref);
// changing the global settings will cause the observer on the host page to reload
// correct preference state
- Settings.Global.putInt(mContext.getContentResolver(),
- NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(context.getContentResolver(),
+ NOTIFICATION_BUBBLES,
+ SYSTEM_WIDE_ON);
}
}
diff --git a/src/com/android/settings/notification/app/BubbleSummaryPreferenceController.java b/src/com/android/settings/notification/app/BubbleSummaryPreferenceController.java
index 5b2a973..fb414ee 100644
--- a/src/com/android/settings/notification/app/BubbleSummaryPreferenceController.java
+++ b/src/com/android/settings/notification/app/BubbleSummaryPreferenceController.java
@@ -18,7 +18,7 @@
import static android.app.NotificationManager.BUBBLE_PREFERENCE_ALL;
import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import android.app.ActivityManager;
import android.content.Context;
@@ -106,7 +106,7 @@
private boolean isGloballyEnabled() {
ActivityManager am = mContext.getSystemService(ActivityManager.class);
- return !am.isLowRamDevice() && Settings.Global.getInt(mContext.getContentResolver(),
+ return !am.isLowRamDevice() && Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON) == ON;
}
}
diff --git a/src/com/android/settings/notification/app/GlobalBubblePermissionObserverMixin.java b/src/com/android/settings/notification/app/GlobalBubblePermissionObserverMixin.java
index bed0f3d..583cfe1 100644
--- a/src/com/android/settings/notification/app/GlobalBubblePermissionObserverMixin.java
+++ b/src/com/android/settings/notification/app/GlobalBubblePermissionObserverMixin.java
@@ -47,8 +47,8 @@
public void onStart() {
mContext.getContentResolver().registerContentObserver(
- Settings.Global.getUriFor(
- Settings.Global.NOTIFICATION_BUBBLES),
+ Settings.Secure.getUriFor(
+ Settings.Secure.NOTIFICATION_BUBBLES),
false /* notifyForDescendants */,
this /* observer */);
}
diff --git a/tests/robotests/src/com/android/settings/notification/BubbleNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BubbleNotificationPreferenceControllerTest.java
index 871de0f..4f38c46 100644
--- a/tests/robotests/src/com/android/settings/notification/BubbleNotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/BubbleNotificationPreferenceControllerTest.java
@@ -16,7 +16,7 @@
package com.android.settings.notification;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
@@ -91,7 +91,7 @@
@Test
public void updateState_settingIsOn_preferenceSetChecked() {
final TwoStatePreference preference = mock(TwoStatePreference.class);
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
mController.updateState(preference);
@@ -101,8 +101,8 @@
@Test
public void updateState_settingIsOff_preferenceSetUnchecked() {
final TwoStatePreference preference = mock(TwoStatePreference.class);
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
- assertThat(Settings.Global.getInt(mContext.getContentResolver(),
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
+ assertThat(Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, ON)).isEqualTo(OFF);
mController.updateState(preference);
@@ -112,24 +112,24 @@
@Test
public void isChecked_settingIsOff_shouldReturnFalse() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
assertThat(mController.isChecked()).isFalse();
}
@Test
public void isChecked_settingIsOn_shouldReturnTrue() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
assertThat(mController.isChecked()).isTrue();
}
@Test
public void setChecked_setFalse_disablesSetting() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
mController.setChecked(false);
- int updatedValue = Settings.Global.getInt(mContext.getContentResolver(),
+ int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, -1);
assertThat(updatedValue).isEqualTo(OFF);
@@ -137,10 +137,10 @@
@Test
public void setChecked_setTrue_enablesSetting() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
mController.setChecked(true);
- int updatedValue = Settings.Global.getInt(mContext.getContentResolver(),
+ int updatedValue = Settings.Secure.getInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, -1);
assertThat(updatedValue).isEqualTo(ON);
diff --git a/tests/robotests/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceControllerTest.java
index 88de7ac..3b4e90f 100644
--- a/tests/robotests/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/BubbleSummaryNotificationPreferenceControllerTest.java
@@ -16,7 +16,7 @@
package com.android.settings.notification;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
@@ -61,14 +61,14 @@
@Test
public void getSummary_NOTIFICATION_BUBBLESIsOff_returnOffString() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, OFF);
assertThat(mController.getSummary()).isEqualTo("Off");
}
@Test
public void getSummary_NOTIFICATION_BUBBLESIsOff_returnOnString() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, ON);
String onString = mContext.getString(R.string.notifications_bubble_setting_on_summary);
assertThat(mController.getSummary()).isEqualTo(onString);
diff --git a/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java
index f4f99c7..e04402c 100644
--- a/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/BubblePreferenceControllerTest.java
@@ -23,7 +23,7 @@
import static android.app.NotificationManager.IMPORTANCE_HIGH;
import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.app.NotificationManager.IMPORTANCE_NONE;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import static com.android.settings.notification.app.BubblePreferenceController.SYSTEM_WIDE_OFF;
import static com.android.settings.notification.app.BubblePreferenceController.SYSTEM_WIDE_ON;
@@ -71,8 +71,8 @@
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.shadow.api.Shadow;
-import org.robolectric.shadows.ShadowApplication;
import org.robolectric.shadows.ShadowActivityManager;
+import org.robolectric.shadows.ShadowApplication;
import java.util.ArrayList;
import java.util.List;
@@ -124,7 +124,7 @@
@Test
public void isAvailable_notIfAppBlocked() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.banned = true;
mController.onResume(appRow, mock(NotificationChannel.class), null, null, null, null, null);
@@ -133,7 +133,7 @@
@Test
public void isAvailable_notIfChannelBlocked() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_NONE);
@@ -143,7 +143,7 @@
@Test
public void isAvailable_channel_notIfAppOff() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.bubblePreference = BUBBLE_PREFERENCE_NONE;
NotificationChannel channel = mock(NotificationChannel.class);
@@ -157,7 +157,7 @@
public void isNotAvailable_ifOffGlobally_app() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
mController.onResume(appRow, null, null, null, null, null, null);
- Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Secure.putInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
assertFalse(mController.isAvailable());
@@ -181,7 +181,7 @@
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null, null);
- Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Secure.putInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
assertFalse(mController.isAvailable());
@@ -191,7 +191,7 @@
public void isAvailable_ifNotLowRam() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
mController.onResume(appRow, null, null, null, null, null, null);
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
final ShadowActivityManager activityManager =
Shadow.extract(mContext.getSystemService(ActivityManager.class));
@@ -203,7 +203,7 @@
public void isAvailable_app_evenIfOffGlobally() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
mAppPageController.onResume(appRow, null, null, null, null, null, null);
- Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Secure.putInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
assertTrue(mAppPageController.isAvailable());
@@ -213,7 +213,7 @@
public void isAvailable_app() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
mController.onResume(appRow, null, null, null, null, null, null);
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
assertTrue(mController.isAvailable());
}
@@ -226,7 +226,7 @@
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
when(channel.getId()).thenReturn(DEFAULT_CHANNEL_ID);
mController.onResume(appRow, channel, null, null, null, null, null);
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
assertTrue(mController.isAvailable());
}
@@ -237,8 +237,9 @@
appRow.bubblePreference = BUBBLE_PREFERENCE_ALL;
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
+
mController.onResume(appRow, channel, null, null, null, null, null);
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
assertTrue(mController.isAvailable());
}
@@ -251,7 +252,7 @@
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null,
ImmutableList.of(NotificationChannel.EDIT_CONVERSATION));
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
assertTrue(mController.isAvailable());
}
@@ -263,7 +264,7 @@
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
mController.onResume(appRow, channel, null, null, null, null, new ArrayList<>());
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
assertFalse(mController.isAvailable());
}
@@ -298,7 +299,7 @@
@Test
public void updateState_channel_channelNotBlockable() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
NotificationChannel channel = mock(NotificationChannel.class);
@@ -313,7 +314,7 @@
@Test
public void updateState_channel() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
NotificationChannel channel = mock(NotificationChannel.class);
@@ -334,7 +335,7 @@
@Test
public void updateState_app() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
appRow.label = "App!";
@@ -360,7 +361,7 @@
@Test
public void updateState_app_offGlobally() {
- Settings.Global.putInt(mContext.getContentResolver(),
+ Settings.Secure.putInt(mContext.getContentResolver(),
NOTIFICATION_BUBBLES, SYSTEM_WIDE_OFF);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
@@ -375,7 +376,7 @@
@Test
public void onPreferenceChange_on_channel() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
appRow.bubblePreference = BUBBLE_PREFERENCE_SELECTED;
@@ -395,7 +396,7 @@
@Test
public void onPreferenceChange_off_channel() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
appRow.bubblePreference = BUBBLE_PREFERENCE_SELECTED;
@@ -416,7 +417,7 @@
@Test
public void onPreferenceChange_app_all() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
appRow.bubblePreference = BUBBLE_PREFERENCE_NONE;
@@ -435,7 +436,7 @@
@Test
public void testOnPreferenceChange_app_all_offGlobally() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
SYSTEM_WIDE_OFF);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
@@ -456,7 +457,7 @@
@Test
public void onPreferenceChange_app_selected() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
appRow.bubblePreference = BUBBLE_PREFERENCE_ALL;
@@ -475,7 +476,7 @@
@Test
public void onPreferenceChange_app_none() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
appRow.bubblePreference = BUBBLE_PREFERENCE_ALL;
@@ -494,7 +495,7 @@
@Test
public void onPreferenceChange_dependentFieldListenerCalled() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.pkg = "a";
appRow.bubblePreference = BUBBLE_PREFERENCE_ALL;
diff --git a/tests/robotests/src/com/android/settings/notification/app/BubbleSummaryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/BubbleSummaryPreferenceControllerTest.java
index 911f9a2..5859a3e 100644
--- a/tests/robotests/src/com/android/settings/notification/app/BubbleSummaryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/BubbleSummaryPreferenceControllerTest.java
@@ -21,7 +21,7 @@
import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE;
import static android.app.NotificationManager.BUBBLE_PREFERENCE_SELECTED;
import static android.app.NotificationManager.IMPORTANCE_HIGH;
-import static android.provider.Settings.Global.NOTIFICATION_BUBBLES;
+import static android.provider.Settings.Secure.NOTIFICATION_BUBBLES;
import static com.android.settings.notification.app.BubblePreferenceController.SYSTEM_WIDE_OFF;
import static com.android.settings.notification.app.BubblePreferenceController.SYSTEM_WIDE_ON;
@@ -96,7 +96,7 @@
@Test
public void isAvailable_NOTIFICATION_BUBBLESisOn_shouldReturnTrue() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
mController.onResume(mAppRow, null, null, null, null, null, null);
assertTrue(mController.isAvailable());
@@ -104,7 +104,7 @@
@Test
public void isAvailable_NOTIFICATION_BUBBLESisOn_neverSentMsg_shouldReturnFalse() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
mController.onResume(mAppRow, null, null, null, null, null, null);
when(mBackend.hasSentValidMsg(anyString(), anyInt())).thenReturn(false);
@@ -113,7 +113,7 @@
@Test
public void isAvailable_NOTIFICATION_BUBBLESisOff_shouldReturnFalse() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
SYSTEM_WIDE_OFF);
mController.onResume(mAppRow, null, null, null, null, null, null);
@@ -122,7 +122,7 @@
@Test
public void isAvailable_nonNullChannelNOTIFICATION_BUBBLESisOff_shouldReturnFalse() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
SYSTEM_WIDE_OFF);
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
@@ -133,7 +133,7 @@
@Test
public void isAvailable_defaultChannelNOTIFICATION_BUBBLESisOn_shouldReturnTrue() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
NotificationChannel channel = mock(NotificationChannel.class);
when(channel.getImportance()).thenReturn(IMPORTANCE_HIGH);
when(channel.getId()).thenReturn(DEFAULT_CHANNEL_ID);
@@ -144,7 +144,7 @@
@Test
public void isAvailable_lowRam_shouldReturnFalse() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
mController.onResume(mAppRow, null, null, null, null, null, null);
final ShadowActivityManager activityManager =
@@ -155,7 +155,7 @@
@Test
public void isAvailable_notLowRam_shouldReturnTrue() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES, SYSTEM_WIDE_ON);
mController.onResume(mAppRow, null, null, null, null, null, null);
final ShadowActivityManager activityManager =
@@ -176,7 +176,7 @@
@Test
public void getSummary_NOTIFICATION_BUBBLESIsOff_returnsNoneString() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
SYSTEM_WIDE_OFF);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
@@ -188,7 +188,7 @@
@Test
public void getSummary_BUBBLE_PREFERENCE_NONEisSelected_returnsNoneString() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
@@ -201,7 +201,7 @@
@Test
public void getSummary_BUBBLE_PREFERENCE_ALLisSelected_returnsAllString() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
@@ -214,7 +214,7 @@
@Test
public void getSummary_BUBBLE_PREFERENCE_SELECTEDisSelected_returnsSelectedString() {
- Settings.Global.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
+ Settings.Secure.putInt(mContext.getContentResolver(), NOTIFICATION_BUBBLES,
SYSTEM_WIDE_ON);
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();