Establish permanently unavailable settings
Distinguish between settings which are permanently unavailable on the device, and temporarily unavailable. This enables us to restrict which setting slices are exposed in onSliceGetDescendants. The primary changes in this CL are renaming: "DISABLED_UNSUPPORTED" -> "UNSUPPORTED_ON_DEVICE" to be more clear the the setting will cannot be accessed on the device, and, adding a new enum to encapsulate settings which are currently unavailable, but could be enabled in the future. Also remove UNAVAILABLE_UNKNOWN. Devs should never need this enum. Bug: 78910582 Fixes: 79245656 Test: robotests Change-Id: I42c2cedab66be2d76999795f46470a079cc1ec71 Merged-In: I58821a6cfd6134b3b351657b6edf5f74ead00643
This commit is contained in:
@@ -35,6 +35,6 @@ public class DataSaverController extends BasePreferenceController {
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_data_saver)
|
||||
? AVAILABLE
|
||||
: DISABLED_UNSUPPORTED;
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,6 @@ public class DeviceAdministratorsController extends BasePreferenceController {
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_device_administrators)
|
||||
? AVAILABLE
|
||||
: DISABLED_UNSUPPORTED;
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,6 @@ public class EnabledVrListenersController extends BasePreferenceController {
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_enabled_vr_listeners)
|
||||
? AVAILABLE
|
||||
: DISABLED_UNSUPPORTED;
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,6 @@ public class HighPowerAppsController extends BasePreferenceController {
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_high_power_apps)
|
||||
? AVAILABLE
|
||||
: DISABLED_UNSUPPORTED;
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,6 @@ public class PremiumSmsController extends BasePreferenceController {
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_premium_sms)
|
||||
? AVAILABLE
|
||||
: DISABLED_UNSUPPORTED;
|
||||
: UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class AppBatteryPreferenceController extends BasePreferenceController
|
||||
public int getAvailabilityStatus() {
|
||||
return mContext.getResources().getBoolean(R.bool.config_show_app_info_settings_battery)
|
||||
? AVAILABLE
|
||||
: DISABLED_UNSUPPORTED;
|
||||
: CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -56,7 +56,7 @@ public class AppDataUsagePreferenceController extends AppInfoPreferenceControlle
|
||||
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
return isBandwidthControlEnabled() ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||
return isBandwidthControlEnabled() ? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -105,11 +105,11 @@ public class AppMemoryPreferenceController extends BasePreferenceController
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (!mContext.getResources().getBoolean(R.bool.config_show_app_info_settings_memory)) {
|
||||
return DISABLED_UNSUPPORTED;
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(mContext)
|
||||
? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,7 +46,7 @@ public abstract class DefaultAppShortcutPreferenceControllerBase extends BasePre
|
||||
if (UserManager.get(mContext).isManagedProfile()) {
|
||||
return DISABLED_FOR_USER;
|
||||
}
|
||||
return hasAppCapability() ? AVAILABLE : DISABLED_UNSUPPORTED;
|
||||
return hasAppCapability() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,19 +55,19 @@ public class TimeSpentInAppPreferenceController extends BasePreferenceController
|
||||
@Override
|
||||
public int getAvailabilityStatus() {
|
||||
if (TextUtils.isEmpty(mPackageName)) {
|
||||
return DISABLED_UNSUPPORTED;
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
final List<ResolveInfo> resolved = mPackageManager.queryIntentActivities(mIntent,
|
||||
0 /* flags */);
|
||||
if (resolved == null || resolved.isEmpty()) {
|
||||
return DISABLED_UNSUPPORTED;
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
for (ResolveInfo info : resolved) {
|
||||
if (isSystemApp(info)) {
|
||||
return AVAILABLE;
|
||||
}
|
||||
}
|
||||
return DISABLED_UNSUPPORTED;
|
||||
return UNSUPPORTED_ON_DEVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user