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:
Matthew Fritze
2018-05-18 17:59:26 -07:00
parent 49d8b0a3e4
commit bf1f5b5813
47 changed files with 475 additions and 18 deletions

View File

@@ -24,6 +24,8 @@ import android.database.ContentObserver;
import android.net.Uri;
import android.os.Handler;
import android.provider.Settings;
import android.text.TextUtils;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
@@ -63,6 +65,11 @@ public class VibrateWhenRingPreferenceController extends TogglePreferenceControl
return Utils.isVoiceCapable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
public boolean isSliceable() {
return TextUtils.equals(getPreferenceKey(), "vibrate_when_ringing");
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);