Merge "Only call super.updateState when work profile exists" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
0a1019cc64
@@ -26,6 +26,7 @@ import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.UserHandle;
|
||||
import android.platform.test.annotations.EnableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.provider.Settings;
|
||||
|
||||
@@ -141,6 +142,17 @@ public class PoliteNotifWorkProfileToggleControllerTest {
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowSystemSettings.class)
|
||||
@EnableFlags(Flags.FLAG_POLITE_NOTIFICATIONS)
|
||||
public void isChecked_coolDownEnabled_noWorkProfile_shouldReturnFalse() {
|
||||
when(mAudioHelper.getManagedProfileId(any())).thenReturn(UserHandle.USER_NULL);
|
||||
mController = new PoliteNotifWorkProfileToggleController(mContext, PREFERENCE_KEY,
|
||||
mAudioHelper);
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowSystemSettings.class)
|
||||
public void setChecked_coolDownEnabled_setTrue_shouldEnablePoliteNotifForWorkProfile() {
|
||||
@@ -186,7 +198,6 @@ public class PoliteNotifWorkProfileToggleControllerTest {
|
||||
assertThat(mPreference.isVisible()).isTrue();
|
||||
}
|
||||
|
||||
|
||||
private void setCoolDownEnabled(boolean enabled) {
|
||||
Settings.System.putInt(mContext.getContentResolver(),
|
||||
Settings.System.NOTIFICATION_COOLDOWN_ENABLED, (enabled ? ON : OFF));
|
||||
|
Reference in New Issue
Block a user