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
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index fc42f3f..0aab2ac 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -3796,9 +3796,13 @@
         // 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;
     }