Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 986f57e8 authored by William Escande's avatar William Escande
Browse files

BluetoothManager: override context deviceId

Changing the device association invalidates the context's attribution
source. Caching it causes a crash.

The BluetoothAdapter passes its cached attribution source to
PermissionManager and an exception is thrown because the given context
and attribution source have different device associations.
At this point there's not much that PermissionManager can do to handle
this gracefully.

The correct fix is to:
* In the bluetooth stack never cache an attribution source directly,
  use a Context instance instead, so its attribution source is always
  up to date.

But because of the BluetoothDevice and BluetoothAdapter implementation,
and because of robolectric that prevent us to update the
BluetoothAdapter constructor, we cannot make those change.

Instead createDeviceContext will pin the deviceId and thuss, the
AttributionSource will still match its Context

Bug: 349657939
Bug: 343121936
Test: None
Flag: com.android.bluetooth.flags.override_context_to_specify_device_id
Change-Id: I239af84013f5571a50ef0322f8b71fc1f33e40d7
parent 1a7bcca7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment