Merge "Fix NPE during restartBleScan() when scanner is null" into sc-v2-dev

This commit is contained in:
Guojing Yuan
2021-11-01 23:13:21 +00:00
committed by Android (Google) Code Review

View File

@@ -1451,8 +1451,12 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
}
void restartBleScan() {
mBluetoothAdapter.getBluetoothLeScanner().stopScan(mBleScanCallback);
startBleScan();
if (mBluetoothAdapter.getBluetoothLeScanner() != null) {
mBluetoothAdapter.getBluetoothLeScanner().stopScan(mBleScanCallback);
startBleScan();
} else {
Slog.w(LOG_TAG, "BluetoothLeScanner is null (likely BLE isn't ON yet).");
}
}
private List<ScanFilter> getBleScanFilters() {