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

Commit 8f66d662 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5450365 from 2a21bea448c56d892cf7c726771889ff2299f4d5 to pi-platform-release

Change-Id: I944e7d1ac9deebd68b7a3d2f3b8200df78a23099
parents fc760870 dbc1cc55
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.Locale;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;

@@ -1174,6 +1175,26 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
        }

        private boolean bindService() {
            int state = BluetoothAdapter.STATE_OFF;
            try {
                mBluetoothLock.readLock().lock();
                if (mBluetooth != null) {
                    state = mBluetooth.getState();
                }
            } catch (RemoteException e) {
                Slog.e(TAG, "Unable to call getState", e);
                return false;
            } finally {
                mBluetoothLock.readLock().unlock();
            }

            if (!mEnable || state != BluetoothAdapter.STATE_ON) {
                if (DBG) {
                    Slog.d(TAG, "Unable to bindService while Bluetooth is disabled");
                }
                return false;
            }

            if (mIntent != null && mService == null && doBind(mIntent, this, 0,
                    UserHandle.CURRENT_OR_SELF)) {
                Message msg = mHandler.obtainMessage(MESSAGE_BIND_PROFILE_SERVICE);
@@ -1259,7 +1280,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
            if (mService == null) {
                return;
            }
            try {
                mService.unlinkToDeath(this, 0);
            } catch (NoSuchElementException e) {
                Log.e(TAG, "error unlinking to death", e);
            }
            mService = null;
            mClassName = null;