Replace SystemUser checks with MainUser.
Bug: 257333623 Test: atest CommunalPreferenceControllerTest, atest UtilsTest, atest TimeoutToDockUserPreferenceControllerTest Change-Id: I5d2a818f9f35968ced1db7f9fa4b79432a502023
This commit is contained in:
@@ -1277,4 +1277,16 @@ public final class Utils extends com.android.settingslib.Utils {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns if the current user is able to use Dreams.
|
||||
*/
|
||||
public static boolean canCurrentUserDream(Context context) {
|
||||
final UserHandle mainUser = context.getSystemService(UserManager.class).getMainUser();
|
||||
if (mainUser == null) {
|
||||
return false;
|
||||
}
|
||||
return context.createContextAsUser(mainUser, 0).getSystemService(UserManager.class)
|
||||
.isUserForeground();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user