Skip to content

don't grant the sensors permission if app explicitly opts out - #393

Open
vayun-mathur wants to merge 448 commits into
GrapheneOS:17from
vayun-mathur:sensors_opt_out
Open

don't grant the sensors permission if app explicitly opts out#393
vayun-mathur wants to merge 448 commits into
GrapheneOS:17from
vayun-mathur:sensors_opt_out

Conversation

@vayun-mathur

@vayun-mathur vayun-mathur commented Jun 25, 2026

Copy link
Copy Markdown

Closes GrapheneOS/os-issue-tracker#8125

Gives apps the ability to indicate that they don't use sensors permission so that users don't have to consider whether or not to give them sensors permission.

Let me know if there is anything else you need from me here

muhomorr and others added 30 commits June 16, 2026 18:17
Co-authored-by: Pratyush <codelab@pratyush.dev>
Co-authored-by: Pratyush <codelab@pratyush.dev>
If there's no network location provider:
- redirect network location requests to one of available location providers
- stub out mock location management calls for network provider (TestProvider methods), since
redirecting them is infeasible

These changes apply only to third-party apps.

There's a relevant system feature (android.hardware.location.network) that is still listed as
available to improve app compatibility.
Removing it would not make this change redundant, because there are apps that try to use the network
location provider without declaring the need for this feature or checking its presence at runtime.
- report job progress when it's running
- prompt the user to restart optimized apps after job completion
- schedule automatic restart of optimized apps via ActivityManager.killProcessesWhenImperceptible()
in case they aren't restarted manually
This allows to skip restarting them after post-OTA asynchronous optimization, which some VPN service
hosts don't handle properly.
Some of per-app features (e.g. SELinux restrictions) require app process restart to be applied.
Value of the previous global setting is used as a default value of the new per-app setting.

For system apps, native debugging is blocked unconditionally.
"App info" screen for controlling ptrace access is linked from this notification.
All non-app tombstones were considered to have the same processName ("UNKNOWN"), which meant that
frequent tombstones from one system process rate-limited tombstones from all system processes.
Instances of FileList and EntryFile are stored in java.util.TreeSet.

TreeSet requires that compareTo() is consistent with equals().
System error file contents are added to the DropBox when file's timestamp changes. Last known file
timestamps are kept in a separate file. This race condition caused some updates to last known
timestamps getting lost, which led to their corresponding system error files being treated as
new system errors after device reboot.
Show notifications about the following events:
- kernel crash (from last_kmsg) (optional)
- file system check error
- system_server crash (Java or native)
- system app native crash (optional, except for memory tagging crashes)
- non-app process native crash (optional, except for memory tagging crashes)
- some of hardened_malloc app crashes (those that are caused by fatal_error() call in hardened_malloc
after it detects an app error)

These events are recorded in the system journal ("DropBox") already, this commit surfaces them to
the user.
Currently covers restriction of dynamic code loading via memory/storage and blocking of ptrace
access.

Testing is performed on three kinds of HardeningTestApp: targetSdk 27, current targetSdk and
preinstalled current targetSdk app (the latter is included on debuggable builds).

Preinstalled app is tested separately to make sure that restrictions can't be weakened for it,
regardless of GosPackageState values.

To run the test, execute `atest HardeningTest`.
muhomorr and others added 29 commits June 19, 2026 17:37
See previous
GrapheneOS@e38a7a0#diff-011b32fdcd5ea1e2e73efc213d16ecc75b1882828437db6372ebf47fec388a7aR347-R354

Add back missing mLockDomain parameter

Adjust to new Android 17 changes from
GrapheneOS@853fa20
to prevent showing incorrect message "Or unlock with fingerprint" when failing 2FA pin
Since Android 17, receiving Bluetooth state broadcasts for non-primary users requires using
registerReceiverForAllUsers().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A way for apps to tell the OS it doesn't need OTHER_SENSORS permission