Requesting Change System Settings permission fails
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 4.3k
- Forks
- 920
- PR merge metrics
- No merged PRs in 30d
Description
Problem description
When termux-api needs access to change system settings like brightness but doesn't have it, it attempts to ask the user to grant it. But currently it fails to open the settings page with an error.
Steps to reproduce
On a fresh installation, do termux-brightness 0. An error occurs:
## Report Info
**User Action**: `plugin execution command`
**Sender**: `TermuxApiReceiver`
**Report Timestamp**: `2026-04-26 02:54:41.269 UTC`
##
## Termux:API Error
```
Error in TermuxApiReceiver:
android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
at android.app.ContextImpl.startActivity(ContextImpl.java:1167)
at android.app.ContextImpl.startActivity(ContextImpl.java:1143)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:448)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:448)
at com.termux.api.TermuxApiReceiver.doWork(TermuxApiReceiver.java:100)
at com.termux.api.TermuxApiReceiver.onReceive(TermuxApiReceiver.java:65)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:5424)
at android.app.ActivityThread.-$$Nest$mhandleReceiver(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2847)
at android.os.Handler.dispatchMessage(Handler.java:115)
at android.os.Looper.loopOnce(Looper.java:302)
at android.os.Looper.loop(Looper.java:412)
at android.app.ActivityThread.main(ActivityThread.java:9998)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:613)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1074)
```
## Termux:API App Info (Current)
**APP_NAME**: `Termux:API`
**PACKAGE_NAME**: `com.termux.api`
**VERSION_NAME**: `0.53.0`
**VERSION_CODE**: `1002`
**UID**: `10303`
**TARGET_SDK**: `28`
**IS_DEBUGGABLE_BUILD**: `true`
**SE_PROCESS_CONTEXT**: `u:r:untrusted_app_27:s0:c47,c257,c512,c768`
**SE_FILE_CONTEXT**: `u:object_r:app_data_file:s0:c47,c257,c512,c768`
**SE_INFO**: `default:targetSdkVersion=28:complete`
**APK_RELEASE**: `Github`
**SIGNING_CERTIFICATE_SHA256_DIGEST**: `B6DA01480EEFD5FBF2CD3771B8D1021EC791304BDD6C4BF41D3FAABAD48EE5E1`
##
## Termux App Info
**APP_NAME**: `Termux`
**PACKAGE_NAME**: `com.termux`
**VERSION_NAME**: `0.118.0`
**VERSION_CODE**: `118`
**UID**: `10303`
**TARGET_SDK**: `28`
**IS_DEBUGGABLE_BUILD**: `true`
**SE_PROCESS_CONTEXT**: `u:r:untrusted_app_27:s0:c47,c257,c512,c768`
**SE_FILE_CONTEXT**: `u:object_r:app_data_file:s0:c47,c257,c512,c768`
**SE_INFO**: `default:targetSdkVersion=28:complete`
**TERMUX_APP_PACKAGE_MANAGER**: -
**TERMUX_APP_PACKAGE_VARIANT**: -
**APK_RELEASE**: `Github`
**SIGNING_CERTIFICATE_SHA256_DIGEST**: `B6DA01480EEFD5FBF2CD3771B8D1021EC791304BDD6C4BF41D3FAABAD48EE5E1`
##
## Device Info
### Software
**OS_VERSION**: `6.6.89-android15-8-g97a9aaefab9a-ab14519050-4k`
**SDK_INT**: `36`
**RELEASE**: `16`
**ID**: `AP3A.240617.008`
**DISPLAY**: `OPD2415_16.0.5.700(EX01)`
**INCREMENTAL**: `V.R4T3.21fa776_10f506_9d514`
**SECURITY_PATCH**: `2026-03-01`
**IS_TREBLE_ENABLED**: `true`
**TYPE**: `user`
**TAGS**: `release-keys`
**MAX_PHANTOM_PROCESSES**: - (*Requires `DUMP` and `PACKAGE_USAGE_STATS` permission*)
**MONITOR_PHANTOM_PROCS**: `false`
**DEVICE_CONFIG_SYNC_DISABLED**: -
### Hardware
**MANUFACTURER**: `OnePlus`
**BRAND**: `OnePlus`
**MODEL**: `OPD2415`
**PRODUCT**: `OPD2415`
**BOARD**: `sun`
**HARDWARE**: `qcom`
**DEVICE**: `OP6190L1`
**SUPPORTED_ABIS**: `arm64-v8a`
##
Expected behavior
The Change System Settings permission page opens up.
Additional information
- termux-api version: installed from source with
760c1777950d69d87b20c0147588b7b660f29135 - termux-api package version (installed through apt):
termux-api/stable,now 0.59.1-1 aarch64 - Android OS version: 16
- Device model: OnePlus Pad 3
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in TermuxApiReceiver.java around doWork at line 100, using the stack trace and the termux-brightness 0 reproduction. Verify the behavior on a fresh installation and confirm that the Change System Settings permission page opens without the reported AndroidRuntimeException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100