diff options
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 6 | ||||
| -rw-r--r-- | core/java/android/content/pm/UserInfo.java | 12 | ||||
| -rw-r--r-- | core/java/android/os/IUserManager.aidl | 4 | ||||
| -rw-r--r-- | core/java/android/os/UserManager.java | 38 | ||||
| -rw-r--r-- | core/java/com/android/internal/inputmethod/InputMethodUtils.java | 13 |
5 files changed, 46 insertions, 27 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index d386eff..9d6a340 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -605,11 +605,11 @@ public class ActivityManager { public static final int RECENT_IGNORE_UNAVAILABLE = 0x0002; /** - * Provides a list that also contains recent tasks for user - * and related users. + * Provides a list that contains recent tasks for all + * profiles of a user. * @hide */ - public static final int RECENT_INCLUDE_RELATED = 0x0004; + public static final int RECENT_INCLUDE_PROFILES = 0x0004; /** * Return a list of the tasks that the user has recently launched, with diff --git a/core/java/android/content/pm/UserInfo.java b/core/java/android/content/pm/UserInfo.java index 6f1d4f8..f53aa4c 100644 --- a/core/java/android/content/pm/UserInfo.java +++ b/core/java/android/content/pm/UserInfo.java @@ -71,7 +71,7 @@ public class UserInfo implements Parcelable { public static final int FLAG_MANAGED_PROFILE = 0x00000020; - public static final int NO_RELATED_GROUP_ID = -1; + public static final int NO_PROFILE_GROUP_ID = -1; public int id; public int serialNumber; @@ -80,7 +80,7 @@ public class UserInfo implements Parcelable { public int flags; public long creationTime; public long lastLoggedInTime; - public int relatedGroupId; + public int profileGroupId; /** User is only partially created. */ public boolean partial; @@ -94,7 +94,7 @@ public class UserInfo implements Parcelable { this.name = name; this.flags = flags; this.iconPath = iconPath; - this.relatedGroupId = NO_RELATED_GROUP_ID; + this.profileGroupId = NO_PROFILE_GROUP_ID; } public boolean isPrimary() { @@ -137,7 +137,7 @@ public class UserInfo implements Parcelable { creationTime = orig.creationTime; lastLoggedInTime = orig.lastLoggedInTime; partial = orig.partial; - relatedGroupId = orig.relatedGroupId; + profileGroupId = orig.profileGroupId; } public UserHandle getUserHandle() { @@ -162,7 +162,7 @@ public class UserInfo implements Parcelable { dest.writeLong(creationTime); dest.writeLong(lastLoggedInTime); dest.writeInt(partial ? 1 : 0); - dest.writeInt(relatedGroupId); + dest.writeInt(profileGroupId); } public static final Parcelable.Creator<UserInfo> CREATOR @@ -184,6 +184,6 @@ public class UserInfo implements Parcelable { creationTime = source.readLong(); lastLoggedInTime = source.readLong(); partial = source.readInt() != 0; - relatedGroupId = source.readInt(); + profileGroupId = source.readInt(); } } diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl index 6e6c06d..1192a45 100644 --- a/core/java/android/os/IUserManager.aidl +++ b/core/java/android/os/IUserManager.aidl @@ -28,13 +28,13 @@ import android.graphics.Bitmap; */ interface IUserManager { UserInfo createUser(in String name, int flags); - UserInfo createRelatedUser(in String name, int flags, int relatedUserId); + UserInfo createProfileForUser(in String name, int flags, int userHandle); boolean removeUser(int userHandle); void setUserName(int userHandle, String name); void setUserIcon(int userHandle, in Bitmap icon); Bitmap getUserIcon(int userHandle); List<UserInfo> getUsers(boolean excludeDying); - List<UserInfo> getRelatedUsers(int userHandle); + List<UserInfo> getProfiles(int userHandle); UserInfo getUserInfo(int userHandle); boolean isRestricted(); void setGuestEnabled(boolean enable); diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 1ec5cd5..520a08c 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -410,20 +410,29 @@ public class UserManager { } /** - * Creates a user with the specified name and options. + * Renamed, just present to avoid multi project commit. + * TODO delete. + * @hide + */ + public UserInfo createRelatedUser(String name, int flags, int relatedUserId) { + return createProfileForUser(name, flags, relatedUserId); + } + + /** + * Creates a user with the specified name and options as a profile of another user. * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. * * @param name the user's name * @param flags flags that identify the type of user and other properties. * @see UserInfo - * @param relatedUserId new user will be related to this user id. + * @param userHandle new user will be a profile of this use. * * @return the UserInfo object for the created user, or null if the user could not be created. * @hide */ - public UserInfo createRelatedUser(String name, int flags, int relatedUserId) { + public UserInfo createProfileForUser(String name, int flags, int userHandle) { try { - return mService.createRelatedUser(name, flags, relatedUserId); + return mService.createProfileForUser(name, flags, userHandle); } catch (RemoteException re) { Log.w(TAG, "Could not create a user", re); return null; @@ -454,15 +463,26 @@ public class UserManager { } /** - * Returns information for all users related to userId - * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. - * @param userHandle users related to this user id will be returned. - * @return the list of related users. + * Renaming, left to avoid multi project commit. + * TODO Delete. * @hide */ public List<UserInfo> getRelatedUsers(int userHandle) { + return getProfiles(userHandle); + } + + /** + * Returns list of the profiles of userHandle including + * userHandle itself. + * + * Requires {@link android.Manifest.permission#MANAGE_USERS} permission. + * @param userHandle profiles of this user will be returned. + * @return the list of profiles. + * @hide + */ + public List<UserInfo> getProfiles(int userHandle) { try { - return mService.getRelatedUsers(userHandle); + return mService.getProfiles(userHandle); } catch (RemoteException re) { Log.w(TAG, "Could not get user list", re); return null; diff --git a/core/java/com/android/internal/inputmethod/InputMethodUtils.java b/core/java/com/android/internal/inputmethod/InputMethodUtils.java index 03a053c..f9e5569 100644 --- a/core/java/com/android/internal/inputmethod/InputMethodUtils.java +++ b/core/java/com/android/internal/inputmethod/InputMethodUtils.java @@ -504,7 +504,7 @@ public class InputMethodUtils { private String mEnabledInputMethodsStrCache; private int mCurrentUserId; - private int[] mRelatedUserIds = new int[0]; + private int[] mCurrentProfileIds = new int[0]; private static void buildEnabledInputMethodsSettingString( StringBuilder builder, Pair<String, ArrayList<String>> pair) { @@ -537,17 +537,16 @@ public class InputMethodUtils { mCurrentUserId = userId; } - public void setRelatedUserIds(int[] relatedUserIds) { + public void setCurrentProfileIds(int[] currentProfileIds) { synchronized (this) { - mRelatedUserIds = relatedUserIds; + mCurrentProfileIds = currentProfileIds; } } - public boolean isRelatedToOrCurrentUser(int userId) { + public boolean isCurrentProfile(int userId) { synchronized (this) { - if (userId == mCurrentUserId) return true; - for (int i = 0; i < mRelatedUserIds.length; i++) { - if (userId == mRelatedUserIds[i]) return true; + for (int i = 0; i < mCurrentProfileIds.length; i++) { + if (userId == mCurrentProfileIds[i]) return true; } return false; } |
