OSDN Git Service

am 67abd3b3: am da3d7b2b: am 2b64ec47: Merge "Don\'t allow non-admins to adopt sd...
authorAmith Yamasani <yamasani@google.com>
Tue, 30 Jun 2015 23:43:31 +0000 (23:43 +0000)
committerAndroid Git Automerger <android-git-automerger@android.com>
Tue, 30 Jun 2015 23:43:31 +0000 (23:43 +0000)
* commit '67abd3b356794b316e647a9ad20a24b09406823f':
  Don't allow non-admins to adopt sd card for internal storage

1  2 
core/java/android/os/UserManager.java
services/core/java/com/android/server/MountService.java

@@@ -580,9 -568,20 +580,19 @@@ public class UserManager 
       * @return whether this process is running under the system user.
       */
      public boolean isSystemUser() {
 -        return UserHandle.myUserId() == UserHandle.USER_OWNER;
 +        return UserHandle.myUserId() == UserHandle.USER_SYSTEM;
      }
 -
      /**
+      * @hide
+      * Returns whether the caller is running as an admin user. There can be more than one admin
+      * user.
+      */
+     public boolean isAdminUser() {
+         UserInfo user = getUserInfo(UserHandle.myUserId());
+         return user != null ? user.isAdmin() : false;
+     }
+     /**
       * Used to check if the user making this call is linked to another user. Linked users may have
       * a reduced number of available apps, app restrictions and account restrictions.
       * @return whether the user making this call is a linked user