OSDN Git Service

Allow apps with CREATE_USERS permission to create demo users.
authorSudheer Shanka <sudheersai@google.com>
Fri, 26 Aug 2016 22:42:53 +0000 (15:42 -0700)
committerSudheer Shanka <sudheersai@google.com>
Mon, 29 Aug 2016 17:49:03 +0000 (10:49 -0700)
Bug: 31092477
Test: adb shell am create-user --ephemeral --demo <user-name>
Change-Id: Ia08a50ec4371466c62cdc9f5391e298a666b5081

core/res/AndroidManifest.xml
services/core/java/com/android/server/pm/UserManagerService.java

index 8bdb55e..6c6fd90 100644 (file)
 
     <!-- @hide Allows an application to create, remove users and get the list of
          users on the device. Applications holding this permission can only create restricted,
-         guest, managed, and ephemeral users. For creating other kind of users,
+         guest, managed, demo, and ephemeral users. For creating other kind of users,
          {@link android.Manifest.permission#MANAGE_USERS} is needed.
          This permission is not available to third party applications. -->
     <permission android:name="android.permission.CREATE_USERS"
index c9ad49a..af055da 100644 (file)
@@ -180,7 +180,8 @@ public class UserManagerService extends IUserManager.Stub {
             UserInfo.FLAG_MANAGED_PROFILE
             | UserInfo.FLAG_EPHEMERAL
             | UserInfo.FLAG_RESTRICTED
-            | UserInfo.FLAG_GUEST;
+            | UserInfo.FLAG_GUEST
+            | UserInfo.FLAG_DEMO;
 
     private static final int MIN_USER_ID = 10;
     // We need to keep process uid within Integer.MAX_VALUE.