# Shizuku
## Background
When developing apps that requires root, the most common method is to run some commands in the su shell. For example, there is an app that uses the `pm enable/disable` command to enable/disable components.
This method has very big disadvantages:
1. **Extremely slow** (Multiple process creation)
2. Needs to process texts (**Super unreliable**)
3. The possibility is limited to available commands
4. Even if ADB has sufficient permissions, the app requires root privileges to run
Shizuku uses a completely different way. See detailed description below.
## User guide & Download
<https://shizuku.rikka.app/>
## How does Shizuku work?
First, we need to talk about how app use system APIs. For example, if the app wants to get installed apps, we all know we should use `PackageManager#getInstalledPackages()`. This is actually an interprocess communication (IPC) process of the app process and system server process, just the Android framework did the inner works for us.
Android uses `binder` to do this type of IPC. `Binder` allows the server-side to learn the uid and pid of the client-side, so that the system server can check if the app has the permission to do the operation.
Usually, if there is a "manager" (e.g., `PackageManager`) for apps to use, there should be a "service" (e.g., `PackageManagerService`) in the system server process. We can simply think if the app holds the `binder` of the "service", it can communicate with the "service". The app process will receive binders of system services on start.
Shizuku guides users to run a process, Shizuku server, with root or ADB first. When the app starts, the `binder` to Shizuku server will also be sent to the app.
The most important feature Shizuku provides is something like be a middle man to receive requests from the app, sent them to the system server, and send back the results. You can see the `transactRemote` method in `moe.shizuku.server.ShizukuService` class, and `moe.shizuku.api.ShizukuBinderWrapper` class for the detail.
So, we reached our goal, to use system APIs with higher permission. And to the app, it is almost identical to the use of system APIs directly.
## Developer guide
### API & sample
https://github.com/RikkaApps/Shizuku-API
### Migrating from pre-v11
> Existing applications still works, of course.
https://github.com/RikkaApps/Shizuku-API#migration-guide-for-existing-applications-use-shizuku-pre-v11
### Attention
1. ADB permissions are limited
ADB has limited permissions and different on various system versions. You can see permissions granted to ADB [here](https://github.com/aosp-mirror/platform_frameworks_base/blob/master/packages/Shell/AndroidManifest.xml).
Before calling the API, you can use `ShizukuService#getUid` to check if Shizuku is running user ADB, or use `ShizukuService#checkPermission` to check if the server has sufficient permissions.
2. Hidden API limitation from Android 9
As of Android 9, the usage of the hidden APIs is limited for normal apps. Please use other methods (such as <https://github.com/tiann/FreeReflection>).
3. Android 8.0 & ADB
At present, the way Shizuku service gets the app process is to combine `IActivityManager#registerProcessObserver` and `IActivityManager#registerUidObserver` (26+) to ensure that the app process will be sent when the app starts. However, on API 26, ADB lacks permissions to use `registerUidObserver`, so if you need to use Shizuku in a process that might not be started by an Activity, it is recommended to trigger the send binder by starting a transparent activity.
4. Direct use of `transactRemote` requires attention
* The API may be different under different Android versions, please be sure to check it carefully. Also, the `android.app.IActivityManager` has the aidl form in API 26 and later, and `android.app.IActivityManager$Stub` exists only on API 26.
* `SystemServiceHelper.getTransactionCode` may not get the correct transaction code, such as `android.content.pm.IPackageManager$Stub.TRANSACTION_getInstalledPackages` does not exist on API 25 and there is `android.content.pm.IPackageManager$Stub.TRANSACTION_getInstalledPackages_47` (this situation has been dealt with, but it is not excluded that there may be other circumstances). This problem is not encountered with the `ShizukuBinderWrapper` method.
## Developing Shizuku itself
### Build
- Clone with `git clone --recurse-submodules`
- Run gradle task `:manager:assembleDebug` or `:manager:assembleRelease`
The `:manager:assembleDebug` task generates a debuggable server. You can attach a debugger to `shizuku_server` to debug the server.
## License
This project is available under the Apache-2.0 license.
### Exceptions
* You are **FORBIDDEN** to use image files listed below in any way (unless for displaying Shizuku itself).
```
manager/src/main/res/mipmap-hdpi/ic_launcher.png
manager/src/main/res/mipmap-hdpi/ic_launcher_background.png
manager/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
manager/src/main/res/mipmap-xhdpi/ic_launcher.png
manager/src/main/res/mipmap-xhdpi/ic_launcher_background.png
manager/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
manager/src/main/res/mipmap-xxhdpi/ic_launcher.png
manager/src/main/res/mipmap-xxhdpi/ic_launcher_background.png
manager/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png
manager/src/main/res/mipmap-xxxhdpi/ic_launcher.png
manager/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png
manager/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png
```
* You are **FORBIDDEN** to distribute the apk compiled by you (including modified, e.g., rename "Shizuku" to something else) to any store (IBNLT Google Play Store, etc.).
没有合适的资源?快使用搜索试试~ 我知道了~
Shizuku:通过以app_process开头的Java进程直接从普通应用程序使用具有adbroot特权的系统API
共339个文件
xml:108个
java:105个
kt:57个
5星 · 超过95%的资源 需积分: 15 11 下载量 117 浏览量
2021-03-29
14:31:47
上传
评论
收藏 443KB ZIP 举报
温馨提示
uku宿 背景 在开发需要root的应用程序时,最常见的方法是在su shell中运行一些命令。 例如,有一个应用程序使用pm enable/disable命令启用/禁用组件。 这种方法有很大的缺点: 极慢(创建多个进程) 需要处理文本(超级不可靠) 可能性仅限于可用命令 即使ADB具有足够的权限,该应用也需要具有root权限才能运行 Shizuku使用完全不同的方式。 请参阅下面的详细说明。 用户指南和下载 Shizuku如何工作? 首先,我们需要讨论应用程序如何使用系统API。 例如,如果应用程序想要安装应用程序,我们都知道我们应该使用PackageManager#getInstalledPackages() 。 这实际上是应用程序进程和系统服务器进程的进程间通信(IPC)进程,只是Android框架为我们完成了内部工作。 Android使用binder来执行这种类型的IP
资源详情
资源评论
资源推荐
收起资源包目录
Shizuku:通过以app_process开头的Java进程直接从普通应用程序使用具有adbroot特权的系统API (339个子文件)
gradlew.bat 2KB
pmparser.c 5KB
aapt2-resources.cfg 944B
adb_pairing.cpp 8KB
starter.cpp 8KB
misc.cpp 5KB
bypass.cpp 4KB
selinux.cpp 3KB
cgroup.cpp 2KB
helper.cpp 2KB
android.cpp 732B
.gitattributes 52B
.gitignore 268B
.gitignore 32B
.gitignore 13B
.gitignore 7B
.gitignore 7B
.gitignore 7B
.gitignore 7B
.gitignore 7B
.gitignore 7B
.gitignore 7B
.gitmodules 211B
build.gradle 6KB
build.gradle 2KB
gradle-mavenizer.gradle 2KB
build.gradle 1KB
build.gradle 1KB
settings.gradle 870B
build.gradle 818B
signing.gradle 624B
build.gradle 149B
build.gradle 145B
build.gradle 85B
build.gradle 85B
gradlew 5KB
pmparser.h 3KB
logging.h 848B
selinux.h 589B
misc.h 402B
cgroup.h 179B
bypass.h 105B
android.h 90B
adb_pairing.h 45B
gradle-wrapper.jar 52KB
ShizukuService.java 38KB
IntegerSimpleMenuPreference.java 12KB
ShizukuCmd.java 10KB
ServiceStarter.java 7KB
HiddenApiBridge.java 6KB
ConfigManager.java 6KB
BinderSender.java 4KB
MaterialCircleIconView.java 4KB
CustomTabsHelper.java 4KB
RemoteProcessHolder.java 4KB
AppNameComparator.java 3KB
ShizukuSettings.java 3KB
Logger.java 3KB
Logger.java 3KB
EmptySharedPreferencesImpl.java 2KB
IPackageInstaller.java 2KB
IPackageManager.java 2KB
UidObserverAdapter.java 2KB
IPackageInstallerSession.java 2KB
ClientManager.java 2KB
ParcelFileDescriptorUtil.java 2KB
MultiLocaleEntity.java 2KB
IActivityManager.java 2KB
Helps.java 2KB
RequiresApi.java 2KB
OnAppsChangedListenerAdapter.java 2KB
NotificationHelper.java 2KB
BindServiceHelper.java 2KB
IntRange.java 2KB
Nullable.java 2KB
Nullable.java 2KB
CheckedImageView.java 2KB
IOnAppsChangedListener.java 2KB
Binder.java 1KB
IContentProvider.java 1KB
VerticalPaddingDecoration.java 1KB
IPermissionManager.java 1KB
AppOpsManager.java 1KB
NonNull.java 1KB
ThemeHelper.java 1KB
Config.java 1KB
Conscrypt.java 1KB
ClientRecord.java 1KB
IPackageInstallerCallback.java 1007B
IIntentSender.java 1006B
IAppOpsService.java 905B
SystemProperties.java 895B
AppsAdapter.java 814B
IBinder.java 783B
BuildUtils.java 782B
HiddenApiBridgeV23.java 757B
ServiceManager.java 740B
IUserManager.java 712B
ProcessObserverAdapter.java 702B
OsUtils.java 683B
共 339 条
- 1
- 2
- 3
- 4
悦微评剧
- 粉丝: 20
- 资源: 4668
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 青藏高原冻土空间分布-2023年最新绘制
- order system(1).c
- 基于微博数据的舆情分析项目(包括微博爬虫、LDA主题分析和情感分析)高分项目
- 测试电路板用的双针床设备(含工程图sw17可编辑+cad)全套技术开发资料100%好用.zip
- 基于Python控制台的网络入侵检测
- 基于微博数据的舆情分析项目-包括数据分析、LDA主题分析和情感分析(高分项目源码)
- 制作生成自己专属的安卓app应用 制作apk
- 基于python开发的贪食蛇(源码)
- frmcurvechart.ui
- NSFetchedResultsControllerError如何解决.md
- 基于java银行客户信息管理系统论文.doc
- EmptyStackException(解决方案).md
- RuntimeError.md
- wqwerwerwere
- 基于java+ssm+mysql的4S店预约保养系统任务书.docx
- 基于java在线考试系统2毕业论文.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1