Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a8fdfa38 authored by Yasin Kilicdere's avatar Yasin Kilicdere
Browse files

Add settings entrypoint to add a supervised user

Bug: 205101183
Bug: 199868785
Test: croot && make RunSettingsRoboTests -j40 ROBOTEST_FILTER="com.android.settings.users.UserSettingsTest"
Change-Id: Ief48a9d974f3a40191161e02bbed605e4327c454
parent b9003c2a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9215,6 +9215,7 @@ package android.os {
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserIcon(@NonNull android.graphics.Bitmap) throws android.os.UserManager.UserOperationException;
    method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void setUserName(@Nullable String);
    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean someUserHasAccount(@NonNull String, @NonNull String);
    field @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public static final String ACTION_CREATE_SUPERVISED_USER = "android.os.action.CREATE_SUPERVISED_USER";
    field public static final String ACTION_USER_RESTRICTIONS_CHANGED = "android.os.action.USER_RESTRICTIONS_CHANGED";
    field @Deprecated public static final String DISALLOW_OEM_UNLOCK = "no_oem_unlock";
    field public static final String DISALLOW_RUN_IN_BACKGROUND = "no_run_in_background";
+11 −0
Original line number Diff line number Diff line
@@ -1545,6 +1545,17 @@ public class UserManager {

    private static final String ACTION_CREATE_USER = "android.os.action.CREATE_USER";

    /**
     * Action to start an activity to create a supervised user.
     * Only devices with non-empty config_supervisedUserCreationPackage support this.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.MANAGE_USERS)
    public static final String ACTION_CREATE_SUPERVISED_USER =
            "android.os.action.CREATE_SUPERVISED_USER";

    /**
     * Extra containing a name for the user being created. Optional parameter passed to
     * ACTION_CREATE_USER activity.
+34 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2020 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="40dp"
        android:height="40dp"
        android:viewportWidth="20"
        android:viewportHeight="20"
        android:tint="?android:attr/colorControlNormal">

    <group
        android:scaleX="0.5"
        android:scaleY="0.5">

        <path
            android:fillColor="@android:color/white"
            android:pathData="M15.625,22.5q-2.375,0 -4.063,-1.688 -1.687,-1.687 -1.687,-4.104 0,-2.375 1.688,-4.062 1.687,-1.688 4.062,-1.688 2.417,0 4.105,1.688 1.687,1.687 1.687,4.062 0,2.417 -1.688,4.105 -1.687,1.687 -4.104,1.687zM15.625,19.708q1.292,0 2.146,-0.875 0.854,-0.875 0.854,-2.125t-0.854,-2.125q-0.854,-0.875 -2.146,-0.875 -1.208,0 -2.104,0.875 -0.896,0.875 -0.896,2.125t0.896,2.125q0.896,0.875 2.104,0.875zM27.875,24.333q-1.792,0 -3.063,-1.27 -1.27,-1.271 -1.27,-3.063 0,-1.792 1.27,-3.063 1.271,-1.27 3.063,-1.27 1.833,0 3.083,1.27 1.25,1.271 1.25,3.063 0,1.792 -1.25,3.063 -1.25,1.27 -3.083,1.27zM17.458,33.667q1.959,-3.75 5.063,-5.063 3.104,-1.312 5.354,-1.312 0.958,0 1.813,0.145 0.854,0.146 1.729,0.396 1.041,-1.541 1.75,-3.583 0.708,-2.042 0.708,-4.25 0,-5.792 -4.041,-9.834Q25.791,6.125 20,6.125t-9.834,4.041Q6.125,14.208 6.125,20q0,2.042 0.563,3.938 0.562,1.895 1.604,3.437 1.625,-0.833 3.52,-1.333 1.896,-0.5 3.813,-0.5 1.208,0 2.333,0.188 1.125,0.187 2.125,0.52 -0.833,0.458 -1.562,1 -0.729,0.542 -1.354,1.125 -0.459,-0.042 -0.813,-0.042h-0.729q-1.375,0 -2.916,0.355 -1.542,0.354 -2.751,0.937 1.5,1.583 3.438,2.645 1.937,1.063 4.062,1.397zM20,36.667q-3.417,0 -6.459,-1.313 -3.041,-1.312 -5.312,-3.583 -2.271,-2.271 -3.583,-5.313Q3.333,23.418 3.333,20q0,-3.458 1.313,-6.479Q5.958,10.5 8.229,8.229t5.313,-3.583Q16.582,3.333 20,3.333q3.458,0 6.479,1.313 3.021,1.312 5.292,3.583t3.584,5.292q1.312,3.021 1.312,6.479 0,3.417 -1.313,6.459 -1.312,3.041 -3.583,5.312 -2.271,2.271 -5.292,3.584 -3.021,1.312 -6.479,1.312z"/>

    </group>

</vector>
+9 −0
Original line number Diff line number Diff line
@@ -5518,4 +5518,13 @@
    </string-array>

    <integer name="config_chooser_max_targets_per_row">4</integer>

    <!-- Package that provides the supervised user creation flow. This package must include an
         activity with an intent filter for {@link UserManager.ACTION_CREATE_SUPERVISED_USER}.
         When this resource is defined, an extra button in user settings screen will be shown
         with a title defined in @*android:string/supervised_user_creation_label
         and an icon defined in @*android:drawable/ic_add_supervised_user.
         That button will fire an intent targeted for this package with the mentioned action.
         When this resource is empty, that button will not be shown. -->
    <string name="config_supervisedUserCreationPackage" translatable="false"></string>
</resources>
+2 −0
Original line number Diff line number Diff line
@@ -5374,6 +5374,8 @@
    <string name="user_creation_account_exists">Allow <xliff:g id="app" example="Gmail">%1$s</xliff:g> to create a new User with <xliff:g id="account" example="foobar@gmail.com">%2$s</xliff:g> (a User with this account already exists) ?</string>
    <!-- Message to user that app is trying to create user for a specified account. [CHAR LIMIT=none] -->
    <string name="user_creation_adding">Allow <xliff:g id="app" example="Gmail">%1$s</xliff:g> to create a new User with <xliff:g id="account" example="foobar@gmail.com">%2$s</xliff:g> ?</string>
    <!-- String label displayed on buttons that trigger the flow for creating supervised users. [CHAR LIMIT=35] -->
    <string name="supervised_user_creation_label">Add supervised user</string>

    <!-- Locale picker strings -->

Loading