The error you're encountering indicates that the android.permission.WRITE_SETTINGS permission is managed by a role on One UI (Samsung's Android skin). This means you cannot grant it directly via ADB for com.termux.api or any other app. Instead, you must assign the app to a role that includes this permission.
WRITE_SETTINGS on One UIOne UI restricts WRITE_SETTINGS to apps assigned to the "Settings Manager" role. You can assign this role to com.termux.api using ADB:
Check available roles (optional):
bashadb shell dpm list-roles
Look for android.app.role.SETTINGS_MANAGER or similar.
Assign the role to Termux:API:
bashadb shell dpm set-role-holder com.termux.api android.app.role.SETTINGS_MANAGER
If this fails, try:
bashadb shell dpm set-role-holder com.termux.api android.app.role.WRITE_SETTINGS
Verify the role assignment:
bashadb shell dpm get-role-holders android.app.role.SETTINGS_MANAGER
If ADB fails, try enabling it manually:
Open Settings > Apps.
Tap the three-dot menu > Special Access > Write system settings.
Enable com.termux.api (Termux:API) in the list.
(Note: This path may vary slightly depending on your One UI version.)
If the above fails, use Shizuku to grant the permission via ADB:
WRITE_SETTINGS for Termux:API.WRITE_SETTINGS to roles for security.pm grant command fails because the permission is not a runtime permission but a role-managed permission.Try Method 1 first. If it doesn’t work, check if com.termux.api appears in the Special Access menu (Method 2).
Vibe can make mistakes. Check answers. Learn more