Merge "Establish permanently unavailable settings"

This commit is contained in:
android-build-team Robot
2018-05-09 18:14:32 +00:00
committed by Android (Google) Code Review
113 changed files with 185 additions and 207 deletions

View File

@@ -49,8 +49,8 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
* {@link #isSupported()}.
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef({AVAILABLE, DISABLED_UNSUPPORTED, DISABLED_FOR_USER, DISABLED_DEPENDENT_SETTING,
UNAVAILABLE_UNKNOWN})
@IntDef({AVAILABLE, UNSUPPORTED_ON_DEVICE, DISABLED_FOR_USER, DISABLED_DEPENDENT_SETTING,
CONDITIONALLY_UNAVAILABLE})
public @interface AvailabilityStatus {
}
@@ -60,12 +60,20 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
public static final int AVAILABLE = 0;
/**
* The setting is not supported by the device.
* 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}
* if they describe the condition more accurately.
*/
public static final int CONDITIONALLY_UNAVAILABLE = 1;
/**
* The setting is not, and will not supported by this device.
* <p>
* There is no guarantee that the setting page exists, and any links to the Setting should take
* you to the home page of Settings.
*/
public static final int DISABLED_UNSUPPORTED = 1;
public static final int UNSUPPORTED_ON_DEVICE = 2;
/**
* The setting cannot be changed by the current user.
@@ -73,7 +81,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
* changed.
*/
public static final int DISABLED_FOR_USER = 2;
public static final int DISABLED_FOR_USER = 3;
/**
* The setting has a dependency in the Settings App which is currently blocking access.
@@ -90,15 +98,8 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
* Links to the Setting should take you to the page of the Setting, even if it cannot be
* changed.
*/
public static final int DISABLED_DEPENDENT_SETTING = 3;
public static final int DISABLED_DEPENDENT_SETTING = 4;
/**
* A catch-all case for internal errors and inexplicable unavailability.
* <p>
* There is no guarantee that the setting page exists, and any links to the Setting should take
* you to the home page of Settings.
*/
public static final int UNAVAILABLE_UNKNOWN = 4;
protected final String mPreferenceKey;
@@ -181,8 +182,8 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
@Override
public final boolean isAvailable() {
final int availabilityStatus = getAvailabilityStatus();
return (availabilityStatus == AVAILABLE) ||
(availabilityStatus == DISABLED_DEPENDENT_SETTING);
return (availabilityStatus == AVAILABLE
|| availabilityStatus == DISABLED_DEPENDENT_SETTING);
}
/**
@@ -193,7 +194,7 @@ public abstract class BasePreferenceController extends AbstractPreferenceControl
* Note that a return value of {@code true} does not mean that the setting is available.
*/
public final boolean isSupported() {
return getAvailabilityStatus() != DISABLED_UNSUPPORTED;
return getAvailabilityStatus() != UNSUPPORTED_ON_DEVICE;
}
/**