mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
35
Readme-en.md
35
Readme-en.md
@@ -9,6 +9,9 @@ Use Android Device owner privilege to manage your device.
|
|||||||
[IzzyOnDroid F-Droid Repository](https://apt.izzysoft.de/fdroid/index/apk/com.bintianqi.owndroid)
|
[IzzyOnDroid F-Droid Repository](https://apt.izzysoft.de/fdroid/index/apk/com.bintianqi.owndroid)
|
||||||
[Releases on GitHub](https://github.com/BinTianqi/OwnDroid/releases)
|
[Releases on GitHub](https://github.com/BinTianqi/OwnDroid/releases)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> ColorOS users should download testkey version from releases on GitHub
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- System
|
- System
|
||||||
@@ -104,21 +107,31 @@ Solution: Use OwnDroid testkey version
|
|||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
| ID | Description | Extras | Minimum Android version |
|
| ID | Extras | Minimum Android version |
|
||||||
|:---------:|------------------|---------------------------------------|:-----------------------:|
|
|------------------------|---------------|:-----------------------:|
|
||||||
| HIDE | Hide an app | `package`: package name of target app | |
|
| HIDE | `package` | |
|
||||||
| UNHIDE | Unhide an app | `package`: package name of target app | |
|
| UNHIDE | `package` | |
|
||||||
| SUSPEND | Suspend an app | `package`: package name of target app | 7 |
|
| SUSPEND | `package` | 7 |
|
||||||
| UNSUSPEND | Unsuspend an app | `package`: package name of target app | 7 |
|
| UNSUSPEND | `package` | 7 |
|
||||||
| LOCK | Lock screen | | |
|
| ADD_USER_RESTRICTION | `restriction` | |
|
||||||
|
| CLEAR_USER_RESTRICTION | `restriction` | |
|
||||||
|
| LOCK | | |
|
||||||
|
|
||||||
|
[Available user restrictions](https://developer.android.com/reference/android/os/UserManager#constants_1)
|
||||||
|
|
||||||
Use this API in adb shell
|
|
||||||
```shell
|
```shell
|
||||||
am broadcast -a com.bintianqi.owndroid.action.<ID> -n com.bintianqi.owndroid/.ApiReceiver --es key <API_KEY>
|
# An example of hiding app in ADB shell
|
||||||
# Example
|
|
||||||
am broadcast -a com.bintianqi.owndroid.action.HIDE -n com.bintianqi.owndroid/.ApiReceiver --es key abcdefg --es package com.example.app
|
am broadcast -a com.bintianqi.owndroid.action.HIDE -n com.bintianqi.owndroid/.ApiReceiver --es key abcdefg --es package com.example.app
|
||||||
```
|
```
|
||||||
If the return value is 0, the operation is successful.
|
|
||||||
|
```kotlin
|
||||||
|
// An example of hiding app in Kotlin
|
||||||
|
val intent = Intent("com.bintianqi.owndroid.action.HIDE")
|
||||||
|
.setComponent(ComponentName("com.bintianqi.owndroid", "com.bintianqi.owndroid.ApiReceiver"))
|
||||||
|
.putExtra("key", "abcdefg")
|
||||||
|
.putExtra("package", "com.example.app")
|
||||||
|
context.sendBroadcast(intent)
|
||||||
|
```
|
||||||
|
|
||||||
## Build
|
## Build
|
||||||
|
|
||||||
|
|||||||
35
Readme.md
35
Readme.md
@@ -9,6 +9,9 @@
|
|||||||
[IzzyOnDroid F-Droid Repository](https://apt.izzysoft.de/fdroid/index/apk/com.bintianqi.owndroid)
|
[IzzyOnDroid F-Droid Repository](https://apt.izzysoft.de/fdroid/index/apk/com.bintianqi.owndroid)
|
||||||
[Releases on GitHub](https://github.com/BinTianqi/OwnDroid/releases)
|
[Releases on GitHub](https://github.com/BinTianqi/OwnDroid/releases)
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> ColorOS用户应在GitHub上的releases下载testkey版本
|
||||||
|
|
||||||
## 功能
|
## 功能
|
||||||
|
|
||||||
- 系统
|
- 系统
|
||||||
@@ -104,21 +107,31 @@ java.lang.IllegalStateException: Unexpected @ProvisioningPreCondition
|
|||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
| ID | 描述 | Extras | 最小安卓版本 |
|
| ID | Extra | 最小安卓版本 |
|
||||||
|:---------:|----------|--------------------|:------:|
|
|------------------------|---------------|:------:|
|
||||||
| HIDE | 隐藏一个应用 | `package`: 目标应用的包名 | |
|
| HIDE | `package` | |
|
||||||
| UNHIDE | 取消隐藏一个应用 | `package`: 目标应用的包名 | |
|
| UNHIDE | `package` | |
|
||||||
| SUSPEND | 挂起一个应用 | `package`: 目标应用的包名 | 7 |
|
| SUSPEND | `package` | 7 |
|
||||||
| UNSUSPEND | 取消挂起一个应用 | `package`: 目标应用的包名 | 7 |
|
| UNSUSPEND | `package` | 7 |
|
||||||
| LOCK | 锁屏 | | |
|
| ADD_USER_RESTRICTION | `restriction` | |
|
||||||
|
| CLEAR_USER_RESTRICTION | `restriction` | |
|
||||||
|
| LOCK | | |
|
||||||
|
|
||||||
|
[可用的用户限制](https://developer.android.google.cn/reference/android/os/UserManager#constants_1)
|
||||||
|
|
||||||
在adb shell中使用API
|
|
||||||
```shell
|
```shell
|
||||||
am broadcast -a com.bintianqi.owndroid.action.<ID> -n com.bintianqi.owndroid/.ApiReceiver --es key <API_KEY>
|
# 一个在ADB shell中隐藏app的示例
|
||||||
# 示例
|
|
||||||
am broadcast -a com.bintianqi.owndroid.action.HIDE -n com.bintianqi.owndroid/.ApiReceiver --es key abcdefg --es package com.example.app
|
am broadcast -a com.bintianqi.owndroid.action.HIDE -n com.bintianqi.owndroid/.ApiReceiver --es key abcdefg --es package com.example.app
|
||||||
```
|
```
|
||||||
如果返回值为0,操作成功
|
|
||||||
|
```kotlin
|
||||||
|
// 一个在Kotlin中隐藏app的示例
|
||||||
|
val intent = Intent("com.bintianqi.owndroid.action.HIDE")
|
||||||
|
.setComponent(ComponentName("com.bintianqi.owndroid", "com.bintianqi.owndroid.ApiReceiver"))
|
||||||
|
.putExtra("key", "abcdefg")
|
||||||
|
.putExtra("package", "com.example.app")
|
||||||
|
context.sendBroadcast(intent)
|
||||||
|
```
|
||||||
|
|
||||||
## 构建
|
## 构建
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import com.bintianqi.owndroid.dpm.getReceiver
|
|||||||
|
|
||||||
class ApiReceiver: BroadcastReceiver() {
|
class ApiReceiver: BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
val requestKey = intent.getStringExtra("key") ?: ""
|
val requestKey = intent.getStringExtra("key")
|
||||||
var log = "OwnDroid API request received. action: ${intent.action}\nkey: $requestKey"
|
var log = "OwnDroid API request received. action: ${intent.action}\nkey: $requestKey"
|
||||||
val sp = SharedPrefs(context)
|
val sp = SharedPrefs(context)
|
||||||
if(!sp.isApiEnabled) return
|
if(!sp.isApiEnabled) return
|
||||||
@@ -18,6 +18,7 @@ class ApiReceiver: BroadcastReceiver() {
|
|||||||
val dpm = context.getDPM()
|
val dpm = context.getDPM()
|
||||||
val receiver = context.getReceiver()
|
val receiver = context.getReceiver()
|
||||||
val app = intent.getStringExtra("package")
|
val app = intent.getStringExtra("package")
|
||||||
|
val restriction = intent.getStringExtra("restriction")
|
||||||
if(!app.isNullOrEmpty()) log += "\npackage: $app"
|
if(!app.isNullOrEmpty()) log += "\npackage: $app"
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("NewApi")
|
@SuppressWarnings("NewApi")
|
||||||
@@ -26,7 +27,9 @@ class ApiReceiver: BroadcastReceiver() {
|
|||||||
"com.bintianqi.owndroid.action.UNHIDE" -> dpm.setApplicationHidden(receiver, app, false)
|
"com.bintianqi.owndroid.action.UNHIDE" -> dpm.setApplicationHidden(receiver, app, false)
|
||||||
"com.bintianqi.owndroid.action.SUSPEND" -> dpm.setPackagesSuspended(receiver, arrayOf(app), true).isEmpty()
|
"com.bintianqi.owndroid.action.SUSPEND" -> dpm.setPackagesSuspended(receiver, arrayOf(app), true).isEmpty()
|
||||||
"com.bintianqi.owndroid.action.UNSUSPEND" -> dpm.setPackagesSuspended(receiver, arrayOf(app), false).isEmpty()
|
"com.bintianqi.owndroid.action.UNSUSPEND" -> dpm.setPackagesSuspended(receiver, arrayOf(app), false).isEmpty()
|
||||||
"com.bintianqi.owndroid.action.LOCK" -> { dpm.lockNow(); null }
|
"com.bintianqi.owndroid.action.ADD_USER_RESTRICTION" -> { dpm.addUserRestriction(receiver, restriction); true }
|
||||||
|
"com.bintianqi.owndroid.action.CLEAR_USER_RESTRICTION" -> { dpm.clearUserRestriction(receiver, restriction); true }
|
||||||
|
"com.bintianqi.owndroid.action.LOCK" -> { dpm.lockNow(); true }
|
||||||
else -> {
|
else -> {
|
||||||
log += "\nInvalid action"
|
log += "\nInvalid action"
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user