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

Commit 931df242 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Register the service-to-app callback whenever the service comes up for...

Merge "Register the service-to-app callback whenever the service comes up for BluetoothConnectionCallback. This ensures that if the bluetooth process dies, the callbacks will be re-established once it comes back up."
parents c97c1674 00040ba3
Loading
Loading
Loading
Loading
+25 −15
Original line number Diff line number Diff line
@@ -2933,6 +2933,16 @@ public final class BluetoothAdapter {
                            }
                        });
                    }
                    synchronized (mBluetoothConnectionCallbackExecutorMap) {
                        if (!mBluetoothConnectionCallbackExecutorMap.isEmpty()) {
                            try {
                                mService.registerBluetoothConnectionCallback(mConnectionCallback);
                            } catch (RemoteException e) {
                                Log.e(TAG, "onBluetoothServiceUp: Failed to register bluetooth"
                                        + "connection callback", e);
                            }
                        }
                    }
                }

                public void onBluetoothServiceDown() {
@@ -3582,6 +3592,7 @@ public final class BluetoothAdapter {
            return false;
        }

        synchronized (mBluetoothConnectionCallbackExecutorMap) {
            // If the callback map is empty, we register the service-to-app callback
            if (mBluetoothConnectionCallbackExecutorMap.isEmpty()) {
                try {
@@ -3600,7 +3611,6 @@ public final class BluetoothAdapter {
            }

            // Adds the passed in callback to our map of callbacks to executors
        synchronized (mBluetoothConnectionCallbackExecutorMap) {
            if (mBluetoothConnectionCallbackExecutorMap.containsKey(callback)) {
                throw new IllegalArgumentException("This callback has already been registered");
            }