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

Commit 4ad06f85 authored by Kyunglyul Hyun's avatar Kyunglyul Hyun Committed by Automerger Merge Worker
Browse files

Merge "Handle NPE from BluetoothRouteProvider" am: 5a1f9e67 am: c890ab56...

Merge "Handle NPE from BluetoothRouteProvider" am: 5a1f9e67 am: c890ab56 am: d92ac490 am: bb5c45c2 am: 4f848db3

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2121494



Change-Id: I6fd094edde8a56afb3710d5a679fc07021143873
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 6fd74404 4f848db3
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -348,18 +348,14 @@ class BluetoothRouteProvider {

    private void addActiveRoute(BluetoothRouteInfo btRoute) {
        if (btRoute == null) {
            if (DEBUG) {
                Log.d(TAG, " btRoute is null");
            }
            Slog.w(TAG, "addActiveRoute: btRoute is null");
            return;
        }
        if (DEBUG) {
            Log.d(TAG, "Adding active route: " + btRoute.route);
        }
        if (mActiveRoutes.contains(btRoute)) {
            if (DEBUG) {
                Log.d(TAG, " btRoute is already added.");
            }
            Slog.w(TAG, "addActiveRoute: btRoute is already added.");
            return;
        }
        setRouteConnectionState(btRoute, STATE_CONNECTED);
@@ -392,6 +388,12 @@ class BluetoothRouteProvider {
    private void addActiveDevices(BluetoothDevice device) {
        // Let the given device be the first active device
        BluetoothRouteInfo activeBtRoute = mBluetoothRoutes.get(device.getAddress());
        // This could happen if ACTION_ACTIVE_DEVICE_CHANGED is sent before
        // ACTION_CONNECTION_STATE_CHANGED is sent.
        if (activeBtRoute == null) {
            activeBtRoute = createBluetoothRoute(device);
            mBluetoothRoutes.put(device.getAddress(), activeBtRoute);
        }
        addActiveRoute(activeBtRoute);

        // A bluetooth route with the same route ID should be added.