summaryrefslogtreecommitdiff
path: root/androidx/app/slice/Slice.java
diff options
context:
space:
mode:
Diffstat (limited to 'androidx/app/slice/Slice.java')
-rw-r--r--androidx/app/slice/Slice.java44
1 files changed, 33 insertions, 11 deletions
diff --git a/androidx/app/slice/Slice.java b/androidx/app/slice/Slice.java
index 3c5f1bf6..d0137b1d 100644
--- a/androidx/app/slice/Slice.java
+++ b/androidx/app/slice/Slice.java
@@ -54,7 +54,6 @@ import android.support.v4.os.BuildCompat;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.List;
import androidx.app.slice.compat.SliceProviderCompat;
@@ -308,7 +307,9 @@ public final class Slice {
* Add remote input to the slice being constructed
* @param subType Optional template-specific type information
* @see {@link SliceItem#getSubType()}
+ * @hide
*/
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public Slice.Builder addRemoteInput(RemoteInput remoteInput, @Nullable String subType,
@SliceHint List<String> hints) {
return addRemoteInput(remoteInput, subType, hints.toArray(new String[hints.size()]));
@@ -318,7 +319,9 @@ public final class Slice {
* Add remote input to the slice being constructed
* @param subType Optional template-specific type information
* @see {@link SliceItem#getSubType()}
+ * @hide
*/
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public Slice.Builder addRemoteInput(RemoteInput remoteInput, @Nullable String subType,
@SliceHint String... hints) {
mItems.add(new SliceItem(remoteInput, FORMAT_REMOTE_INPUT, subType, hints));
@@ -395,7 +398,11 @@ public final class Slice {
return toString("");
}
- private String toString(String indent) {
+ /**
+ * @hide
+ */
+ @RestrictTo(Scope.LIBRARY)
+ public String toString(String indent) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mItems.length; i++) {
sb.append(indent);
@@ -418,20 +425,34 @@ public final class Slice {
}
/**
+ */
+ public static @Nullable Slice bindSlice(Context context, @NonNull Uri uri) {
+ throw new RuntimeException("Stub, to be removed");
+ }
+
+ /**
+ */
+ public static @Nullable Slice bindSlice(Context context, @NonNull Intent intent) {
+ throw new RuntimeException("Stub, to be removed");
+ }
+
+ /**
* Turns a slice Uri into slice content.
*
+ * @hide
* @param context Context to be used.
* @param uri The URI to a slice provider
* @return The Slice provided by the app or null if none is given.
* @see Slice
*/
+ @RestrictTo(Scope.LIBRARY_GROUP)
@SuppressWarnings("NewApi")
- public static @Nullable Slice bindSlice(Context context, @NonNull Uri uri) {
- // TODO: Hide this and only allow binding through SliceView.
+ public static @Nullable Slice bindSlice(Context context, @NonNull Uri uri,
+ List<SliceSpec> supportedSpecs) {
if (BuildCompat.isAtLeastP()) {
- return callBindSlice(context, uri, Collections.<SliceSpec>emptyList());
+ return callBindSlice(context, uri, supportedSpecs);
} else {
- return SliceProviderCompat.bindSlice(context, uri, Collections.<SliceSpec>emptyList());
+ return SliceProviderCompat.bindSlice(context, uri, supportedSpecs);
}
}
@@ -448,6 +469,7 @@ public final class Slice {
* {@link ContentProvider} associated with the given intent this will throw
* {@link IllegalArgumentException}.
*
+ * @hide
* @param context The context to use.
* @param intent The intent associated with a slice.
* @return The Slice provided by the app or null if none is given.
@@ -455,14 +477,14 @@ public final class Slice {
* @see SliceProvider#onMapIntentToUri(Intent)
* @see Intent
*/
+ @RestrictTo(Scope.LIBRARY_GROUP)
@SuppressWarnings("NewApi")
- public static @Nullable Slice bindSlice(Context context, @NonNull Intent intent) {
- // TODO: Hide this and only allow binding through SliceView.
+ public static @Nullable Slice bindSlice(Context context, @NonNull Intent intent,
+ List<SliceSpec> supportedSpecs) {
if (BuildCompat.isAtLeastP()) {
- return callBindSlice(context, intent, Collections.<SliceSpec>emptyList());
+ return callBindSlice(context, intent, supportedSpecs);
} else {
- return SliceProviderCompat.bindSlice(context, intent,
- Collections.<SliceSpec>emptyList());
+ return SliceProviderCompat.bindSlice(context, intent, supportedSpecs);
}
}