Hides Screen Attention setting when AttentionService isn't installed.
Bug: 191696609 Test: make RunSettingsRoboTests Change-Id: I5a38b023db91202801a8a3e975f562ddcfe6696e
This commit is contained in:
@@ -138,13 +138,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();
|
||||
|
Reference in New Issue
Block a user