summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
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/content
parent95a869f91bb9ab24300cec37037b0edcfa54f334 (diff)
downloadframeworks_base-7e99bc02c8e2f44dd92d70bfa6e654297e5286d8.zip
frameworks_base-7e99bc02c8e2f44dd92d70bfa6e654297e5286d8.tar.gz
frameworks_base-7e99bc02c8e2f44dd92d70bfa6e654297e5286d8.tar.bz2
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/content')
-rw-r--r--core/java/android/content/Context.java9
-rw-r--r--core/java/android/content/Intent.java25
2 files changed, 20 insertions, 14 deletions
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 03e241a..5bd28b9 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -293,15 +293,6 @@ public abstract class Context {
public abstract Context getApplicationContext();
/**
- * Returns the list of restrictions for the application, or null if there are no
- * restrictions.
- * @return
- */
- public List<RestrictionEntry> getApplicationRestrictions() {
- return getApplicationContext().getApplicationRestrictions();
- }
-
- /**
* Add a new {@link ComponentCallbacks} to the base application of the
* Context, which will be called at the same times as the ComponentCallbacks
* methods of activities and other components are called. Note that you
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 97ad7dd..1ab1eb8 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -2417,11 +2417,16 @@ public class Intent implements Parcelable, Cloneable {
/**
* Broadcast to a specific application to query any supported restrictions to impose
- * on restricted users. The response should contain an extra {@link #EXTRA_RESTRICTIONS},
+ * on restricted users. The broadcast intent contains an extra
+ * {@link #EXTRA_RESTRICTIONS_BUNDLE} with the currently persisted
+ * restrictions as a Bundle of key/value pairs. The value types can be Boolean, String or
+ * String[] depending on the restriction type.<p/>
+ * The response should contain an extra {@link #EXTRA_RESTRICTIONS_LIST},
* which is of type <code>ArrayList&lt;RestrictionEntry&gt;</code>. It can also
* contain an extra {@link #EXTRA_RESTRICTIONS_INTENT}, which is of type <code>Intent</code>.
* The activity specified by that intent will be launched for a result which must contain
- * the extra {@link #EXTRA_RESTRICTIONS}. The returned restrictions will be persisted.
+ * the extra {@link #EXTRA_RESTRICTIONS_LIST}. The keys and values of the returned restrictions
+ * will be persisted.
* @see RestrictionEntry
*/
public static final String ACTION_GET_RESTRICTION_ENTRIES =
@@ -3160,7 +3165,8 @@ public class Intent implements Parcelable, Cloneable {
"android.intent.extra.ALLOW_MULTIPLE";
/**
- * The userHandle carried with broadcast intents related to addition, removal and switching of users
+ * The userHandle carried with broadcast intents related to addition, removal and switching of
+ * users
* - {@link #ACTION_USER_ADDED}, {@link #ACTION_USER_REMOVED} and {@link #ACTION_USER_SWITCHED}.
* @hide
*/
@@ -3169,9 +3175,18 @@ public class Intent implements Parcelable, Cloneable {
/**
* Extra used in the response from a BroadcastReceiver that handles
- * {@link #ACTION_GET_RESTRICTION_ENTRIES}.
+ * {@link #ACTION_GET_RESTRICTION_ENTRIES}. The type of the extra is
+ * <code>ArrayList&lt;RestrictionEntry&gt;</code>.
+ */
+ public static final String EXTRA_RESTRICTIONS_LIST = "android.intent.extra.restrictions_list";
+
+ /**
+ * Extra sent in the intent to the BroadcastReceiver that handles
+ * {@link #ACTION_GET_RESTRICTION_ENTRIES}. The type of the extra is a Bundle containing
+ * the restrictions as key/value pairs.
*/
- public static final String EXTRA_RESTRICTIONS = "android.intent.extra.restrictions";
+ public static final String EXTRA_RESTRICTIONS_BUNDLE =
+ "android.intent.extra.restrictions_bundle";
/**
* Extra used in the response from a BroadcastReceiver that handles