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

Commit a4881d91 authored by Jack He's avatar Jack He Committed by Automerger Merge Worker
Browse files

Merge "Fix null reference used for synchronization" am: bd190fb0 am:...

Merge "Fix null reference used for synchronization" am: bd190fb0 am: d28319a7 am: 60ecaaac am: 5442aae7

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2056516



Change-Id: I0feba5a365cd6e2283d5602079ced733c05d93a8
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents dc607e6a 5442aae7
Loading
Loading
Loading
Loading
+19 −18
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ public class BassClientService extends ProfileService {
    private static BassClientService sService;

    private final Map<BluetoothDevice, BassClientStateMachine> mStateMachines = new HashMap<>();
    private final Object mSearchScanCallbackLock = new Object();

    private HandlerThread mStateMachinesThread;
    private HandlerThread mCallbackHandlerThread;
@@ -624,7 +625,7 @@ public class BassClientService extends ProfileService {
            Log.e(TAG, "startLeScan: cannot get BluetoothLeScanner");
            return;
        }
        synchronized (mSearchScanCallback) {
        synchronized (mSearchScanCallbackLock) {
            if (mSearchScanCallback != null) {
                Log.e(TAG, "LE Scan has already started");
                mCallbacks.notifySearchStartFailed(BluetoothStatusCodes.ERROR_UNKNOWN);
@@ -690,7 +691,7 @@ public class BassClientService extends ProfileService {
            Log.e(TAG, "startLeScan: cannot get BluetoothLeScanner");
            return;
        }
        synchronized (mSearchScanCallback) {
        synchronized (mSearchScanCallbackLock) {
            if (mSearchScanCallback == null) {
                Log.e(TAG, "Scan not started yet");
                mCallbacks.notifySearchStopFailed(BluetoothStatusCodes.ERROR_UNKNOWN);
@@ -707,7 +708,7 @@ public class BassClientService extends ProfileService {
     * @return true if a search has been started by this application
     */
    public boolean isSearchInProgress() {
        synchronized (mSearchScanCallback) {
        synchronized (mSearchScanCallbackLock) {
            return mSearchScanCallback != null;
        }
    }
@@ -1052,7 +1053,7 @@ public class BassClientService extends ProfileService {
                }
                return service.getConnectionState(sink);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return BluetoothProfile.STATE_DISCONNECTED;
            }
        }
@@ -1067,7 +1068,7 @@ public class BassClientService extends ProfileService {
                }
                return service.getDevicesMatchingConnectionStates(states);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return Collections.emptyList();
            }
        }
@@ -1082,7 +1083,7 @@ public class BassClientService extends ProfileService {
                }
                return service.getConnectedDevices();
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return Collections.emptyList();
            }
        }
@@ -1097,7 +1098,7 @@ public class BassClientService extends ProfileService {
                }
                return service.setConnectionPolicy(device, connectionPolicy);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return false;
            }
        }
@@ -1112,7 +1113,7 @@ public class BassClientService extends ProfileService {
                }
                return service.getConnectionPolicy(device);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
            }
        }
@@ -1127,7 +1128,7 @@ public class BassClientService extends ProfileService {
                }
                service.registerCallback(cb);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
            }
        }

@@ -1141,7 +1142,7 @@ public class BassClientService extends ProfileService {
                }
                service.unregisterCallback(cb);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
            }
        }

@@ -1155,7 +1156,7 @@ public class BassClientService extends ProfileService {
                }
                service.startSearchingForSources(filters);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
            }
        }

@@ -1169,7 +1170,7 @@ public class BassClientService extends ProfileService {
                }
                service.stopSearchingForSources();
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
            }
        }

@@ -1183,7 +1184,7 @@ public class BassClientService extends ProfileService {
                }
                return service.isSearchInProgress();
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return false;
            }
        }
@@ -1200,7 +1201,7 @@ public class BassClientService extends ProfileService {
                }
                service.addSource(sink, sourceMetadata, isGroupOp);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
            }
        }

@@ -1215,7 +1216,7 @@ public class BassClientService extends ProfileService {
                }
                service.modifySource(sink, sourceId, updatedMetadata);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
            }
        }

@@ -1229,7 +1230,7 @@ public class BassClientService extends ProfileService {
                }
                service.removeSource(sink, sourceId);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
            }
        }

@@ -1243,7 +1244,7 @@ public class BassClientService extends ProfileService {
                }
                return service.getAllSources(sink);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return Collections.emptyList();
            }
        }
@@ -1258,7 +1259,7 @@ public class BassClientService extends ProfileService {
                }
                return service.getMaximumSourceCapacity(sink);
            } catch (RuntimeException e) {
                Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable()));
                Log.e(TAG, "Exception happened", e);
                return 0;
            }
        }