-
- All Implemented Interfaces:
-
android.content.ComponentCallbacks,android.content.ComponentCallbacks2
public class ShizukuProvider extends ContentProvider
This provider receives binder from Shizuku server. When app process starts, Shizuku server (it runs under adb/root) will send the binder to client apps with this provider.
Add the provider to your manifest like this:
<manifest> ... <application> ... <provider android:name="rikka.shizuku.ShizukuProvider" android:authorities="${applicationId}.shizuku" android:exported="true" android:multiprocess="false" android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" </provider> ... </application> </manifest>There are something needs you attention:
android:permissionshoule be a permission that granted to Shell (com.android.shell) but not normal apps (e.g., android.permission.INTERACT_ACROSS_USERS_FULL), so that it can only be used by the app itself and Shizuku server.android:exportedmust betrueso that the provider can be accessed from Shizuku server runs under adb.android:multiprocessmust befalsesince Shizuku server only gets uid when app starts.
If your app run in multiply processes, this provider also provides the functionality of sharing the binder across processes. See enableMultiProcessSupport.
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringMETHOD_SEND_BINDERpublic final static StringMETHOD_GET_BINDERpublic final static StringACTION_BINDER_RECEIVEDpublic final static StringPERMISSIONpublic final static StringMANAGER_APPLICATION_IDprivate static booleanisProviderProcess
-
Method Summary
Modifier and Type Method Description static voidsetIsProviderProcess(boolean isProviderProcess)static voidenableMultiProcessSupport(boolean isProviderProcess)Enables built-in multi-process support. static voiddisableAutomaticSuiInitialization()Disable automatic Sui initialization. static voidrequestBinderForNonProviderProcess(@NonNull() Context context)Require binder for non-provider process, should have enableMultiProcessSupport called first. voidattachInfo(Context context, ProviderInfo info)booleanonCreate()Bundlecall(@NonNull() String method, @Nullable() String arg, @Nullable() Bundle extras)final Cursorquery(@NonNull() Uri uri, @Nullable() Array<String> projection, @Nullable() String selection, @Nullable() Array<String> selectionArgs, @Nullable() String sortOrder)final StringgetType(@NonNull() Uri uri)final Uriinsert(@NonNull() Uri uri, @Nullable() ContentValues values)final intdelete(@NonNull() Uri uri, @Nullable() String selection, @Nullable() Array<String> selectionArgs)final intupdate(@NonNull() Uri uri, @Nullable() ContentValues values, @Nullable() String selection, @Nullable() Array<String> selectionArgs)-
Methods inherited from class android.content.ContentProvider
applyBatch, attachInfo, bulkInsert, call, canonicalize, clearCallingIdentity, delete, dump, getCallingAttributionSource, getCallingAttributionTag, getCallingPackage, getCallingPackageUnchecked, getContext, getPathPermissions, getReadPermission, getStreamTypes, getType, getWritePermission, insert, onCallingPackageChanged, onConfigurationChanged, onCreate, onLowMemory, onTrimMemory, openAssetFile, openFile, openPipeHelper, openTypedAssetFile, query, refresh, requireContext, restoreCallingIdentity, shutdown, uncanonicalize, update -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
setIsProviderProcess
static void setIsProviderProcess(boolean isProviderProcess)
-
enableMultiProcessSupport
static void enableMultiProcessSupport(boolean isProviderProcess)
Enables built-in multi-process support.
This method MUST be called as early as possible (e.g., static block in Application).
-
disableAutomaticSuiInitialization
static void disableAutomaticSuiInitialization()
Disable automatic Sui initialization.
-
requestBinderForNonProviderProcess
static void requestBinderForNonProviderProcess(@NonNull() Context context)
Require binder for non-provider process, should have enableMultiProcessSupport called first.
- Parameters:
context- Context
-
attachInfo
void attachInfo(Context context, ProviderInfo info)
-
onCreate
boolean onCreate()
-
call
@Nullable() Bundle call(@NonNull() String method, @Nullable() String arg, @Nullable() Bundle extras)
-
query
@Nullable() final Cursor query(@NonNull() Uri uri, @Nullable() Array<String> projection, @Nullable() String selection, @Nullable() Array<String> selectionArgs, @Nullable() String sortOrder)
-
delete
final int delete(@NonNull() Uri uri, @Nullable() String selection, @Nullable() Array<String> selectionArgs)
-
-
-
-