Repository navigation
protect the Bluetooth app from being disabled - #484
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.
|
Really appreciate you working on a fix for this, @cameronaaron. I'm the one who filed the issue, and my phone is stuck in exactly this state. Quick question on the restore: the call is behind |
|
protect_system_required_packages is enabled for both cp2a and trunk_staging. I put into draft because I need to test on device at some point but don't have time rn |
Thanks, that answers it. Appreciate you taking this on. |
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.