Merge "Hides Screen Attention setting when AttentionService isn't installed." into sc-dev
This commit is contained in:
@@ -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();
|
||||
|
@@ -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 {
|
||||
|
Reference in New Issue
Block a user