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
Loading
Please register or sign in to comment