diff options
| author | Fyodor Kupolov <fkupolov@google.com> | 2017-11-09 17:43:01 -0800 |
|---|---|---|
| committer | Fyodor Kupolov <fkupolov@google.com> | 2017-11-09 17:43:01 -0800 |
| commit | ca1775623e811d2921969bc477ee5967d650b0e5 (patch) | |
| tree | eea264bbdae6c083ec370c6f5a621ba8b787def8 /core/java/android/os/UserManager.java | |
| parent | 1e3212ebda4e3c6e50e49b4ee369bec7ff213ec0 (diff) | |
Additional System APIs for restricted profiles
- isRestrictedProfile - whether the caller is running
as restricted profile.
- hasRestrictedProfiles - whether the calling user has at least one
restricted profile associated with it.
Bug: 64122169
Test: UserManagerTest
Change-Id: I178b02a48abc32e126613e0320c4950f455364df
Diffstat (limited to 'core/java/android/os/UserManager.java')
| -rw-r--r-- | core/java/android/os/UserManager.java | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 28836e4ae6cd..95d22ba8db77 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -1037,12 +1037,22 @@ public class UserManager { } /** - * Used to check if the user making this call is linked to another user. Linked users may have + * @hide + * @deprecated Use {@link #isRestrictedProfile()} + */ + @Deprecated + public boolean isLinkedUser() { + return isRestrictedProfile(); + } + + /** + * Returns whether the caller is running as restricted profile. Restricted profile may have * a reduced number of available apps, app restrictions and account restrictions. * @return whether the user making this call is a linked user * @hide */ - public boolean isLinkedUser() { + @SystemApi + public boolean isRestrictedProfile() { try { return mService.isRestricted(); } catch (RemoteException re) { @@ -1063,6 +1073,20 @@ public class UserManager { } /** + * Returns whether the calling user has at least one restricted profile associated with it. + * @return + * @hide + */ + @SystemApi + public boolean hasRestrictedProfiles() { + try { + return mService.hasRestrictedProfiles(); + } catch (RemoteException re) { + throw re.rethrowFromSystemServer(); + } + } + + /** * Checks if a user is a guest user. * @return whether user is a guest user. * @hide @@ -1082,6 +1106,7 @@ public class UserManager { return user != null && user.isGuest(); } + /** * Checks if the calling app is running in a demo user. When running in a demo user, * apps can be more helpful to the user, or explain their features in more detail. |
