Skip to content

protect the Bluetooth app from being disabled - #484

Draft
cameronaaron wants to merge 2 commits into
GrapheneOS:17from
cameronaaron:fix-required-boot-packages
Draft

cameronaaron wants to merge 2 commits into
GrapheneOS:17from
cameronaaron:fix-required-boot-packages

Conversation

@cameronaaron

@cameronaaron cameronaaron commented Nov 1, 2026 •

Copy link
Copy Markdown

Closes GrapheneOS/os-issue-tracker#9044

BluetoothService resolves the Bluetooth app's service while system_server starts and throws if the app is disabled or hidden for the system user. pm disable-user com.android.bluetooth is accepted, and the device then crashes on every boot, before safe mode is checked.

  • The package named by config_systemBluetoothStack is added to the system required packages, so it can't be disabled, hidden, suspended or uninstalled. system-required-packages.xml would be the natural place for it, but that file isn't installed.
  • While the package manager starts, required packages that are disabled or hidden are restored to the default state, so a device already in this state boots again after sideloading a release with this change.

Settings no longer offers to disable the app: GrapheneOS/platform_packages_apps_Settings#464.

Tests: PackageManagerServiceTest#testBluetoothAppCannotBeDisabledByShell and PackageManagerSettingsTests#testRestoreBootRequiredPackageStates. I haven't run them on a device yet.

BluetoothService resolves the Bluetooth app's service while system_server
starts and throws if it can't, which happens when the app is disabled or
hidden for the system user. system_server then crashes on every boot,
before safe mode is checked, and a locked device can only be recovered
with a factory reset. Shell accepted pm disable-user for it.

Add the package named by config_systemBluetoothStack to the system
required packages so it can't be disabled, hidden, suspended or
uninstalled. The packages from system-required-packages.xml can't be
relied on for this since that file isn't installed.
Rejecting attempts to disable or hide a required package doesn't help a
device where that was already done. A Bluetooth app disabled for the
system user makes system_server crash on every boot before safe mode is
checked, and a locked device with the default USB setting can't be
reached over adb to undo it.

While the package manager starts, reset the enabled state and unhide
system packages required during boot for every user. Installing an OTA
with this change through recovery then lets such a device boot again
without losing data.
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.

Disabling com.android.bluetooth crashes system_server on every boot, before Safe Mode, with no recovery path short of a wipe

1 participant