docs: bypass creating work profile restriction (#242)

Fix CI build pushing
This commit is contained in:
BinTianqi
2026-02-17 15:44:11 +08:00
parent 2cd2ce4449
commit 9cc465f2d6
6 changed files with 39 additions and 14 deletions

View File

@@ -72,6 +72,12 @@ jobs:
with: with:
path: artifacts path: artifacts
- name: Download telegram-bot-api
run: |
mkdir ./binaries
wget "https://github.com/jakbin/telegram-bot-api-binary/releases/download/latest/telegram-bot-api" -O ./binaries/telegram-bot-api
chmod +x ./binaries/telegram-bot-api
- name: Start API Server & Upload - name: Start API Server & Upload
env: env:
COMMIT_MESSAGE: |+ COMMIT_MESSAGE: |+
@@ -85,7 +91,8 @@ jobs:
mv ./$RELEASE_TEST_PWD/app-release.apk ./$RELEASE_TEST_PWD.apk && rm -rf ./$RELEASE_TEST_PWD mv ./$RELEASE_TEST_PWD/app-release.apk ./$RELEASE_TEST_PWD.apk && rm -rf ./$RELEASE_TEST_PWD
export RELEASE_SIGNED_PWD=$(find . -name "*release-signed*") export RELEASE_SIGNED_PWD=$(find . -name "*release-signed*")
mv ./$RELEASE_SIGNED_PWD/app-release.apk ./$RELEASE_SIGNED_PWD.apk && rm -rf ./$RELEASE_SIGNED_PWD mv ./$RELEASE_SIGNED_PWD/app-release.apk ./$RELEASE_SIGNED_PWD.apk && rm -rf ./$RELEASE_SIGNED_PWD
../binaries/telegram-bot-api --api-id=${{ secrets.TELEGRAM_API_APP_ID }} --api-hash=${{ secrets.TELEGRAM_API_HASH }} --local 2>&1 > /dev/null &
export token=${{ secrets.TELEGRAM_BOT_KEY }} export token=${{ secrets.TELEGRAM_BOT_KEY }}
curl -v "http://api.telegram.org/bot$token/sendMediaGroup?chat_id=-1002203528169&media=%5B%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseSigned%22%2C%22parse_mode%22%3A%22HTML%22%2C%22caption%22%3A${ESCAPED}%7D%5D" \ curl -v "http://127.0.0.1:8081/bot$token/sendMediaGroup?chat_id=-1002203528169&media=%5B%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseTest%22%7D%2C%7B%22type%22%3A%22document%22%2C%22media%22%3A%22attach%3A%2F%2FreleaseSigned%22%2C%22parse_mode%22%3A%22HTML%22%2C%22caption%22%3A${ESCAPED}%7D%5D" \
-F releaseTest="@$RELEASE_TEST_PWD.apk" \ -F releaseTest="@$RELEASE_TEST_PWD.apk" \
-F releaseSigned="@$RELEASE_SIGNED_PWD.apk" -F releaseSigned="@$RELEASE_SIGNED_PWD.apk"

View File

@@ -51,11 +51,7 @@ java.lang.IllegalStateException: Not allowed to set the device owner because the
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
``` ```
解决办法: 解决办法:删除其他用户,包括工作资料、私密空间和应用分身。
- 删除次级用户。
> [!NOTE]
> 一些系统有应用克隆、儿童空间等功能,它们通常是用户。
### Device owner 已存在 ### Device owner 已存在
@@ -89,6 +85,19 @@ user limit reached
三星限制了多用户功能,暂无解决办法。 三星限制了多用户功能,暂无解决办法。
### 创建工作资料
在大部分设备上设置device owner后不能创建工作资料因为系统在设置device owner时会添加`no_add_managed_profile`等用户限制。
Device owner不能修改系统设置的用户限制但如果你有root权限你可以在adb shell中执行以下命令以关闭这个限制。
```shell
pm set-user-restriction no_add_user 0
pm set-user-restriction no_add_managed_profile 0
pm set-user-restriction no_add_private_profile 0
pm set-user-restriction no_add_clone_profile 0
```
## API ## API
OwnDroid提供了一个基于Intent的API。你需要在设置中设置密钥并启用API。括号中的数字是最小的安卓版本。 OwnDroid提供了一个基于Intent的API。你需要在设置中设置密钥并启用API。括号中的数字是最小的安卓版本。

View File

@@ -51,11 +51,7 @@ Solutions:
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
``` ```
Solutions: Solution: Delete secondary users, including work profile, private space and app cloning.
- Delete secondary users.
> [!NOTE]
> Some systems have features such as app cloning and children space, which are usually users.
### Device owner is already set ### Device owner is already set
@@ -91,6 +87,19 @@ user limit reached
Samsung restricts Android's multiple users feature. There is currently no solution. Samsung restricts Android's multiple users feature. There is currently no solution.
### Create work profile
On most devices, creating work profile is not allowed by the system when the device owner exist.
Because the system add `no_add_managed_profile` user restriction when a device owner is set.
Device owner can't modify user restrictions set by the system, but if your device is rooted, you can disable this restriction by executing the following commands in adb shell.
```shell
pm set-user-restriction no_add_user 0
pm set-user-restriction no_add_managed_profile 0
pm set-user-restriction no_add_private_profile 0
pm set-user-restriction no_add_clone_profile 0
```
## API ## API
OwnDroid provides an Intent-based API. You need to set the API key in settings and enable the API. The numbers in brackets represent the minimum Android version required. OwnDroid provides an Intent-based API. You need to set the API key in settings and enable the API. The numbers in brackets represent the minimum Android version required.

View File

@@ -179,7 +179,7 @@ fun registerPackageRemovedReceiver(
ctx.registerReceiver(br, filter) ctx.registerReceiver(br, filter)
} }
fun parsePackageNames(input: String) = input.split('\n').filter { it.isNotEmpty() } fun parsePackageNames(input: String) = input.lines().filter { it.isNotEmpty() }
val getInstalledAppsFlags = val getInstalledAppsFlags =
if(Build.VERSION.SDK_INT >= 24) PackageManager.MATCH_DISABLED_COMPONENTS or PackageManager.MATCH_UNINSTALLED_PACKAGES else 0 if(Build.VERSION.SDK_INT >= 24) PackageManager.MATCH_DISABLED_COMPONENTS or PackageManager.MATCH_UNINSTALLED_PACKAGES else 0

View File

@@ -423,7 +423,7 @@ fun PackageNameTextField(
Icon(Icons.AutoMirrored.Default.List, null) Icon(Icons.AutoMirrored.Default.List, null)
} }
}, },
isError = value.isNotEmpty() && !value.isValidPackageName, isError = value.lines().filter { it.isNotEmpty() }.all { it.isValidPackageName },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Ascii, imeAction = ImeAction.Done), keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Ascii, imeAction = ImeAction.Done),
keyboardActions = KeyboardActions { fm.clearFocus() } keyboardActions = KeyboardActions { fm.clearFocus() }
) )

View File

@@ -111,7 +111,7 @@ fun myEntryProvider(
backstack += dest backstack += dest
} }
fun navigateUp() { fun navigateUp() {
backstack.removeLastOrNull() if (backstack.size > 1) backstack.removeLastOrNull()
} }
fun navigateToAppGroups() { fun navigateToAppGroups() {
navigate(Destination.ManageAppGroups) navigate(Destination.ManageAppGroups)