summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorFyodor Kupolov <fkupolov@google.com>2015-03-23 18:57:24 -0700
committerFyodor Kupolov <fkupolov@google.com>2015-04-03 10:19:24 -0700
commit2b2ab5a9470ba8df0f18583abc2d12d5942f97ce (patch)
tree90b5da5c93c50292137178ef1e2d8ada7bb60cd0 /src/com/android
parentbca21083a3f511bca0369deaf8684b145c281044 (diff)
downloadpackages_apps_Settings-2b2ab5a9470ba8df0f18583abc2d12d5942f97ce.tar.gz
packages_apps_Settings-2b2ab5a9470ba8df0f18583abc2d12d5942f97ce.tar.bz2
packages_apps_Settings-2b2ab5a9470ba8df0f18583abc2d12d5942f97ce.zip
Support for nested bundles in setApplicationRestrictions
Replaced RestrictionUtils.restrictionsToBundle with RestrictionsManager. convertRestrictionsToBundle. Bug: 19540606 Change-Id: I32b264e04d5d177ea5b4c39a8ace5ee0ce907970
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/settings/users/AppRestrictionsFragment.java7
-rw-r--r--src/com/android/settings/users/RestrictionUtils.java14
2 files changed, 4 insertions, 17 deletions
diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java
index e09d6504f..a166f0d9e 100644
--- a/src/com/android/settings/users/AppRestrictionsFragment.java
+++ b/src/com/android/settings/users/AppRestrictionsFragment.java
@@ -23,6 +23,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.RestrictionEntry;
+import android.content.RestrictionsManager;
import android.content.pm.ActivityInfo;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
@@ -841,7 +842,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
continue;
}
mUserManager.setApplicationRestrictions(packageName,
- RestrictionUtils.restrictionsToBundle(restrictions),
+ RestrictionsManager.convertRestrictionsToBundle(restrictions),
mUser);
break;
}
@@ -915,7 +916,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
onRestrictionsReceived(preference, packageName, restrictions);
if (mRestrictedProfile) {
mUserManager.setApplicationRestrictions(packageName,
- RestrictionUtils.restrictionsToBundle(restrictions), mUser);
+ RestrictionsManager.convertRestrictionsToBundle(restrictions), mUser);
}
} else if (restrictionsIntent != null) {
preference.setRestrictions(restrictions);
@@ -1046,7 +1047,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen
// If there's a valid result, persist it to the user manager.
pref.setRestrictions(list);
mUserManager.setApplicationRestrictions(packageName,
- RestrictionUtils.restrictionsToBundle(list), mUser);
+ RestrictionsManager.convertRestrictionsToBundle(list), mUser);
} else if (bundle != null) {
// If there's a valid result, persist it to the user manager.
mUserManager.setApplicationRestrictions(packageName, bundle, mUser);
diff --git a/src/com/android/settings/users/RestrictionUtils.java b/src/com/android/settings/users/RestrictionUtils.java
index e8d46e9f6..b36cb3e54 100644
--- a/src/com/android/settings/users/RestrictionUtils.java
+++ b/src/com/android/settings/users/RestrictionUtils.java
@@ -90,18 +90,4 @@ public class RestrictionUtils {
}
um.setUserRestrictions(userRestrictions, user);
}
-
- public static Bundle restrictionsToBundle(ArrayList<RestrictionEntry> entries) {
- final Bundle bundle = new Bundle();
- for (RestrictionEntry entry : entries) {
- if (entry.getType() == RestrictionEntry.TYPE_BOOLEAN) {
- bundle.putBoolean(entry.getKey(), entry.getSelectedState());
- } else if (entry.getType() == RestrictionEntry.TYPE_MULTI_SELECT) {
- bundle.putStringArray(entry.getKey(), entry.getAllSelectedStrings());
- } else {
- bundle.putString(entry.getKey(), entry.getSelectedString());
- }
- }
- return bundle;
- }
}