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

Commit 12747879 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

User creation with an intent

New API for an app to request creating a new user with
a given user name and seed account information for the
SetupWizard to use when that user is switched into.

Also adds system APIs to read the seed account data from
UserManager.

Bug: 22776757
Change-Id: I0bc3f11ee19c15e0ee2a908c88d98b13296cc30d
parent 12cde00d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28494,6 +28494,7 @@ package android.os {
  }
  public class UserManager {
    method public static android.content.Intent createUserCreationIntent(java.lang.String, java.lang.String, java.lang.String, android.os.PersistableBundle);
    method public android.os.Bundle getApplicationRestrictions(java.lang.String);
    method public long getSerialNumberForUser(android.os.UserHandle);
    method public int getUserCount();
+5 −0
Original line number Diff line number Diff line
@@ -30507,7 +30507,12 @@ package android.os {
  }
  public class UserManager {
    method public void clearSeedAccountData();
    method public static android.content.Intent createUserCreationIntent(java.lang.String, java.lang.String, java.lang.String, android.os.PersistableBundle);
    method public android.os.Bundle getApplicationRestrictions(java.lang.String);
    method public java.lang.String getSeedAccountName();
    method public android.os.PersistableBundle getSeedAccountOptions();
    method public java.lang.String getSeedAccountType();
    method public long getSerialNumberForUser(android.os.UserHandle);
    method public int getUserCount();
    method public long getUserCreationTime(android.os.UserHandle);
+1 −0
Original line number Diff line number Diff line
@@ -28503,6 +28503,7 @@ package android.os {
  }
  public class UserManager {
    method public static android.content.Intent createUserCreationIntent(java.lang.String, java.lang.String, java.lang.String, android.os.PersistableBundle);
    method public android.os.Bundle getApplicationRestrictions(java.lang.String);
    method public long getSerialNumberForUser(android.os.UserHandle);
    method public int getUserCount();
+16 −0
Original line number Diff line number Diff line
@@ -1853,6 +1853,22 @@ public class AccountManager {
        }.start();
    }

    /**
     * @hide
     * Checks if the given account exists on any of the users on the device.
     * Only the system process can call this method.
     *
     * @param account The account to check for existence.
     * @return whether any user has this account
     */
    public boolean someUserHasAccount(@NonNull final Account account) {
        try {
            return mService.someUserHasAccount(account);
        } catch (RemoteException re) {
            throw new RuntimeException(re);
        }
    }

    private void ensureNotOnMainThread() {
        final Looper looper = Looper.myLooper();
        if (looper != null && looper == mContext.getMainLooper()) {
+3 −0
Original line number Diff line number Diff line
@@ -95,4 +95,7 @@ interface IAccountManager {
    /* Finish session started by startAddAccountSession(...) or startUpdateCredentialsSession(...) */
    void finishSession(in IAccountManagerResponse response, in Bundle sessionBundle,
        boolean expectActivityLaunch, in Bundle appInfo);

    /* Check if an account exists on any user on the device. */
    boolean someUserHasAccount(in Account account);
}
Loading