diff options
| author | Zoltan Szatmary-Ban <szatmz@google.com> | 2015-12-08 10:24:08 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-12-08 10:24:08 +0000 |
| commit | ed6c8cd6ca377ba51243c70844c6dd074abbd0fc (patch) | |
| tree | 86b3ff69216811281ee741edd7cf203e405fbeff /core/java | |
| parent | d6d5f8f0455b2a51098745218eecf1cb4afd3920 (diff) | |
| parent | 3bbceddb94d627495c0022d6e3f92a5cb16aebea (diff) | |
Merge "Make base user restrictions queriable for system apps"
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/IUserManager.aidl | 1 | ||||
| -rw-r--r-- | core/java/android/os/UserManager.java | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/core/java/android/os/IUserManager.aidl b/core/java/android/os/IUserManager.aidl index 4af89c9fdcb2..2db1d150e2fd 100644 --- a/core/java/android/os/IUserManager.aidl +++ b/core/java/android/os/IUserManager.aidl @@ -54,6 +54,7 @@ interface IUserManager { int getUserSerialNumber(int userHandle); int getUserHandle(int userSerialNumber); Bundle getUserRestrictions(int userHandle); + boolean hasBaseUserRestriction(String restrictionKey, int userHandle); boolean hasUserRestriction(in String restrictionKey, int userHandle); void setUserRestriction(String key, boolean value, int userId); void setApplicationRestrictions(in String packageName, in Bundle restrictions, diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 4781a6cb6f08..c96305e7878e 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -826,6 +826,24 @@ public class UserManager { } } + /** + * @hide + * Returns whether the given user has been disallowed from performing certain actions + * or setting certain settings through UserManager. This method disregards restrictions + * set by device policy. + * @param restrictionKey the string key representing the restriction + * @param userHandle the UserHandle of the user for whom to retrieve the restrictions. + */ + public boolean hasBaseUserRestriction(String restrictionKey, UserHandle userHandle) { + try { + return mService.hasBaseUserRestriction(restrictionKey, userHandle.getIdentifier()); + } catch (RemoteException re) { + Log.w(TAG, "Could not get base user restrictions for user " + + userHandle.getIdentifier(), re); + return false; + } + } + /** * This will no longer work. Device owners and profile owners should use * {@link DevicePolicyManager#addUserRestriction(ComponentName, String)} instead. |
