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

Commit 2a252911 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix errorprone warnings that should be errors"

parents 98ab2bf0 8675483c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -457,11 +457,11 @@ public class BassClientStateMachine extends StateMachine {
                subGroup.addChannel(channel.build());
            }
            byte[] arrayCodecId = baseLevel2.codecId;
            long codeId = (long) ((arrayCodecId[4] & 0xff) << 32
            long codeId = ((long) (arrayCodecId[4] & 0xff)) << 32
                    | (arrayCodecId[3] & 0xff) << 24
                    | (arrayCodecId[2] & 0xff) << 16
                    | (arrayCodecId[1] & 0xff) << 8
                    | (arrayCodecId[0] & 0xff));
                    | (arrayCodecId[0] & 0xff);
            subGroup.setCodecId(codeId);
            subGroup.setCodecSpecificConfig(BluetoothLeAudioCodecConfigMetadata.
                    fromRawBytes(baseLevel2.codecConfigInfo));
+8 −4
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.view.Display;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
import com.android.bluetooth.btservice.BluetoothAdapterProxy;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayDeque;
@@ -110,7 +111,9 @@ public class ScanManager {
    // Scan parameters for batch scan.
    private BatchScanParams mBatchScanParms;

    private Integer mCurUsedTrackableAdvertisements;
    private final Object mCurUsedTrackableAdvertisementsLock = new Object();
    @GuardedBy("mCurUsedTrackableAdvertisementsLock")
    private int mCurUsedTrackableAdvertisements = 0;
    private final GattService mService;
    private final AdapterService mAdapterService;
    private BroadcastReceiver mBatchAlarmReceiver;
@@ -157,7 +160,6 @@ public class ScanManager {
                Collections.newSetFromMap(new ConcurrentHashMap<ScanClient, Boolean>());
        mService = service;
        mScanNative = new ScanNative();
        mCurUsedTrackableAdvertisements = 0;
        mDm = mService.getSystemService(DisplayManager.class);
        mActivityManager = mService.getSystemService(ActivityManager.class);
        mLocationManager = mService.getSystemService(LocationManager.class);
@@ -716,8 +718,10 @@ public class ScanManager {
    }

    public int getCurrentUsedTrackingAdvertisement() {
        synchronized (mCurUsedTrackableAdvertisementsLock) {
            return mCurUsedTrackableAdvertisements;
        }
    }

    private class ScanNative {

@@ -1508,7 +1512,7 @@ public class ScanManager {
                boolean allocate) {
            int maxTotalTrackableAdvertisements =
                    AdapterService.getAdapterService().getTotalNumOfTrackableAdvertisements();
            synchronized (mCurUsedTrackableAdvertisements) {
            synchronized (mCurUsedTrackableAdvertisementsLock) {
                int availableEntries =
                        maxTotalTrackableAdvertisements - mCurUsedTrackableAdvertisements;
                if (allocate) {
+2 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.bluetooth.Utils;

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

class VendorCommandResponseProcessor {

@@ -106,7 +107,7 @@ class VendorCommandResponseProcessor {
        // replace all white spaces
        commandWord = commandWord.replaceAll("\\s+", "");

        if (SUPPORTED_VENDOR_AT_COMMANDS.get(commandWord) != (Integer) (vendorId)) {
        if (!Objects.equals(SUPPORTED_VENDOR_AT_COMMANDS.get(commandWord), vendorId)) {
            Log.e(TAG, "Invalid command " + atCommand + ", " + vendorId + ". Cand="
                    + commandWord);
            return false;
+1 −1
Original line number Diff line number Diff line
@@ -752,7 +752,7 @@ public class LeAudioService extends ProfileService {
        }
        synchronized (mGroupLock) {
            for (Map.Entry<BluetoothDevice, Integer> entry : mDeviceGroupIdMap.entrySet()) {
                if (entry.getValue() != groupId) {
                if (!Objects.equals(entry.getValue(), groupId)) {
                    continue;
                }
                LeAudioStateMachine sm = mStateMachines.get(entry.getKey());
+1 −1
Original line number Diff line number Diff line
@@ -673,7 +673,7 @@ class MceStateMachine extends StateMachine {
                        case NEW_MESSAGE:
                            // Infer the timestamp for this message as 'now' and read status false
                            // instead of getting the message listing data for it
                            if (!mMessages.contains(ev.getHandle())) {
                            if (!mMessages.containsKey(ev.getHandle())) {
                                Calendar calendar = Calendar.getInstance();
                                MessageMetadata metadata = new MessageMetadata(ev.getHandle(),
                                        calendar.getTime().getTime(), false);
Loading