SliceManager
@RequiresApi(value = 19)
public abstract class SliceManager
Class to handle interactions with Slices.
The SliceViewManager manages permissions and pinned state for slices.
Summary
Public methods |
|
|---|---|
abstract int |
checkSlicePermission(@NonNull Uri uri, int pid, int uid)Determine whether a particular process and user ID has been granted permission to access a specific slice URI. |
static @NonNull SliceManager |
getInstance(@NonNull Context context)Get a |
abstract @NonNull List<Uri> |
Get the list of currently pinned slices for this app. |
abstract void |
grantSlicePermission(@NonNull String toPackage, @NonNull Uri uri)Grant permission to access a specific slice Uri to another package. |
abstract void |
revokeSlicePermission(@NonNull String toPackage, @NonNull Uri uri)Remove permissions to access a particular content provider Uri that were previously added with |
Public methods
checkSlicePermission
public abstract int checkSlicePermission(@NonNull Uri uri, int pid, int uid)
Determine whether a particular process and user ID has been granted permission to access a specific slice URI.
| Parameters | |
|---|---|
@NonNull Uri uri |
The uri that is being checked. |
int pid |
The process ID being checked against. Must be >0. |
int uid |
The user ID being checked against. A uid of 0 is the root user, which will pass every permission check. |
| Returns | |
|---|---|
int |
|
| See also | |
|---|---|
grantSlicePermission |
getInstance
public static @NonNull SliceManager getInstance(@NonNull Context context)
Get a SliceManager.
getPinnedSlices
public abstract @NonNull List<Uri> getPinnedSlices()
Get the list of currently pinned slices for this app.
| See also | |
|---|---|
onSlicePinned |
grantSlicePermission
public abstract void grantSlicePermission(@NonNull String toPackage, @NonNull Uri uri)
Grant permission to access a specific slice Uri to another package.
| Parameters | |
|---|---|
@NonNull String toPackage |
The package you would like to allow to access the Uri. |
@NonNull Uri uri |
The Uri you would like to grant access to. |
| See also | |
|---|---|
revokeSlicePermission |
revokeSlicePermission
public abstract void revokeSlicePermission(@NonNull String toPackage, @NonNull Uri uri)
Remove permissions to access a particular content provider Uri that were previously added with grantSlicePermission for a specific target package. The given Uri will match all previously granted Uris that are the same or a sub-path of the given Uri. That is, revoking "content://foo/target" will revoke both "content://foo/target" and "content://foo/target/sub", but not "content://foo". It will not remove any prefix grants that exist at a higher level.
| Parameters | |
|---|---|
@NonNull String toPackage |
The package you would like to allow to access the Uri. |
@NonNull Uri uri |
The Uri you would like to revoke access to. |
| See also | |
|---|---|
grantSlicePermission |