summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorFyodor Kupolov <fkupolov@google.com>2015-05-21 15:06:44 -0700
committerFyodor Kupolov <fkupolov@google.com>2015-05-21 15:08:42 -0700
commitf70c9346d6097be6967d0901830b00b84ae02a87 (patch)
tree25e2dd23fc4f25b77b32be26ebd21524a8214796 /core/java/android/content
parent8e9d7d55053094f5cc9ab8bcd5a0a9803ec40dfe (diff)
downloadframeworks_base-f70c9346d6097be6967d0901830b00b84ae02a87.zip
frameworks_base-f70c9346d6097be6967d0901830b00b84ae02a87.tar.gz
frameworks_base-f70c9346d6097be6967d0901830b00b84ae02a87.tar.bz2
Use factory methods for RestrictionEntry
As per API council request, factory methods should be used instead of using boolean. Bug: 21343772 Change-Id: Ia0889e46916f4ed7edb942217880cdf9c27771c2
Diffstat (limited to 'core/java/android/content')
-rw-r--r--core/java/android/content/RestrictionEntry.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/java/android/content/RestrictionEntry.java b/core/java/android/content/RestrictionEntry.java
index 342ee38..ab049ec 100644
--- a/core/java/android/content/RestrictionEntry.java
+++ b/core/java/android/content/RestrictionEntry.java
@@ -200,7 +200,7 @@ public class RestrictionEntry implements Parcelable {
* {@link #TYPE_BUNDLE_ARRAY bundle-array} type, otherwise the type will be set to
* {@link #TYPE_BUNDLE bundle}.
*/
- public RestrictionEntry(String key, RestrictionEntry[] restrictionEntries,
+ private RestrictionEntry(String key, RestrictionEntry[] restrictionEntries,
boolean isBundleArray) {
mKey = key;
if (isBundleArray) {
@@ -220,6 +220,29 @@ public class RestrictionEntry implements Parcelable {
}
/**
+ * Creates an entry of type {@link #TYPE_BUNDLE}.
+ * @param key the unique key for this restriction
+ * @param restrictionEntries array of nested restriction entries.
+ * @return the newly created restriction
+ */
+ public static RestrictionEntry createBundleEntry(String key,
+ RestrictionEntry[] restrictionEntries) {
+ return new RestrictionEntry(key, restrictionEntries, false);
+ }
+
+ /**
+ * Creates an entry of type {@link #TYPE_BUNDLE_ARRAY}.
+ * @param key the unique key for this restriction
+ * @param restrictionEntries array of nested restriction entries. The array may only contain
+ * elements of type {@link #TYPE_BUNDLE bundle}.
+ * @return the newly created restriction
+ */
+ public static RestrictionEntry createBundleArrayEntry(String key,
+ RestrictionEntry[] restrictionEntries) {
+ return new RestrictionEntry(key, restrictionEntries, true);
+ }
+
+ /**
* Sets the type for this restriction.
* @param type the type for this restriction.
*/