Restrict screen saver settings searches to enabled users.
If a user can't enable screen saver, they shouldn't be able to accidentally find screen saver related settings in Settings. Bug: 260276394 Test: atest ScreenSaverPreferenceControllerTest Test: manually by settings up a second user on a device that supports screen saver, switching to that user, and making sure that searches for "screen saver" don't accidentally reveal settings that can't be accessed. Merged-In: If2f465b2acb548455f0868507cf47217ea1a626f Change-Id: I96fb8f9c6c4960f203b51bb43994f7bafdcefdf5
This commit is contained in:
@@ -1229,4 +1229,22 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
public static int getHomepageIconColorHighlight(Context context) {
|
||||
return context.getColor(R.color.accent_select_primary_text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if dreams are available to the current user.
|
||||
*/
|
||||
public static boolean areDreamsAvailableToCurrentUser(Context context) {
|
||||
if (!context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_dreamsSupported)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!context.getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_dreamsOnlyEnabledForDockUser)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final UserManager userManager = context.getSystemService(UserManager.class);
|
||||
return userManager != null && userManager.isSystemUser();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user