summaryrefslogtreecommitdiffstats
path: root/core/java/android/content
diff options
context:
space:
mode:
authorFyodor Kupolov <fkupolov@google.com>2015-05-22 16:21:19 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-22 16:21:20 +0000
commit96616a57f3af05d4808fb5b84e758000f6ab5372 (patch)
tree4a80120abb0267117d45e2a77fe5354f4c7561a4 /core/java/android/content
parent67ba691ad6fbc6d0ee28635b40c87f4cddd61399 (diff)
parentf70c9346d6097be6967d0901830b00b84ae02a87 (diff)
downloadframeworks_base-96616a57f3af05d4808fb5b84e758000f6ab5372.zip
frameworks_base-96616a57f3af05d4808fb5b84e758000f6ab5372.tar.gz
frameworks_base-96616a57f3af05d4808fb5b84e758000f6ab5372.tar.bz2
Merge "Use factory methods for RestrictionEntry" into mnc-dev
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.
*/