Merge "Add a new enum to support available/non-searchable settings"

This commit is contained in:
TreeHugger Robot
2018-05-10 23:20:21 +00:00
committed by Android (Google) Code Review

View File

@@ -30,7 +30,6 @@ import java.lang.reflect.InvocationTargetException;
import java.util.List; import java.util.List;
import androidx.preference.Preference; import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
/** /**
@@ -49,22 +48,27 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
* {@link #isSupported()}. * {@link #isSupported()}.
*/ */
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef({AVAILABLE, UNSUPPORTED_ON_DEVICE, DISABLED_FOR_USER, DISABLED_DEPENDENT_SETTING, @IntDef({AVAILABLE, AVAILABLE_UNSEARCHABLE, UNSUPPORTED_ON_DEVICE, DISABLED_FOR_USER,
CONDITIONALLY_UNAVAILABLE}) DISABLED_DEPENDENT_SETTING, CONDITIONALLY_UNAVAILABLE})
public @interface AvailabilityStatus { public @interface AvailabilityStatus {
} }
/** /**
* The setting is available. * The setting is available, and searchable to all search clients.
*/ */
public static final int AVAILABLE = 0; public static final int AVAILABLE = 0;
/**
* The setting is available, but is not searchable to any search client.
*/
public static final int AVAILABLE_UNSEARCHABLE = 1;
/** /**
* A generic catch for settings which are currently unavailable, but may become available in * A generic catch for settings which are currently unavailable, but may become available in
* the future. You should use {@link #DISABLED_FOR_USER} or {@link #DISABLED_DEPENDENT_SETTING} * the future. You should use {@link #DISABLED_FOR_USER} or {@link #DISABLED_DEPENDENT_SETTING}
* if they describe the condition more accurately. * if they describe the condition more accurately.
*/ */
public static final int CONDITIONALLY_UNAVAILABLE = 1; public static final int CONDITIONALLY_UNAVAILABLE = 2;
/** /**
* The setting is not, and will not supported by this device. * The setting is not, and will not supported by this device.
@@ -72,7 +76,7 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
* There is no guarantee that the setting page exists, and any links to the Setting should take * There is no guarantee that the setting page exists, and any links to the Setting should take
* you to the home page of Settings. * you to the home page of Settings.
*/ */
public static final int UNSUPPORTED_ON_DEVICE = 2; public static final int UNSUPPORTED_ON_DEVICE = 3;
/** /**
@@ -81,7 +85,7 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
* Links to the Setting should take you to the page of the Setting, even if it cannot be * Links to the Setting should take you to the page of the Setting, even if it cannot be
* changed. * changed.
*/ */
public static final int DISABLED_FOR_USER = 3; public static final int DISABLED_FOR_USER = 4;
/** /**
* The setting has a dependency in the Settings App which is currently blocking access. * The setting has a dependency in the Settings App which is currently blocking access.
@@ -98,7 +102,7 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
* Links to the Setting should take you to the page of the Setting, even if it cannot be * Links to the Setting should take you to the page of the Setting, even if it cannot be
* changed. * changed.
*/ */
public static final int DISABLED_DEPENDENT_SETTING = 4; public static final int DISABLED_DEPENDENT_SETTING = 5;
protected final String mPreferenceKey; protected final String mPreferenceKey;