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

Commit bb673791 authored by Yasin Kilicdere's avatar Yasin Kilicdere Committed by Android (Google) Code Review
Browse files

Merge "Fix Guest string was not translated in UMS.userWithName()" into tm-dev

parents 39ce6918 d03224f3
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -3328,7 +3328,7 @@ public class UserManager {
     *
     * <p>This method can be used by OEMs to "warm" up the user creation by pre-creating some users
     * at the first boot, so they when the "real" user is created (for example,
     * by {@link #createUser(String, String, int)} or {@link #createGuest(Context, String)}), it
     * by {@link #createUser(String, String, int)} or {@link #createGuest(Context)}), it
     * takes less time.
     *
     * <p>This method completes the majority of work necessary for user creation: it
@@ -3365,7 +3365,6 @@ public class UserManager {
    /**
     * Creates a guest user and configures it.
     * @param context an application context
     * @param name the name to set for the user
     * @return the {@link UserInfo} object for the created user, or {@code null} if the user
     *         could not be created.
     *
@@ -3373,20 +3372,19 @@ public class UserManager {
     */
    @RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS,
            Manifest.permission.CREATE_USERS})
    public UserInfo createGuest(Context context, String name) {
        UserInfo guest = null;
    public UserInfo createGuest(Context context) {
        try {
            guest = mService.createUserWithThrow(name, USER_TYPE_FULL_GUEST, 0);
            final UserInfo guest = mService.createUserWithThrow(null, USER_TYPE_FULL_GUEST, 0);
            if (guest != null) {
                Settings.Secure.putStringForUser(context.getContentResolver(),
                        Settings.Secure.SKIP_FIRST_USE_HINTS, "1", guest.id);
            }
            return guest;
        } catch (ServiceSpecificException e) {
            return null;
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
        }
        return guest;
    }

    /**
+2 −0
Original line number Diff line number Diff line
@@ -4894,6 +4894,8 @@
    <string name="user_logging_out_message">Logging out <xliff:g id="name" example="Bob">%1$s</xliff:g>\u2026</string>
    <!-- Default name of the owner user [CHAR LIMIT=20] -->
    <string name="owner_name" msgid="3879126011135546571">Owner</string>
    <!-- Default name of the guest user [CHAR LIMIT=35] -->
    <string name="guest_name">Guest</string>
    <!-- Error message title [CHAR LIMIT=35] -->
    <string name="error_message_title">Error</string>
    <!-- Message informing user that the change was disallowed by an administrator. [CHAR LIMIT=none] -->
+1 −0
Original line number Diff line number Diff line
@@ -1108,6 +1108,7 @@
  <java-symbol type="string" name="media_route_status_not_available" />
  <java-symbol type="string" name="media_route_status_in_use" />
  <java-symbol type="string" name="owner_name" />
  <java-symbol type="string" name="guest_name" />
  <java-symbol type="string" name="config_chooseAccountActivity" />
  <java-symbol type="string" name="config_chooseTypeAndAccountActivity" />
  <java-symbol type="string" name="config_chooserActivity" />
+1 −2
Original line number Diff line number Diff line
@@ -855,8 +855,7 @@ public class UserSwitcherController implements Dumpable {
    public @UserIdInt int createGuest() {
        UserInfo guest;
        try {
            guest = mUserManager.createGuest(mContext,
                    mContext.getString(com.android.settingslib.R.string.guest_nickname));
            guest = mUserManager.createGuest(mContext);
        } catch (UserManager.UserOperationException e) {
            Log.e(TAG, "Couldn't create guest user", e);
            return UserHandle.USER_NULL;
+2 −3
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ import org.mockito.ArgumentMatchers.eq
import org.mockito.Mock
import org.mockito.Mockito.`when`
import org.mockito.Mockito.any
import org.mockito.Mockito.anyString
import org.mockito.Mockito.doNothing
import org.mockito.Mockito.doReturn
import org.mockito.Mockito.mock
@@ -207,7 +206,7 @@ class UserSwitcherControllerTest : SysuiTestCase() {
        `when`(userTracker.userId).thenReturn(ownerId)
        `when`(userTracker.userInfo).thenReturn(ownerInfo)

        `when`(userManager.createGuest(any(), anyString())).thenReturn(guestInfo)
        `when`(userManager.createGuest(any())).thenReturn(guestInfo)

        userSwitcherController.onUserListItemClicked(emptyGuestUserRecord, null)
        testableLooper.processAllMessages()
@@ -232,7 +231,7 @@ class UserSwitcherControllerTest : SysuiTestCase() {
        `when`(userTracker.userId).thenReturn(ownerId)
        `when`(userTracker.userInfo).thenReturn(ownerInfo)

        `when`(userManager.createGuest(any(), anyString())).thenReturn(guestInfo)
        `when`(userManager.createGuest(any())).thenReturn(guestInfo)

        userSwitcherController.onUserListItemClicked(emptyGuestUserRecord, dialogShower)
        testableLooper.processAllMessages()
Loading