Repository navigation
protect the Bluetooth app from being disabled - #484
Draft
cameronaaron wants to merge 2 commits into
Draft
cameronaaron wants to merge 2 commits into
cameronaaron wants to merge 2 commits into
Conversation
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.
cameronaaron
marked this pull request as draft
November 1, 2026 09:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.bluetoothis accepted, and the device then crashes on every boot, before safe mode is checked.config_systemBluetoothStackis added to the system required packages, so it can't be disabled, hidden, suspended or uninstalled.system-required-packages.xmlwould be the natural place for it, but that file isn't installed.Settings no longer offers to disable the app: GrapheneOS/platform_packages_apps_Settings#464.
Tests:
PackageManagerServiceTest#testBluetoothAppCannotBeDisabledByShellandPackageManagerSettingsTests#testRestoreBootRequiredPackageStates. I haven't run them on a device yet.