summaryrefslogtreecommitdiff
path: root/core/java/android/os/UserManager.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2013-04-16 18:24:51 -0700
committerAmith Yamasani <yamasani@google.com>2013-04-17 10:44:44 -0700
commit7e99bc02c8e2f44dd92d70bfa6e654297e5286d8 (patch)
tree5b0fd3504a1b6939f1289772447aa598101b7652 /core/java/android/os/UserManager.java
parent95a869f91bb9ab24300cec37037b0edcfa54f334 (diff)
Modify restrictions bundle per api council recommendations
Use a Bundle for persisting and passing to the application, but use a list to return data back from an application that's exposing restrictions. Changed the xml reading/writing code to store the value type in the Bundle so that it can be reproduced when reading. Earlier we were assuming only String and String[]. Bug: 8633967 Change-Id: I523d5553728edcf28a1e9d432f490b4956f34215
Diffstat (limited to 'core/java/android/os/UserManager.java')
-rw-r--r--core/java/android/os/UserManager.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index e580e2b9d1eb..df065e93e16a 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -142,6 +142,7 @@ public class UserManager {
private static UserManager sInstance = null;
+ /** @hide */
public synchronized static UserManager get(Context context) {
if (sInstance == null) {
sInstance = (UserManager) context.getSystemService(Context.USER_SERVICE);
@@ -578,13 +579,29 @@ public class UserManager {
return -1;
}
+ /**
+ * Returns a Bundle containing any saved application restrictions for this user, for the
+ * given package name. Only an application with this package name can call this method.
+ * @param packageName the package name of the calling application
+ * @return a Bundle with the restrictions as key/value pairs, or null if there are no
+ * saved restrictions. The values can be of type Boolean, String or String[], depending
+ * on the restriction type, as defined by the application.
+ */
+ public Bundle getApplicationRestrictions(String packageName) {
+ try {
+ return mService.getApplicationRestrictions(packageName);
+ } catch (RemoteException re) {
+ Log.w(TAG, "Could not get application restrictions for package " + packageName);
+ }
+ return null;
+ }
/**
* @hide
*/
- public List<RestrictionEntry> getApplicationRestrictions(String packageName, UserHandle user) {
+ public Bundle getApplicationRestrictions(String packageName, UserHandle user) {
try {
- return mService.getApplicationRestrictions(packageName, user.getIdentifier());
+ return mService.getApplicationRestrictionsForUser(packageName, user.getIdentifier());
} catch (RemoteException re) {
Log.w(TAG, "Could not get application restrictions for user " + user.getIdentifier());
}
@@ -594,10 +611,10 @@ public class UserManager {
/**
* @hide
*/
- public void setApplicationRestrictions(String packageName, List<RestrictionEntry> entries,
+ public void setApplicationRestrictions(String packageName, Bundle restrictions,
UserHandle user) {
try {
- mService.setApplicationRestrictions(packageName, entries, user.getIdentifier());
+ mService.setApplicationRestrictions(packageName, restrictions, user.getIdentifier());
} catch (RemoteException re) {
Log.w(TAG, "Could not set application restrictions for user " + user.getIdentifier());
}