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

Commit dd261cae authored by Łukasz Rymanowski's avatar Łukasz Rymanowski Committed by Gerrit Code Review
Browse files

Merge "BassClientService: Fix NullPointerException"

parents 91c1d5a8 89f590f7
Loading
Loading
Loading
Loading
+19 −4
Original line number Diff line number Diff line
@@ -213,6 +213,11 @@ public class BassClientService extends ProfileService {
    }

    void setActiveSyncedSource(BluetoothDevice scanDelegator, BluetoothDevice sourceDevice) {
        if (mActiveSourceMap == null) {
            Log.e(TAG, "setActiveSyncedSource: mActiveSourceMap is null");
            return;
        }

        log("setActiveSyncedSource, scanDelegator: " + scanDelegator + ", sourceDevice: " +
            sourceDevice);
        if (sourceDevice == null) {
@@ -223,9 +228,17 @@ public class BassClientService extends ProfileService {
    }

    BluetoothDevice getActiveSyncedSource(BluetoothDevice scanDelegator) {
        if (mActiveSourceMap == null) {
            Log.e(TAG, "getActiveSyncedSource: mActiveSourceMap is null");
            return null;
        }

        BluetoothDevice currentSource = mActiveSourceMap.get(scanDelegator);
        log("getActiveSyncedSource: scanDelegator" + scanDelegator
                + "returning " + currentSource);
        log(
                "getActiveSyncedSource: scanDelegator: "
                        + scanDelegator
                        + ", returning: "
                        + currentSource);
        return currentSource;
    }

@@ -1599,7 +1612,8 @@ public class BassClientService extends ProfileService {
                    Log.e(TAG, "Service is null");
                    return false;
                }
                mService.enforceCallingOrSelfPermission(BLUETOOTH_CONNECT, "Need BLUETOOTH_CONNECT permission");
                mService.enforceCallingOrSelfPermission(
                        BLUETOOTH_CONNECT, "Need BLUETOOTH_CONNECT permission");
                return service.setConnectionPolicy(device, connectionPolicy);
            } catch (RuntimeException e) {
                Log.e(TAG, "Exception happened", e);
@@ -1615,7 +1629,8 @@ public class BassClientService extends ProfileService {
                    Log.e(TAG, "Service is null");
                    return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
                }
                mService.enforceCallingOrSelfPermission(BLUETOOTH_CONNECT, "Need BLUETOOTH_CONNECT permission");
                mService.enforceCallingOrSelfPermission(
                        BLUETOOTH_CONNECT, "Need BLUETOOTH_CONNECT permission");
                return service.getConnectionPolicy(device);
            } catch (RuntimeException e) {
                Log.e(TAG, "Exception happened", e);