diff --git a/res/xml/sound_settings.xml b/res/xml/sound_settings.xml index 7181e80b658..c3e0eef87b1 100644 --- a/res/xml/sound_settings.xml +++ b/res/xml/sound_settings.xml @@ -64,14 +64,6 @@ settings:searchable="false" settings:controller="com.android.settings.sound.HandsFreeProfileOutputPreferenceController"/> - - - changeSet = properties.getKeyset(); - - if (changeSet.contains(SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION)) { - boolean newVal = isSeparateNotificationConfigEnabled(); - if (newVal != mSeparateNotification) { - mSeparateNotification = newVal; - // Update UI if config change happens when Sound Settings page is on the foreground - if (mPreference != null) { - int status = getAvailabilityStatus(); - mPreference.setVisible(status == AVAILABLE - || status == DISABLED_DEPENDENT_SETTING); - if (status == DISABLED_DEPENDENT_SETTING) { - mPreference.setEnabled(false); - } - } - } - } - } - @OnLifecycleEvent(Lifecycle.Event.ON_RESUME) @Override public void onResume() { super.onResume(); mReceiver.register(true); - Binder.withCleanCallingIdentity(() - -> DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI, - ActivityThread.currentApplication().getMainExecutor(), this::onDeviceConfigChange)); } @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE) @@ -122,18 +90,13 @@ public class NotificationVolumePreferenceController extends public void onPause() { super.onPause(); mReceiver.register(false); - Binder.withCleanCallingIdentity(() -> - DeviceConfig.removeOnPropertiesChangedListener(this::onDeviceConfigChange)); } @Override public int getAvailabilityStatus() { - boolean separateNotification = isSeparateNotificationConfigEnabled(); return mContext.getResources().getBoolean(R.bool.config_show_notification_volume) - && !mHelper.isSingleVolume() && separateNotification - ? (mRingerMode == AudioManager.RINGER_MODE_NORMAL - ? AVAILABLE : DISABLED_DEPENDENT_SETTING) - : UNSUPPORTED_ON_DEVICE; + && !mHelper.isSingleVolume() ? (mRingerMode == AudioManager.RINGER_MODE_NORMAL + ? AVAILABLE : DISABLED_DEPENDENT_SETTING) : UNSUPPORTED_ON_DEVICE; } @Override diff --git a/src/com/android/settings/notification/RingVolumePreferenceController.java b/src/com/android/settings/notification/RingVolumePreferenceController.java index a8118c60a83..09d8ecc102d 100644 --- a/src/com/android/settings/notification/RingVolumePreferenceController.java +++ b/src/com/android/settings/notification/RingVolumePreferenceController.java @@ -16,28 +16,22 @@ package com.android.settings.notification; -import android.app.ActivityThread; import android.app.NotificationManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; -import android.os.Binder; import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.provider.DeviceConfig; import android.service.notification.NotificationListenerService; import androidx.lifecycle.OnLifecycleEvent; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.settings.R; import com.android.settingslib.core.lifecycle.Lifecycle; -import java.util.Set; - /** * This slider represents both ring and notification */ @@ -61,33 +55,14 @@ public class RingVolumePreferenceController extends mVibrateIconId = R.drawable.ic_volume_ringer_vibrate; mSilentIconId = R.drawable.ic_notifications_off_24dp; - mSeparateNotification = isSeparateNotificationConfigEnabled(); updateRingerMode(); } - /** - * As the responsibility of this slider changes, so should its title & icon - */ - private void onDeviceConfigChange(DeviceConfig.Properties properties) { - Set changeSet = properties.getKeyset(); - if (changeSet.contains(SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION)) { - boolean valueUpdated = readSeparateNotificationVolumeConfig(); - if (valueUpdated) { - updateEffectsSuppressor(); - selectPreferenceIconState(); - } - } - } - @OnLifecycleEvent(Lifecycle.Event.ON_RESUME) @Override public void onResume() { super.onResume(); mReceiver.register(true); - readSeparateNotificationVolumeConfig(); - Binder.withCleanCallingIdentity(() - -> DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI, - ActivityThread.currentApplication().getMainExecutor(), this::onDeviceConfigChange)); updateEffectsSuppressor(); selectPreferenceIconState(); @@ -101,8 +76,6 @@ public class RingVolumePreferenceController extends public void onPause() { super.onPause(); mReceiver.register(false); - Binder.withCleanCallingIdentity(() -> - DeviceConfig.removeOnPropertiesChangedListener(this::onDeviceConfigChange)); } @Override @@ -112,9 +85,7 @@ public class RingVolumePreferenceController extends @Override public int getAvailabilityStatus() { - boolean separateNotification = isSeparateNotificationConfigEnabled(); - return !separateNotification && !mHelper.isSingleVolume() - ? AVAILABLE : UNSUPPORTED_ON_DEVICE; + return UNSUPPORTED_ON_DEVICE; } @Override @@ -124,14 +95,10 @@ public class RingVolumePreferenceController extends @Override protected boolean hintsMatch(int hints) { - boolean notificationSeparated = isSeparateNotificationConfigEnabled(); return (hints & NotificationListenerService.HINT_HOST_DISABLE_CALL_EFFECTS) != 0 - || (hints & NotificationListenerService.HINT_HOST_DISABLE_EFFECTS) != 0 - || ((hints & NotificationListenerService.HINT_HOST_DISABLE_NOTIFICATION_EFFECTS) - != 0 && !notificationSeparated); + || (hints & NotificationListenerService.HINT_HOST_DISABLE_EFFECTS) != 0; } - private final class H extends Handler { private static final int UPDATE_EFFECTS_SUPPRESSOR = 1; private static final int UPDATE_RINGER_MODE = 2; diff --git a/src/com/android/settings/notification/RingerModeAffectedVolumePreferenceController.java b/src/com/android/settings/notification/RingerModeAffectedVolumePreferenceController.java index ec619b468bc..36877707257 100644 --- a/src/com/android/settings/notification/RingerModeAffectedVolumePreferenceController.java +++ b/src/com/android/settings/notification/RingerModeAffectedVolumePreferenceController.java @@ -21,14 +21,11 @@ import android.app.NotificationManager; import android.content.ComponentName; import android.content.Context; import android.media.AudioManager; -import android.os.Binder; import android.os.ServiceManager; import android.os.Vibrator; -import android.provider.DeviceConfig; import android.util.Log; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import java.util.Objects; @@ -48,11 +45,8 @@ public abstract class RingerModeAffectedVolumePreferenceController extends protected Vibrator mVibrator; protected int mRingerMode = AudioManager.RINGER_MODE_NORMAL; protected ComponentName mSuppressor; - protected boolean mSeparateNotification; protected INotificationManager mNoMan; - private static final boolean CONFIG_SEPARATE_NOTIFICATION_DEFAULT_VAL = false; - public RingerModeAffectedVolumePreferenceController(Context context, String key, String tag) { super(context, key); mTag = tag; @@ -118,28 +112,6 @@ public abstract class RingerModeAffectedVolumePreferenceController extends return mMuteIcon; } - protected boolean isSeparateNotificationConfigEnabled() { - return Binder.withCleanCallingIdentity(() - -> DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, - CONFIG_SEPARATE_NOTIFICATION_DEFAULT_VAL)); - } - - /** - * side effect: updates the cached value of the config - * @return has the config changed? - */ - protected boolean readSeparateNotificationVolumeConfig() { - boolean newVal = isSeparateNotificationConfigEnabled(); - - boolean valueUpdated = newVal != mSeparateNotification; - if (valueUpdated) { - mSeparateNotification = newVal; - } - - return valueUpdated; - } - /** * Updates UI Icon in response to ringer mode changes. * @return whether the ringer mode has changed. diff --git a/src/com/android/settings/notification/SeparateRingVolumePreferenceController.java b/src/com/android/settings/notification/SeparateRingVolumePreferenceController.java index e23dd384071..b8a99085f6d 100644 --- a/src/com/android/settings/notification/SeparateRingVolumePreferenceController.java +++ b/src/com/android/settings/notification/SeparateRingVolumePreferenceController.java @@ -16,7 +16,6 @@ package com.android.settings.notification; -import android.app.ActivityThread; import android.app.NotificationManager; import android.content.BroadcastReceiver; import android.content.Context; @@ -26,17 +25,13 @@ import android.media.AudioManager; import android.os.Handler; import android.os.Looper; import android.os.Message; -import android.provider.DeviceConfig; import android.service.notification.NotificationListenerService; import androidx.lifecycle.OnLifecycleEvent; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.settings.R; import com.android.settingslib.core.lifecycle.Lifecycle; -import java.util.Set; - /** * This slider is used to represent ring volume when ring is separated from notification */ @@ -60,32 +55,14 @@ public class SeparateRingVolumePreferenceController extends mVibrateIconId = R.drawable.ic_volume_ringer_vibrate; mSilentIconId = R.drawable.ic_ring_volume_off; - mSeparateNotification = isSeparateNotificationConfigEnabled(); updateRingerMode(); } - /** - * Show/hide settings - */ - private void onDeviceConfigChange(DeviceConfig.Properties properties) { - Set changeSet = properties.getKeyset(); - if (changeSet.contains(SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION)) { - boolean valueUpdated = readSeparateNotificationVolumeConfig(); - if (valueUpdated) { - updateEffectsSuppressor(); - selectPreferenceIconState(); - } - } - } - @OnLifecycleEvent(Lifecycle.Event.ON_RESUME) @Override public void onResume() { super.onResume(); mReceiver.register(true); - readSeparateNotificationVolumeConfig(); - DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI, - ActivityThread.currentApplication().getMainExecutor(), this::onDeviceConfigChange); updateEffectsSuppressor(); selectPreferenceIconState(); @@ -99,7 +76,6 @@ public class SeparateRingVolumePreferenceController extends public void onPause() { super.onPause(); mReceiver.register(false); - DeviceConfig.removeOnPropertiesChangedListener(this::onDeviceConfigChange); } @Override @@ -109,9 +85,7 @@ public class SeparateRingVolumePreferenceController extends @Override public int getAvailabilityStatus() { - boolean separateNotification = isSeparateNotificationConfigEnabled(); - return separateNotification && !mHelper.isSingleVolume() - ? AVAILABLE : UNSUPPORTED_ON_DEVICE; + return !mHelper.isSingleVolume() ? AVAILABLE : UNSUPPORTED_ON_DEVICE; } @Override @@ -125,8 +99,6 @@ public class SeparateRingVolumePreferenceController extends || (hints & NotificationListenerService.HINT_HOST_DISABLE_EFFECTS) != 0; } - - private final class H extends Handler { private static final int UPDATE_EFFECTS_SUPPRESSOR = 1; private static final int UPDATE_RINGER_MODE = 2; diff --git a/src/com/android/settings/notification/SoundSettings.java b/src/com/android/settings/notification/SoundSettings.java index 1cbfabb1d1b..b0d5d2a6d86 100644 --- a/src/com/android/settings/notification/SoundSettings.java +++ b/src/com/android/settings/notification/SoundSettings.java @@ -196,7 +196,6 @@ public class SoundSettings extends DashboardFragment implements OnActivityResult ArrayList volumeControllers = new ArrayList<>(); volumeControllers.add(use(AlarmVolumePreferenceController.class)); volumeControllers.add(use(MediaVolumePreferenceController.class)); - volumeControllers.add(use(RingVolumePreferenceController.class)); volumeControllers.add(use(SeparateRingVolumePreferenceController.class)); volumeControllers.add(use(NotificationVolumePreferenceController.class)); volumeControllers.add(use(CallVolumePreferenceController.class)); diff --git a/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java index 594ef625ffb..45a3e1f98e2 100644 --- a/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/NotificationVolumePreferenceControllerTest.java @@ -18,7 +18,6 @@ package com.android.settings.notification; import static com.google.common.truth.Truth.assertThat; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; @@ -26,15 +25,11 @@ import android.content.Context; import android.content.res.Resources; import android.media.AudioManager; import android.os.Vibrator; -import android.provider.DeviceConfig; import android.service.notification.NotificationListenerService; import android.telephony.TelephonyManager; import androidx.preference.PreferenceManager; -import androidx.preference.PreferenceScreen; -import androidx.test.core.app.ApplicationProvider; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.settings.core.BasePreferenceController; import com.android.settings.testutils.shadow.ShadowDeviceConfig; @@ -45,7 +40,6 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; -import org.robolectric.Shadows; import org.robolectric.annotation.Config; @RunWith(RobolectricTestRunner.class) @@ -64,9 +58,6 @@ public class NotificationVolumePreferenceControllerTest { @Mock private PreferenceManager mPreferenceManager; - private static final String READ_DEVICE_CONFIG_PERMISSION = - "android.permission.READ_DEVICE_CONFIG"; - private Context mContext; private NotificationVolumePreferenceController mController; @@ -97,34 +88,15 @@ public class NotificationVolumePreferenceControllerTest { assertThat(mController.isAvailable()).isFalse(); } - @Test - public void isAvailable_voiceCapable_aliasedWithRing_shouldReturnFalse() { - when(mResources.getBoolean( - com.android.settings.R.bool.config_show_notification_volume)).thenReturn(true); - - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); - - NotificationVolumePreferenceController controller = - new NotificationVolumePreferenceController(mContext); - when(mHelper.isSingleVolume()).thenReturn(false); - when(mTelephonyManager.isVoiceCapable()).thenReturn(true); - - assertThat(controller.isAvailable()).isFalse(); - } - /** * With the introduction of ring-notification volume separation, voice-capable devices could now * display the notification volume slider. */ @Test - public void isAvailable_voiceCapable_separatedFromRing_shouldReturnTrue() { + public void isAvailable_whenVoiceCapable_shouldReturnTrue() { when(mResources.getBoolean( com.android.settings.R.bool.config_show_notification_volume)).thenReturn(true); - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - NotificationVolumePreferenceController controller = new NotificationVolumePreferenceController(mContext); @@ -189,84 +161,13 @@ public class NotificationVolumePreferenceControllerTest { } @Test - public void enableSeparateNotificationConfig_controllerBecomesAvailable() { - PreferenceScreen screen = spy(new PreferenceScreen(mContext, null)); - VolumeSeekBarPreference volumeSeekBarPreference = mock(VolumeSeekBarPreference.class); - when(screen.getPreferenceManager()).thenReturn(mPreferenceManager); - when(screen.getContext()).thenReturn(mContext); - when(mResources.getBoolean( - com.android.settings.R.bool.config_show_notification_volume)).thenReturn(true); - // block the alternative condition to enable controller - when(mTelephonyManager.isVoiceCapable()).thenReturn(true); - when(mAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_NORMAL); - - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); - - NotificationVolumePreferenceController controller = - new NotificationVolumePreferenceController(mContext); - when(screen.findPreference(controller.getPreferenceKey())) - .thenReturn(volumeSeekBarPreference); - - // allow the controller to subscribe - Shadows.shadowOf((android.app.Application) ApplicationProvider.getApplicationContext()) - .grantPermissions(READ_DEVICE_CONFIG_PERMISSION); - controller.onResume(); - controller.displayPreference(screen); - - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, Boolean.toString(true), - false); - - assertThat(controller.getAvailabilityStatus()).isEqualTo( - BasePreferenceController.AVAILABLE); - } - - @Test - public void disableSeparateNotificationConfig_controllerBecomesUnavailable() { - PreferenceScreen screen = spy(new PreferenceScreen(mContext, null)); - VolumeSeekBarPreference volumeSeekBarPreference = mock(VolumeSeekBarPreference.class); - when(screen.getPreferenceManager()).thenReturn(mPreferenceManager); - when(screen.getContext()).thenReturn(mContext); - when(mResources.getBoolean( - com.android.settings.R.bool.config_show_notification_volume)).thenReturn(true); - - // block the alternative condition to enable controller - when(mTelephonyManager.isVoiceCapable()).thenReturn(true); - - when(mAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_NORMAL); - - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - NotificationVolumePreferenceController controller = - new NotificationVolumePreferenceController(mContext); - - when(screen.findPreference(controller.getPreferenceKey())) - .thenReturn(volumeSeekBarPreference); - - Shadows.shadowOf((android.app.Application) ApplicationProvider.getApplicationContext()) - .grantPermissions(READ_DEVICE_CONFIG_PERMISSION); - controller.onResume(); - controller.displayPreference(screen); - - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); - - assertThat(controller.getAvailabilityStatus() - == BasePreferenceController.UNSUPPORTED_ON_DEVICE).isTrue(); - } - - @Test - public void ringerModeSilent_unaliased_getAvailability_returnsDisabled() { + public void ringerModeSilent_getAvailability_returnsDisabled() { when(mResources.getBoolean( com.android.settings.R.bool.config_show_notification_volume)).thenReturn(true); when(mHelper.isSingleVolume()).thenReturn(false); when(mAudioManager.getRingerModeInternal()).thenReturn(AudioManager.RINGER_MODE_SILENT); - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - assertThat(mController.getAvailabilityStatus()) .isEqualTo(BasePreferenceController.DISABLED_DEPENDENT_SETTING); } diff --git a/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java index 6728fee0b45..e41492925b5 100644 --- a/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/RingVolumePreferenceControllerTest.java @@ -27,11 +27,9 @@ import android.content.Context; import android.content.res.Resources; import android.media.AudioManager; import android.os.Vibrator; -import android.provider.DeviceConfig; import android.service.notification.NotificationListenerService; import android.telephony.TelephonyManager; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.settings.core.BasePreferenceController; import com.android.settings.testutils.shadow.ShadowDeviceConfig; @@ -83,9 +81,6 @@ public class RingVolumePreferenceControllerTest { when(mContext.getResources()).thenReturn(mResources); mController = new RingVolumePreferenceController(mContext); mController.setAudioHelper(mHelper); - - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); } @Test @@ -110,7 +105,6 @@ public class RingVolumePreferenceControllerTest { @Test public void isAvailable_notSingleVolume_VoiceCapable_shouldReturnTrue() { - when(mHelper.isSingleVolume()).thenReturn(false); when(mTelephonyManager.isVoiceCapable()).thenReturn(true); @@ -139,10 +133,6 @@ public class RingVolumePreferenceControllerTest { */ @Test public void ringNotificationStreamsSeparate_controllerIsNotAvailable() { - - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - final RingVolumePreferenceController controller = new RingVolumePreferenceController(mContext); @@ -153,58 +143,19 @@ public class RingVolumePreferenceControllerTest { } @Test - public void setHintsRing_aliased_Matches() { - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); - - + public void setHintsRing_Matches() { assertThat(mController.hintsMatch( NotificationListenerService.HINT_HOST_DISABLE_CALL_EFFECTS)).isTrue(); } @Test - public void setHintsRingNotification_aliased_Matches() { - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); - + public void setHintsRingNotification_Matches() { assertThat(mController.hintsMatch(NotificationListenerService.HINT_HOST_DISABLE_EFFECTS)) .isTrue(); } @Test - public void setHintNotification_aliased_Matches() { - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); - - - assertThat(mController - .hintsMatch(NotificationListenerService.HINT_HOST_DISABLE_NOTIFICATION_EFFECTS)) - .isTrue(); - } - - @Test - public void setHintsRing_unaliased_Matches() { - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - - assertThat(mController.hintsMatch( - NotificationListenerService.HINT_HOST_DISABLE_CALL_EFFECTS)).isTrue(); - } - - @Test - public void setHintsRingNotification_unaliased_Matches() { - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - - assertThat(mController.hintsMatch(NotificationListenerService.HINT_HOST_DISABLE_EFFECTS)) - .isTrue(); - } - - @Test - public void setHintNotification_unaliased_doesNotMatch() { - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - + public void setHintNotification_doesNotMatch() { assertThat(mController .hintsMatch(NotificationListenerService.HINT_HOST_DISABLE_NOTIFICATION_EFFECTS)) .isFalse(); diff --git a/tests/robotests/src/com/android/settings/notification/SeparateRingVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/SeparateRingVolumePreferenceControllerTest.java index 7c9390ccbbd..2974af6f185 100644 --- a/tests/robotests/src/com/android/settings/notification/SeparateRingVolumePreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/notification/SeparateRingVolumePreferenceControllerTest.java @@ -27,10 +27,8 @@ import android.content.Context; import android.content.res.Resources; import android.media.AudioManager; import android.os.Vibrator; -import android.provider.DeviceConfig; import android.telephony.TelephonyManager; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.settings.testutils.shadow.ShadowDeviceConfig; import org.junit.Before; @@ -81,21 +79,11 @@ public class SeparateRingVolumePreferenceControllerTest { mController.setAudioHelper(mHelper); } - @Test - public void isAvailable_ringNotificationAliased_shouldReturnFalse() { - when(mHelper.isSingleVolume()).thenReturn(true); - when(mTelephonyManager.isVoiceCapable()).thenReturn(true); - - assertThat(mController.isAvailable()).isFalse(); - } - /** * Maintain that the device does not need to be voice capable to display this slider */ @Test - public void isAvailable_ringNotificationSeparated_isNotVoiceCapable_shouldReturnTrue() { - DeviceConfig.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); + public void isAvailable_whenNotVoiceCapable_shouldReturnTrue() { when(mHelper.isSingleVolume()).thenReturn(false); when(mTelephonyManager.isVoiceCapable()).thenReturn(false); diff --git a/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java b/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java index 9e84883b7e6..e7bc3295380 100644 --- a/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java +++ b/tests/robotests/src/com/android/settings/notification/SoundSettingsTest.java @@ -69,7 +69,7 @@ public class SoundSettingsTest { keys.addAll(XmlTestUtils.getKeysFromPreferenceXml(context, R.xml.zen_mode_settings)); // Add keys with hidden resources keys.add("alarm_volume"); - keys.add("ring_volume"); + keys.add("separate_ring_volume"); keys.add("notification_volume"); assertThat(keys).containsAtLeastElementsIn(niks); @@ -93,7 +93,7 @@ public class SoundSettingsTest { final int xmlId = settings.getPreferenceScreenResId(); final List keys = XmlTestUtils.getKeysFromPreferenceXml(context, xmlId); - int ring = keys.indexOf("ring_volume"); + int ring = keys.indexOf("separate_ring_volume"); int notification = keys.indexOf("notification_volume"); int alarm = keys.indexOf("alarm_volume");