Add FAQ to READMEs

Fix #93: list hidden apps in package selector
This commit is contained in:
BinTianqi
2025-01-19 15:02:26 +08:00
parent 2dc760dbe3
commit a21db0da70
3 changed files with 107 additions and 2 deletions

View File

@@ -43,6 +43,57 @@ Use Android Device owner privilege to manage your device.
- Set screen timeout - Set screen timeout
- ... - ...
## Activate
- Shizuku (recommended)
- Execute command in adb shell: `dpm set-device-owner com.bintianqi.owndroid/.Receiver`
## FAQ
### Activating
#### Already some accounts on the device
```text
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device
```
Solutions:
- Freeze apps who hold those accounts.
- Delete these accounts.
- Use LSPosed module [HookDPM](https://github.com/BinTianqi/HookDPM).
#### Already several users on the device
```text
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
```
Solutions:
- Delete secondary users.
- Use LSPosed module [HookDPM](https://github.com/BinTianqi/HookDPM).
> [!NOTE]
> Some systems have features such as app cloning and children space, which are usually users.
#### MIUI
```text
java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_DEVICE_ADMINS.
```
Solutions:
- Enable `USB debugging (Security setting)` in developer options.
- Execute activating command in root shell.
#### ColorOS
```text
java.lang.IllegalStateException: Unexpected @ProvisioningPreCondition
```
Solution: Use OwnDroid testkey version
## API ## API
| ID | Description | Extras | Minimum Android version | | ID | Description | Extras | Minimum Android version |

View File

@@ -43,6 +43,57 @@
- 设置屏幕超时 - 设置屏幕超时
- ... - ...
## 激活
- Shizuku (推荐)
- 在ADB命令行中执行命令: `dpm set-device-owner com.bintianqi.owndroid/.Receiver`
## FAQ
### 激活
#### 设备上有账号
```text
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device
```
解决办法:
- 冻结持有这些账号的app。
- 删除这些账号。
- 使用LSPosed模块 [HookDPM](https://github.com/BinTianqi/HookDPM)。
#### 设备上有多个用户
```text
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
```
解决办法:
- 删除次级用户。
- 使用LSPosed模块[HookDPM](https://github.com/BinTianqi/HookDPM)。
> [!NOTE]
> 一些系统有应用克隆、儿童空间等功能,它们通常是用户。
#### MIUI
```text
java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_DEVICE_ADMINS.
```
解决办法:
- 在开发者设置中打开`USB debugging (Security setting)`
- 在root命令行中执行激活命令
#### ColorOS
```text
java.lang.IllegalStateException: Unexpected @ProvisioningPreCondition
```
解决办法:使用 OwnDroid testkey 版本
## API ## API
| ID | 描述 | Extras | 最小安卓版本 | | ID | 描述 | Extras | 最小安卓版本 |

View File

@@ -1,7 +1,9 @@
package com.bintianqi.owndroid package com.bintianqi.owndroid
import android.content.pm.ApplicationInfo import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.os.Build
import android.widget.Toast import android.widget.Toast
import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.AnimatedVisibility
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
@@ -69,7 +71,8 @@ data class PackageInfo(
fun PackageSelector(navCtrl: NavHostController, vm: MyViewModel) { fun PackageSelector(navCtrl: NavHostController, vm: MyViewModel) {
val context = LocalContext.current val context = LocalContext.current
val pm = context.packageManager val pm = context.packageManager
val apps = pm.getInstalledApplications(0) val flags = if(Build.VERSION.SDK_INT >= 24) PackageManager.MATCH_DISABLED_COMPONENTS or PackageManager.MATCH_UNINSTALLED_PACKAGES else 0
val apps = pm.getInstalledApplications(flags)
var progress by remember { mutableIntStateOf(0) } var progress by remember { mutableIntStateOf(0) }
var show by remember { mutableStateOf(true) } var show by remember { mutableStateOf(true) }
var hideProgress by remember { mutableStateOf(true) } var hideProgress by remember { mutableStateOf(true) }
@@ -79,7 +82,7 @@ fun PackageSelector(navCtrl: NavHostController, vm: MyViewModel) {
val scrollState = rememberLazyListState() val scrollState = rememberLazyListState()
val focusMgr = LocalFocusManager.current val focusMgr = LocalFocusManager.current
val co = rememberCoroutineScope() val co = rememberCoroutineScope()
val getPkgList: suspend ()->Unit = { suspend fun getPkgList() {
show = false show = false
progress = 0 progress = 0
hideProgress = false hideProgress = false