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:
@@ -90,6 +90,11 @@ public class AccessibilitySlicePreferenceController extends TogglePreferenceCont
|
||||
return getAccessibilityServiceInfo() == null ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private AccessibilityServiceInfo getAccessibilityServiceInfo() {
|
||||
final AccessibilityManager accessibilityManager = mContext.getSystemService(
|
||||
AccessibilityManager.class);
|
||||
|
@@ -234,6 +234,23 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the controller should be used as a Slice.
|
||||
* <p>
|
||||
* Important criteria for a Slice are:
|
||||
* - Must be secure
|
||||
* - Must not be a privacy leak
|
||||
* - Must be understandable as a stand-alone Setting.
|
||||
* <p>
|
||||
* This does not guarantee the setting is available. {@link #isAvailable()} should sill be
|
||||
* called.
|
||||
*
|
||||
* @return {@code true} if the controller should be used externally as a Slice.
|
||||
*/
|
||||
public boolean isSliceable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates non-indexable keys for search provider.
|
||||
*
|
||||
|
@@ -19,6 +19,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.settings.R;
|
||||
@@ -54,6 +55,11 @@ public class AmbientDisplayAlwaysOnPreferenceController extends TogglePreference
|
||||
return isAvailable(mConfig) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "ambient_display_always_on");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return mConfig.alwaysOnEnabled(MY_USER);
|
||||
|
@@ -20,6 +20,7 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.hardware.AmbientDisplayConfiguration;
|
||||
import com.android.settings.R;
|
||||
@@ -90,6 +91,11 @@ public class AmbientDisplayNotificationsPreferenceController extends
|
||||
return mConfig.pulseOnNotificationAvailable() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "ambient_display_notification");
|
||||
}
|
||||
|
||||
@Override
|
||||
//TODO (b/69808376): Remove result payload
|
||||
public ResultPayload getResultPayload() {
|
||||
|
@@ -16,6 +16,7 @@ package com.android.settings.display;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.DisplaySettings;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
@@ -60,6 +61,11 @@ public class AutoBrightnessPreferenceController extends TogglePreferenceControll
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "auto_brightness");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultPayload getResultPayload() {
|
||||
// TODO remove result payload
|
||||
|
@@ -15,6 +15,7 @@ package com.android.settings.display;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.preference.Preference;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto;
|
||||
import com.android.internal.view.RotationPolicy;
|
||||
@@ -71,7 +72,12 @@ public class AutoRotatePreferenceController extends TogglePreferenceController i
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return RotationPolicy.isRotationLockToggleVisible(mContext)
|
||||
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "auto_rotate");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -19,6 +19,7 @@ package com.android.settings.display;
|
||||
import android.content.Context;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
@@ -53,6 +54,11 @@ public class NightDisplayActivationPreferenceController extends TogglePreference
|
||||
return ColorDisplayController.isAvailable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "night_display_activated");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
|
@@ -16,9 +16,12 @@
|
||||
|
||||
package com.android.settings.display;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.app.ColorDisplayController;
|
||||
import com.android.settings.core.SliderPreferenceController;
|
||||
import com.android.settings.widget.SeekBarPreference;
|
||||
@@ -42,6 +45,11 @@ public class NightDisplayIntensityPreferenceController extends SliderPreferenceC
|
||||
return AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "night_display_temperature");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayPreference(PreferenceScreen screen) {
|
||||
super.displayPreference(screen);
|
||||
|
@@ -23,6 +23,7 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.provider.Settings;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.DatabaseIndexingUtils;
|
||||
@@ -61,6 +62,11 @@ public class DoubleTapPowerPreferenceController extends GesturePreferenceControl
|
||||
return isGestureAvailable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_double_tap_power");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getVideoPrefKey() {
|
||||
return PREF_KEY_VIDEO;
|
||||
|
@@ -90,6 +90,11 @@ public class DoubleTapScreenPreferenceController extends GesturePreferenceContro
|
||||
return AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_double_tap_screen");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
return Settings.Secure.putInt(mContext.getContentResolver(), SECURE_KEY,
|
||||
|
@@ -71,6 +71,11 @@ public class DoubleTwistPreferenceController extends GesturePreferenceController
|
||||
return isGestureAvailable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_double_twist");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getVideoPrefKey() {
|
||||
return PREF_KEY_VIDEO;
|
||||
|
@@ -83,6 +83,11 @@ public class PickupGesturePreferenceController extends GesturePreferenceControll
|
||||
return AVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_pick_up");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getVideoPrefKey() {
|
||||
return PREF_KEY_VIDEO;
|
||||
|
@@ -21,6 +21,7 @@ import static android.provider.Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.Utils;
|
||||
|
||||
@@ -59,6 +60,11 @@ public class SwipeToNotificationPreferenceController extends GesturePreferenceCo
|
||||
return isAvailable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_swipe_down_fingerprint");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setChecked(boolean isChecked) {
|
||||
setSwipeToNotification(mContext, isChecked);
|
||||
|
@@ -22,6 +22,7 @@ import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.UserManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.R;
|
||||
|
||||
@@ -60,6 +61,11 @@ public class SwipeUpPreferenceController extends GesturePreferenceController {
|
||||
return isGestureAvailable(mContext) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "gesture_swipe_up");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getVideoPrefKey() {
|
||||
return PREF_KEY_VIDEO;
|
||||
|
@@ -23,6 +23,7 @@ import android.os.SystemProperties;
|
||||
import androidx.preference.SwitchPreference;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.internal.telephony.TelephonyIntents;
|
||||
import com.android.internal.telephony.TelephonyProperties;
|
||||
@@ -90,6 +91,11 @@ public class AirplaneModePreferenceController extends TogglePreferenceController
|
||||
&& !context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "toggle_airplane");
|
||||
}
|
||||
|
||||
@Override
|
||||
@AvailabilityStatus
|
||||
public int getAvailabilityStatus() {
|
||||
|
@@ -28,10 +28,10 @@ import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.TwoStatePreference;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.core.PreferenceControllerMixin;
|
||||
import com.android.settings.core.TogglePreferenceController;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.search.DatabaseIndexingUtils;
|
||||
import com.android.settings.search.InlineSwitchPayload;
|
||||
@@ -88,6 +88,11 @@ public class BadgingNotificationPreferenceController extends TogglePreferenceCon
|
||||
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "notification_badging");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChecked() {
|
||||
return Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.notification;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
@@ -37,6 +38,11 @@ public class CallVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
&& !mHelper.isSingleVolume() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), "call_volume");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAudioStream() {
|
||||
if (mAudioManager.isBluetoothScoOn()) {
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.notification;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
@@ -37,6 +38,11 @@ public class MediaVolumePreferenceController extends
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), KEY_MEDIA_VOLUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY_MEDIA_VOLUME;
|
||||
|
@@ -18,6 +18,7 @@ package com.android.settings.notification;
|
||||
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
@@ -38,6 +39,11 @@ public class NotificationVolumePreferenceController extends
|
||||
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), KEY_NOTIFICATION_VOLUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return KEY_NOTIFICATION_VOLUME;
|
||||
|
@@ -29,6 +29,7 @@ import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Vibrator;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Utils;
|
||||
@@ -89,6 +90,11 @@ public class RingVolumePreferenceController extends VolumeSeekBarPreferenceContr
|
||||
? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return TextUtils.equals(getPreferenceKey(), KEY_RING_VOLUME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAudioStream() {
|
||||
return AudioManager.STREAM_RING;
|
||||
|
@@ -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);
|
||||
|
@@ -23,9 +23,11 @@ import android.content.ContentResolver;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.provider.Settings;
|
||||
import android.provider.SettingsSlicesContract;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.KeyValueListParser;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
|
||||
@@ -42,6 +44,7 @@ import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -115,10 +118,13 @@ public class SettingsSliceProvider extends SliceProvider {
|
||||
@VisibleForTesting
|
||||
Map<Uri, SliceData> mSliceDataCache;
|
||||
|
||||
private final KeyValueListParser mParser;
|
||||
|
||||
final Set<Uri> mRegisteredUris = new ArraySet<>();
|
||||
|
||||
public SettingsSliceProvider() {
|
||||
super(READ_SEARCH_INDEXABLES);
|
||||
mParser = new KeyValueListParser(',');
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -352,4 +358,32 @@ public class SettingsSliceProvider extends SliceProvider {
|
||||
SliceBroadcastRelay.registerReceiver(getContext(), sliceUri, SliceBroadcastReceiver.class,
|
||||
intentFilter);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
Set<String> getBlockedKeys() {
|
||||
final String value = Settings.Global.getString(getContext().getContentResolver(),
|
||||
Settings.Global.BLOCKED_SLICES);
|
||||
final Set<String> set = new ArraySet<>();
|
||||
|
||||
try {
|
||||
mParser.setString(value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.e(TAG, "Bad Settings Slices Whitelist flags", e);
|
||||
return set;
|
||||
}
|
||||
|
||||
final String[] parsedValues = parseStringArray(value);
|
||||
Collections.addAll(set, parsedValues);
|
||||
return set;
|
||||
}
|
||||
|
||||
private String[] parseStringArray(String value) {
|
||||
if (value != null) {
|
||||
String[] parts = value.split(":");
|
||||
if (parts.length > 0) {
|
||||
return parts;
|
||||
}
|
||||
}
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ package com.android.settings.slices;
|
||||
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_CONTROLLER;
|
||||
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_ICON;
|
||||
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_KEY;
|
||||
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_KEYWORDS;
|
||||
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_PLATFORM_SLICE_FLAG;
|
||||
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_SUMMARY;
|
||||
import static com.android.settings.core.PreferenceXmlParserUtils.METADATA_TITLE;
|
||||
@@ -44,6 +43,7 @@ import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.accessibility.AccessibilitySettings;
|
||||
import com.android.settings.accessibility.AccessibilitySlicePreferenceController;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.PreferenceXmlParserUtils;
|
||||
import com.android.settings.core.PreferenceXmlParserUtils.MetadataFlag;
|
||||
import com.android.settings.dashboard.DashboardFragment;
|
||||
@@ -194,6 +194,7 @@ class SliceDataConverter {
|
||||
if (TextUtils.isEmpty(controllerClassName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final String key = bundle.getString(METADATA_KEY);
|
||||
final String title = bundle.getString(METADATA_TITLE);
|
||||
final String summary = bundle.getString(METADATA_SUMMARY);
|
||||
@@ -214,7 +215,13 @@ class SliceDataConverter {
|
||||
.setPlatformDefined(isPlatformSlice)
|
||||
.build();
|
||||
|
||||
xmlSliceData.add(xmlSlice);
|
||||
final BasePreferenceController controller =
|
||||
SliceBuilderUtils.getPreferenceController(mContext, xmlSlice);
|
||||
|
||||
// Only add pre-approved Slices available on the device.
|
||||
if (controller.isAvailable() && controller.isSliceable()) {
|
||||
xmlSliceData.add(xmlSlice);
|
||||
}
|
||||
}
|
||||
} catch (SliceData.InvalidSliceDataException e) {
|
||||
Log.w(TAG, "Invalid data when building SliceData for " + fragmentName, e);
|
||||
|
@@ -150,4 +150,19 @@ public class AmbientDisplayAlwaysOnPreferenceControllerTest {
|
||||
|
||||
assertThat(newValue).isEqualTo(currentValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final AmbientDisplayAlwaysOnPreferenceController controller =
|
||||
new AmbientDisplayAlwaysOnPreferenceController(mContext,
|
||||
"ambient_display_always_on");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final AmbientDisplayAlwaysOnPreferenceController controller =
|
||||
new AmbientDisplayAlwaysOnPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -182,4 +182,19 @@ public class AmbientDisplayNotificationsPreferenceControllerTest {
|
||||
|
||||
assertThat(newValue).isEqualTo(currentValue);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final AmbientDisplayNotificationsPreferenceController controller =
|
||||
new AmbientDisplayNotificationsPreferenceController(mContext,
|
||||
"ambient_display_notification");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final AmbientDisplayNotificationsPreferenceController controller =
|
||||
new AmbientDisplayNotificationsPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -93,4 +93,19 @@ public class AutoBrightnessPreferenceControllerTest {
|
||||
|
||||
assertThat(newValue).isEqualTo(SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final AutoBrightnessPreferenceController controller =
|
||||
new AutoBrightnessPreferenceController(mContext,
|
||||
"auto_brightness");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final AutoBrightnessPreferenceController controller =
|
||||
new AutoBrightnessPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -104,7 +104,7 @@ public class AutoRotatePreferenceControllerTest {
|
||||
@Test
|
||||
public void testGetAvailabilityStatus() {
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(BasePreferenceController
|
||||
.CONDITIONALLY_UNAVAILABLE);
|
||||
.UNSUPPORTED_ON_DEVICE);
|
||||
|
||||
enableAutoRotationPreference();
|
||||
|
||||
@@ -114,7 +114,7 @@ public class AutoRotatePreferenceControllerTest {
|
||||
disableAutoRotationPreference();
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(BasePreferenceController
|
||||
.CONDITIONALLY_UNAVAILABLE);
|
||||
.UNSUPPORTED_ON_DEVICE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -144,6 +144,20 @@ public class AutoRotatePreferenceControllerTest {
|
||||
assertThat(RotationPolicy.isRotationLocked(mContext)).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final AutoRotatePreferenceController controller =
|
||||
new AutoRotatePreferenceController(mContext, "auto_rotate");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final AutoRotatePreferenceController controller =
|
||||
new AutoRotatePreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
|
||||
private void enableAutoRotationPreference() {
|
||||
when(mPackageManager.hasSystemFeature(anyString())).thenReturn(true);
|
||||
when(mContext.getResources().getBoolean(anyInt())).thenReturn(true);
|
||||
|
@@ -72,6 +72,20 @@ public class NightDisplayActivationPreferenceControllerTest {
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final NightDisplayActivationPreferenceController controller =
|
||||
new NightDisplayActivationPreferenceController(mContext,"night_display_activated");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final NightDisplayActivationPreferenceController controller =
|
||||
new NightDisplayActivationPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onClick_activates() {
|
||||
Secure.putInt(mContext.getContentResolver(), Secure.NIGHT_DISPLAY_ACTIVATED, 0);
|
||||
|
@@ -76,4 +76,18 @@ public class NightDisplayIntensityPreferenceControllerTest {
|
||||
Secure.NIGHT_DISPLAY_COLOR_TEMPERATURE, -1))
|
||||
.isEqualTo(3030);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final NightDisplayIntensityPreferenceController controller =
|
||||
new NightDisplayIntensityPreferenceController(mContext,"night_display_temperature");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final NightDisplayIntensityPreferenceController controller =
|
||||
new NightDisplayIntensityPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -17,10 +17,13 @@
|
||||
package com.android.settings.gestures;
|
||||
|
||||
import static android.provider.Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED;
|
||||
|
||||
import static com.android.settings.gestures.DoubleTapPowerPreferenceController.OFF;
|
||||
import static com.android.settings.gestures.DoubleTapPowerPreferenceController.ON;
|
||||
import static com.android.settings.gestures.DoubleTapPowerPreferenceController.isSuggestionComplete;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
@@ -29,6 +32,7 @@ import android.content.SharedPreferences;
|
||||
import android.provider.Settings;
|
||||
|
||||
import com.android.settings.dashboard.suggestions.SuggestionFeatureProviderImpl;
|
||||
import com.android.settings.display.AmbientDisplayAlwaysOnPreferenceController;
|
||||
import com.android.settings.search.InlinePayload;
|
||||
import com.android.settings.search.InlineSwitchPayload;
|
||||
import com.android.settings.search.ResultPayload;
|
||||
@@ -67,7 +71,8 @@ public class DoubleTapPowerPreferenceControllerTest {
|
||||
@Test
|
||||
public void isAvailable_configIsTrue_shouldReturnTrue() {
|
||||
SettingsShadowResources.overrideResource(
|
||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, Boolean.TRUE);
|
||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled,
|
||||
Boolean.TRUE);
|
||||
|
||||
assertThat(mController.isAvailable()).isTrue();
|
||||
}
|
||||
@@ -75,7 +80,8 @@ public class DoubleTapPowerPreferenceControllerTest {
|
||||
@Test
|
||||
public void isAvailable_configIsTrue_shouldReturnFalse() {
|
||||
SettingsShadowResources.overrideResource(
|
||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, Boolean.FALSE);
|
||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled,
|
||||
Boolean.FALSE);
|
||||
|
||||
assertThat(mController.isAvailable()).isFalse();
|
||||
}
|
||||
@@ -101,7 +107,7 @@ public class DoubleTapPowerPreferenceControllerTest {
|
||||
@Test
|
||||
public void testPreferenceController_ProperResultPayloadType() {
|
||||
DoubleTapPowerPreferenceController controller =
|
||||
new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER);
|
||||
new DoubleTapPowerPreferenceController(mContext, KEY_DOUBLE_TAP_POWER);
|
||||
ResultPayload payload = controller.getResultPayload();
|
||||
assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
|
||||
}
|
||||
@@ -111,7 +117,7 @@ public class DoubleTapPowerPreferenceControllerTest {
|
||||
public void testSetValue_updatesCorrectly() {
|
||||
int newValue = 1;
|
||||
Settings.Secure.putInt(mContentResolver,
|
||||
Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
|
||||
Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, 0);
|
||||
|
||||
InlinePayload payload = ((InlineSwitchPayload) mController.getResultPayload());
|
||||
payload.setValue(mContext, newValue);
|
||||
@@ -148,7 +154,7 @@ public class DoubleTapPowerPreferenceControllerTest {
|
||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true);
|
||||
// No stored value in shared preferences if not visited yet.
|
||||
final SharedPreferences prefs =
|
||||
new SuggestionFeatureProviderImpl(mContext).getSharedPrefs(mContext);
|
||||
new SuggestionFeatureProviderImpl(mContext).getSharedPrefs(mContext);
|
||||
assertThat(isSuggestionComplete(mContext, prefs)).isFalse();
|
||||
}
|
||||
|
||||
@@ -158,9 +164,23 @@ public class DoubleTapPowerPreferenceControllerTest {
|
||||
com.android.internal.R.bool.config_cameraDoubleTapPowerGestureEnabled, true);
|
||||
// No stored value in shared preferences if not visited yet.
|
||||
final SharedPreferences prefs =
|
||||
new SuggestionFeatureProviderImpl(mContext).getSharedPrefs(mContext);
|
||||
new SuggestionFeatureProviderImpl(mContext).getSharedPrefs(mContext);
|
||||
prefs.edit().putBoolean(DoubleTapPowerSettings.PREF_KEY_SUGGESTION_COMPLETE, true).commit();
|
||||
|
||||
assertThat(isSuggestionComplete(mContext, prefs)).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final DoubleTapPowerPreferenceController controller =
|
||||
new DoubleTapPowerPreferenceController(mContext, "gesture_double_tap_power");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final DoubleTapPowerPreferenceController controller =
|
||||
new DoubleTapPowerPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -178,5 +178,20 @@ public class DoubleTapScreenPreferenceControllerTest {
|
||||
final int availabilityStatus = mController.getAvailabilityStatus();
|
||||
|
||||
assertThat(availabilityStatus).isEqualTo(AVAILABLE);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final DoubleTapScreenPreferenceController controller =
|
||||
new DoubleTapScreenPreferenceController(mContext,"gesture_double_tap_screen");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final DoubleTapScreenPreferenceController controller =
|
||||
new DoubleTapScreenPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -155,4 +155,18 @@ public class DoubleTwistPreferenceControllerTest {
|
||||
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final DoubleTwistPreferenceController controller =
|
||||
new DoubleTwistPreferenceController(mContext,"gesture_double_twist");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final DoubleTwistPreferenceController controller =
|
||||
new DoubleTwistPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -170,4 +170,18 @@ public class PickupGesturePreferenceControllerTest {
|
||||
|
||||
assertThat(availabilityStatus).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final PickupGesturePreferenceController controller =
|
||||
new PickupGesturePreferenceController(mContext,"gesture_pick_up");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final PickupGesturePreferenceController controller =
|
||||
new PickupGesturePreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -168,4 +168,18 @@ public class SwipeToNotificationPreferenceControllerTest {
|
||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT))
|
||||
.thenReturn(enabled);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final SwipeToNotificationPreferenceController controller = new
|
||||
SwipeToNotificationPreferenceController(mContext,"gesture_swipe_down_fingerprint");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final SwipeToNotificationPreferenceController controller =
|
||||
new SwipeToNotificationPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -123,4 +123,18 @@ public class SwipeUpPreferenceControllerTest {
|
||||
mController.setChecked(false);
|
||||
assertThat(mController.isChecked()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final SwipeUpPreferenceController controller =
|
||||
new SwipeUpPreferenceController(mContext,"gesture_swipe_up");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final SwipeUpPreferenceController controller =
|
||||
new SwipeUpPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -177,4 +177,18 @@ public class AirplaneModePreferenceControllerTest {
|
||||
|
||||
assertThat(mPreference.isChecked()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final AirplaneModePreferenceController controller =
|
||||
new AirplaneModePreferenceController(mContext,"toggle_airplane");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final AirplaneModePreferenceController controller =
|
||||
new AirplaneModePreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -183,4 +183,19 @@ public class BadgingNotificationPreferenceControllerTest {
|
||||
|
||||
assertThat(updatedValue).isEqualTo(ON);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final BadgingNotificationPreferenceController controller =
|
||||
new BadgingNotificationPreferenceController(mContext,
|
||||
"notification_badging");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final BadgingNotificationPreferenceController controller =
|
||||
new BadgingNotificationPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -92,4 +92,18 @@ public class CallVolumePreferenceControllerTest {
|
||||
|
||||
assertThat(mController.getAudioStream()).isEqualTo(AudioManager.STREAM_BLUETOOTH_SCO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final CallVolumePreferenceController controller =
|
||||
new CallVolumePreferenceController(mContext,"call_volume");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final CallVolumePreferenceController controller =
|
||||
new CallVolumePreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -95,4 +95,11 @@ public class NotificationVolumePreferenceControllerTest {
|
||||
public void getAudioStream_shouldReturnNotification() {
|
||||
assertThat(mController.getAudioStream()).isEqualTo(AudioManager.STREAM_NOTIFICATION);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final NotificationVolumePreferenceController controller =
|
||||
new NotificationVolumePreferenceController(mContext);
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
}
|
||||
|
@@ -97,4 +97,11 @@ public class RingVolumePreferenceControllerTest {
|
||||
public void getAudioStream_shouldReturnRing() {
|
||||
assertThat(mController.getAudioStream()).isEqualTo(AudioManager.STREAM_RING);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final RingVolumePreferenceController controller =
|
||||
new RingVolumePreferenceController(mContext);
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
}
|
||||
|
@@ -183,4 +183,18 @@ public class VibrateWhenRingPreferenceControllerTest {
|
||||
assertThat(shadowContentResolver.getContentObservers(
|
||||
Settings.System.getUriFor(VIBRATE_WHEN_RINGING))).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableCorrectKey_returnsTrue() {
|
||||
final VibrateWhenRingPreferenceController controller =
|
||||
new VibrateWhenRingPreferenceController(mContext, "vibrate_when_ringing");
|
||||
assertThat(controller.isSliceable()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isSliceableIncorrectKey_returnsFalse() {
|
||||
final VibrateWhenRingPreferenceController controller =
|
||||
new VibrateWhenRingPreferenceController(mContext, "bad_key");
|
||||
assertThat(controller.isSliceable()).isFalse();
|
||||
}
|
||||
}
|
||||
|
@@ -35,4 +35,9 @@ public class FakePreferenceController extends BasePreferenceController {
|
||||
public int getSliceType() {
|
||||
return SliceData.SliceType.SLIDER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -70,6 +70,11 @@ public class SlicesDatabaseAccessorTest {
|
||||
mAccessor = spy(new SlicesDatabaseAccessor(mContext));
|
||||
mDb = SlicesDatabaseHelper.getInstance(mContext).getWritableDatabase();
|
||||
SlicesDatabaseHelper.getInstance(mContext).setIndexedState();
|
||||
|
||||
// Register the fake a11y Service
|
||||
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(
|
||||
RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
|
||||
shadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -173,10 +178,6 @@ public class SlicesDatabaseAccessorTest {
|
||||
public void getSliceKeys_indexesDatabase() {
|
||||
// Force new indexing
|
||||
Locale.setDefault(new Locale("ca"));
|
||||
// Register the fake a11y Service
|
||||
ShadowAccessibilityManager shadowAccessibilityManager = Shadow.extract(
|
||||
RuntimeEnvironment.application.getSystemService(AccessibilityManager.class));
|
||||
shadowAccessibilityManager.setInstalledAccessibilityServiceList(new ArrayList<>());
|
||||
final SearchFeatureProvider provider = new SearchFeatureProviderImpl();
|
||||
final SlicesFeatureProvider sliceProvider = spy(new SlicesFeatureProviderImpl());
|
||||
final FakeFeatureFactory factory = FakeFeatureFactory.setupForTest();
|
||||
|
@@ -53,4 +53,9 @@ public class FakeSliderController extends SliderPreferenceController {
|
||||
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||
AVAILABILITY_KEY, AVAILABLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -62,4 +62,9 @@ public class FakeToggleController extends TogglePreferenceController {
|
||||
public IntentFilter getIntentFilter() {
|
||||
return INTENT_FILTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -18,4 +18,9 @@ public class FakeUnavailablePreferenceController extends BasePreferenceControlle
|
||||
return Settings.Global.getInt(mContext.getContentResolver(),
|
||||
AVAILABILITY_KEY, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSliceable() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user