mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Use user restrictions instead of isLinkedUser
Use a different API to query if the user is likely to have fewer apps installed. Bug: 8720520 Change-Id: Ic4cbca47679627b33e08fd83653f8d20de294675
This commit is contained in:
@@ -3796,9 +3796,13 @@ public final class Launcher extends Activity
|
||||
// seeded when they start up for the first time. Clings won't work well with that
|
||||
boolean supportsLimitedUsers =
|
||||
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN_MR2;
|
||||
if (supportsLimitedUsers) {
|
||||
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||
if (um.isLinkedUser()) return false;
|
||||
Account[] accounts = AccountManager.get(this).getAccounts();
|
||||
if (supportsLimitedUsers && accounts.length == 0) {
|
||||
UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
|
||||
Bundle restrictions = um.getUserRestrictions();
|
||||
if (restrictions.getBoolean(UserManager.DISALLOW_MODIFY_ACCOUNTS, false)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user