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

Commit 22262b4b authored by David Duarte's avatar David Duarte
Browse files

bluetooth_manager: Use dumpAsync to not block on Bluetooth

IBinder#dump on a BinderProxy is making a non ONEWAY call and
as result can block the system_server. To avoid this ONEWAY
outgoing calls are prohibited in the system_server.

So IBinder#dump is replaced by IBinder#dumpAsync to dump using a
ONEWAY binder transaction.

The effect of this is that the bluetooth_manager service will not
propagate anymore exception raised by AdapterService#dump to
dumpsys.

This effect is acceptable as the exception will still be reported
to logcat.

Bug: 239890880
Test: m com.android.btservices
Test: `adb shell dumpsys bluetooth_manager` and check the log for
  the absence of warnings from Binder
Test: Modify the Bluetooth app to sleep for 10 seconds then run
  `adb shell dumpsys bluetooth_manager` and confirm that dumpsys
  timeouts
Flag: Exempt, dumpsys is a debug feature + full manual testing was done.
Change-Id: Ia7146349813990405f436743310def117b1d3890
parent 40dad539
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2433,8 +2433,7 @@ class BluetoothManagerService {
            errorMsg = "Bluetooth Service not connected";
        } else {
            try {
                // TODO(b/239890880): system_server cannot make non-oneway call
                mAdapter.getAdapterBinder().asBinder().dump(fd, args);
                mAdapter.getAdapterBinder().asBinder().dumpAsync(fd, args);
            } catch (RemoteException re) {
                errorMsg = "RemoteException while dumping Bluetooth Service";
            }