Add isSliceable API to BasePrefController
Only support explicitly approved Settings Slices, dictated by controllers which return true for the new method isSliceable. Updating the supported settings to a whitelist means that the method to return all available slices must be updated, and checking slicability when we index slices. Test: robotests Bug: 79779103 Change-Id: Ib2b9690cdd0036b5cc4a1cb846c52bce7c824ab9
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.notification;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
@@ -33,9 +34,12 @@ public class MediaVolumePreferenceControllerTest {
|
||||
|
||||
private MediaVolumePreferenceController mController;
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
mController = new MediaVolumePreferenceController(RuntimeEnvironment.application);
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new MediaVolumePreferenceController(mContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -53,4 +57,11 @@ public class MediaVolumePreferenceControllerTest {
|
||||
public void getAudioStream_shouldReturnMusic() {
|
||||
assertThat(mController.getAudioStream()).isEqualTo(AudioManager.STREAM_MUSIC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final MediaVolumePreferenceController controller = new MediaVolumePreferenceController(
|
||||
mContext);
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user