Change bubble settings to use Secure rather than Global
Test: make -j40 RunSettingsRoboTests ROBOTEST_FILTER="Bubble" Bug: 173408780 Change-Id: I53fcd59c22c219551bd2eb6f0251acb5a03690ea
This commit is contained in:
@@ -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 @@ public class BubbleNotificationPreferenceControllerTest {
|
||||
@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 @@ public class BubbleNotificationPreferenceControllerTest {
|
||||
@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 @@ public class BubbleNotificationPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleNotificationPreferenceControllerTest {
|
||||
|
||||
@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);
|
||||
|
@@ -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 @@ public class BubbleSummaryNotificationPreferenceControllerTest {
|
||||
|
||||
@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);
|
||||
|
@@ -23,7 +23,7 @@ import static android.app.NotificationManager.BUBBLE_PREFERENCE_SELECTED;
|
||||
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.mockito.MockitoAnnotations;
|
||||
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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 class BubblePreferenceControllerTest {
|
||||
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 @@ public class BubblePreferenceControllerTest {
|
||||
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 class BubblePreferenceControllerTest {
|
||||
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 class BubblePreferenceControllerTest {
|
||||
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 class BubblePreferenceControllerTest {
|
||||
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 @@ public class BubblePreferenceControllerTest {
|
||||
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 @@ public class BubblePreferenceControllerTest {
|
||||
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 @@ public class BubblePreferenceControllerTest {
|
||||
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 @@ public class BubblePreferenceControllerTest {
|
||||
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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubblePreferenceControllerTest {
|
||||
|
||||
@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;
|
||||
|
@@ -21,7 +21,7 @@ import static android.app.NotificationManager.BUBBLE_PREFERENCE_ALL;
|
||||
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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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 @@ public class BubbleSummaryPreferenceControllerTest {
|
||||
|
||||
@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();
|
||||
|
Reference in New Issue
Block a user