diff options
author | Fyodor Kupolov <fkupolov@google.com> | 2015-05-22 16:21:19 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-05-22 16:21:20 +0000 |
commit | 96616a57f3af05d4808fb5b84e758000f6ab5372 (patch) | |
tree | 4a80120abb0267117d45e2a77fe5354f4c7561a4 /core/java/android/content | |
parent | 67ba691ad6fbc6d0ee28635b40c87f4cddd61399 (diff) | |
parent | f70c9346d6097be6967d0901830b00b84ae02a87 (diff) | |
download | frameworks_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.java | 25 |
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. */ |