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

Commit 6a426fda authored by William Escande's avatar William Escande
Browse files

GetNameAndAddress: run on proper thread

Bug: 372775662
Bug: 371659191
Bug: 368114370
Flag: com.android.bluetooth.flags.get_name_and_address_as_callback
Test: m Bluetooth
Change-Id: Ibf5d5cc4ac08feb37013ffe10907ecd6a5145685
parent 7a67441a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1200,6 +1200,11 @@ public class AdapterService extends Service {
    }

    void updateAdapterName(String name) {
        // TODO: b/372775662 - remove post once caller is on correct thread
        mHandler.post(() -> updateAdapterNameInternal(name));
    }

    private void updateAdapterNameInternal(String name) {
        int n = mRemoteCallbacks.beginBroadcast();
        Log.d(TAG, "updateAdapterName(" + name + ")");
        for (int i = 0; i < n; i++) {
@@ -1213,6 +1218,11 @@ public class AdapterService extends Service {
    }

    void updateAdapterAddress(String address) {
        // TODO: b/372775662 - remove post once caller is on correct thread
        mHandler.post(() -> updateAdapterAddressInternal(address));
    }

    private void updateAdapterAddressInternal(String address) {
        int n = mRemoteCallbacks.beginBroadcast();
        Log.d(TAG, "updateAdapterAddress(" + BluetoothUtils.toAnonymizedAddress(address) + ")");
        for (int i = 0; i < n; i++) {