summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorAnthony Hugh <ahugh@google.com>2019-12-04 22:54:07 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-12-04 22:54:07 +0000
commit4d4e91db5e61aa5765b28a4afdaae7ee915cabc6 (patch)
tree103f9af6ae71ec05cf8e39e60b02b85a229e184a /core/java/android
parent60125d3d61c126079593952e593904cfbed11659 (diff)
parent5d7f9056ee8d817832625da43ce47611c082c44e (diff)
Merge "Expose findCurrentGuestUser() to system apps"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/os/IUserManager.aidl1
-rw-r--r--core/java/android/os/UserManager.java14
2 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl
index 40048d9154de..e81a505a1715 100644
--- a/core/java/android/os/IUserManager.aidl
+++ b/core/java/android/os/IUserManager.aidl
@@ -87,6 +87,7 @@ interface IUserManager {
void setDefaultGuestRestrictions(in Bundle restrictions);
Bundle getDefaultGuestRestrictions();
boolean markGuestForDeletion(int userId);
+ UserInfo findCurrentGuestUser();
boolean isQuietModeEnabled(int userId);
void setSeedAccountData(int userId, in String accountName,
in String accountType, in PersistableBundle accountOptions, boolean persist);
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index dbe8dc3e38e2..9e9cd9218a0f 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -2375,6 +2375,20 @@ public class UserManager {
}
/**
+ * Gets the existing guest user if it exists. This does not include guest users that are dying.
+ * @return The existing guest user if it exists. Null otherwise.
+ * @hide
+ */
+ @RequiresPermission(android.Manifest.permission.MANAGE_USERS)
+ public UserInfo findCurrentGuestUser() {
+ try {
+ return mService.findCurrentGuestUser();
+ } catch (RemoteException re) {
+ throw re.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Creates a user with the specified name and options as a profile of another user.
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
* The type of profile must be specified using the given flags.