Merge "Hides Screen Attention setting when AttentionService isn't installed." into sc-dev

This commit is contained in:
Yi Jiang
2021-06-22 16:59:20 +00:00
committed by Android (Google) Code Review
3 changed files with 35 additions and 5 deletions

View File

@@ -139,13 +139,17 @@ public class AdaptiveSleepPreferenceController {
}
public static int isControllerAvailable(Context context) {
return context.getResources().getBoolean(
com.android.internal.R.bool.config_adaptive_sleep_available)
&& isAttentionServiceAvailable(context)
return isAdaptiveSleepSupported(context)
? AVAILABLE_UNSEARCHABLE
: UNSUPPORTED_ON_DEVICE;
}
static boolean isAdaptiveSleepSupported(Context context) {
return context.getResources().getBoolean(
com.android.internal.R.bool.config_adaptive_sleep_available)
&& isAttentionServiceAvailable(context);
}
private static boolean isAttentionServiceAvailable(Context context) {
final PackageManager packageManager = context.getPackageManager();
final String resolvePackage = packageManager.getAttentionServicePackageName();

View File

@@ -314,8 +314,7 @@ public class ScreenTimeoutSettings extends RadioButtonPickerFragment implements
}
private static boolean isScreenAttentionAvailable(Context context) {
return context.getResources().getBoolean(
com.android.internal.R.bool.config_adaptive_sleep_available);
return AdaptiveSleepPreferenceController.isAdaptiveSleepSupported(context);
}
private static class TimeoutCandidateInfo extends CandidateInfo {