am d59b0643: Use user restrictions instead of isLinkedUser

* commit 'd59b064398e101181b2192dfbc6425024dc49049':
  Use user restrictions instead of isLinkedUser
This commit is contained in:
Amith Yamasani
2013-04-25 21:18:58 -07:00
committed by Android Git Automerger

View File

@@ -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;
}