SliceManager

@RequiresApi(value = 19)
abstract class SliceManager


Class to handle interactions with Slices.

The SliceViewManager manages permissions and pinned state for slices.

Summary

Public functions

abstract Int
checkSlicePermission(uri: Uri, pid: Int, uid: Int)

Determine whether a particular process and user ID has been granted permission to access a specific slice URI.

java-static SliceManager
getInstance(context: Context)

Get a SliceManager.

abstract (Mutable)List<Uri!>

Get the list of currently pinned slices for this app.

abstract Unit
grantSlicePermission(toPackage: String, uri: Uri)

Grant permission to access a specific slice Uri to another package.

abstract Unit
revokeSlicePermission(toPackage: String, uri: Uri)

Remove permissions to access a particular content provider Uri that were previously added with grantSlicePermission for a specific target package.

Public functions

checkSlicePermission

Added in 1.1.0-alpha02
abstract fun checkSlicePermission(uri: Uri, pid: Int, uid: Int): Int

Determine whether a particular process and user ID has been granted permission to access a specific slice URI.

Parameters
uri: Uri

The uri that is being checked.

pid: Int

The process ID being checked against. Must be >0.

uid: Int

The user ID being checked against. A uid of 0 is the root user, which will pass every permission check.

Returns
Int

PERMISSION_GRANTED if the given pid/uid is allowed to access that uri, or PERMISSION_DENIED if it is not.

getInstance

Added in 1.1.0-alpha02
java-static fun getInstance(context: Context): SliceManager

Get a SliceManager.

getPinnedSlices

Added in 1.1.0-alpha02
abstract fun getPinnedSlices(): (Mutable)List<Uri!>

Get the list of currently pinned slices for this app.

See also
onSlicePinned

grantSlicePermission

Added in 1.1.0-alpha02
abstract fun grantSlicePermission(toPackage: String, uri: Uri): Unit

Grant permission to access a specific slice Uri to another package.

Parameters
toPackage: String

The package you would like to allow to access the Uri.

uri: Uri

The Uri you would like to grant access to.

revokeSlicePermission

Added in 1.1.0-alpha02
abstract fun revokeSlicePermission(toPackage: String, uri: Uri): Unit

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
toPackage: String

The package you would like to allow to access the Uri.

uri: Uri

The Uri you would like to revoke access to.