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

Commit 3d805961 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Errorprone: GuardedBy" into main am: 21df80bb am: 69577f2a

parents cecebbd1 69577f2a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ android_app {
            "-Xep:EqualsHashCode:ERROR",
            "-Xep:FallThrough:ERROR",
            "-Xep:Finalize:ERROR",
            "-Xep:GuardedBy:ERROR",
            "-Xep:HidingField:ERROR",
            "-Xep:InconsistentHashCode:ERROR",
            "-Xep:InlineMeInliner:ERROR",
+19 −9
Original line number Diff line number Diff line
@@ -524,12 +524,14 @@ public class A2dpService extends ProfileService {
    @VisibleForTesting
    public boolean setSilenceMode(@NonNull BluetoothDevice device, boolean silence) {
        Log.d(TAG, "setSilenceMode(" + device + "): " + silence);
        synchronized (mStateMachines) {
            if (silence && Objects.equals(mActiveDevice, device)) {
                removeActiveDevice(true);
            } else if (!silence && mActiveDevice == null) {
                // Set the device as the active device if currently no active device.
                setActiveDevice(device);
            }
        }
        if (!mNativeInterface.setSilenceDevice(device, silence)) {
            Log.e(TAG, "Cannot set " + device + " silence mode " + silence + " in native layer");
            return false;
@@ -752,8 +754,10 @@ public class A2dpService extends ProfileService {
    public void setCodecConfigPreference(BluetoothDevice device, BluetoothCodecConfig codecConfig) {
        Log.d(TAG, "setCodecConfigPreference(" + device + "): " + Objects.toString(codecConfig));
        if (device == null) {
            synchronized (mStateMachines) {
                device = mActiveDevice;
            }
        }
        if (device == null) {
            Log.e(TAG, "setCodecConfigPreference: Invalid device");
            return;
@@ -779,8 +783,10 @@ public class A2dpService extends ProfileService {
    public void enableOptionalCodecs(BluetoothDevice device) {
        Log.d(TAG, "enableOptionalCodecs(" + device + ")");
        if (device == null) {
            synchronized (mStateMachines) {
                device = mActiveDevice;
            }
        }
        if (device == null) {
            Log.e(TAG, "enableOptionalCodecs: Invalid device");
            return;
@@ -807,8 +813,10 @@ public class A2dpService extends ProfileService {
    public void disableOptionalCodecs(BluetoothDevice device) {
        Log.d(TAG, "disableOptionalCodecs(" + device + ")");
        if (device == null) {
            synchronized (mStateMachines) {
                device = mActiveDevice;
            }
        }
        if (device == null) {
            Log.e(TAG, "disableOptionalCodecs: Invalid device");
            return;
@@ -1685,7 +1693,9 @@ public class A2dpService extends ProfileService {
    @Override
    public void dump(StringBuilder sb) {
        super.dump(sb);
        synchronized (mStateMachines) {
            ProfileService.println(sb, "mActiveDevice: " + mActiveDevice);
        }
        ProfileService.println(sb, "mMaxConnectedAudioDevices: " + mMaxConnectedAudioDevices);
        if (mA2dpCodecConfig != null) {
            ProfileService.println(sb, "codecConfigPriorities:");
+2 −2
Original line number Diff line number Diff line
@@ -59,10 +59,10 @@ public class AvrcpNativeInterface {
            if (sInstance == null) {
                sInstance = new AvrcpNativeInterface();
            }
        }

            return sInstance;
        }
    }

    /** Set singleton instance. */
    @VisibleForTesting
+12 −4
Original line number Diff line number Diff line
@@ -1200,23 +1200,31 @@ public class ActiveDeviceManager implements AdapterService.BluetoothStateCallbac

    @VisibleForTesting
    BluetoothDevice getA2dpActiveDevice() {
        synchronized (mLock) {
            return mA2dpActiveDevice;
        }
    }

    @VisibleForTesting
    BluetoothDevice getHfpActiveDevice() {
        synchronized (mLock) {
            return mHfpActiveDevice;
        }
    }

    @VisibleForTesting
    Set<BluetoothDevice> getHearingAidActiveDevices() {
        synchronized (mLock) {
            return mHearingAidActiveDevices;
        }
    }

    @VisibleForTesting
    BluetoothDevice getLeAudioActiveDevice() {
        synchronized (mLock) {
            return mLeAudioActiveDevice;
        }
    }

    @GuardedBy("mLock")
    private long getHearingAidActiveHiSyncIdLocked() {
+10 −6
Original line number Diff line number Diff line
@@ -860,17 +860,21 @@ public class HeadsetClientService extends ProfileService {
                        + allowed
                        + ", "
                        + Utils.getUidPidString());
        synchronized (mStateMachineMap) {
            HeadsetClientStateMachine sm = mStateMachineMap.get(device);
            if (sm != null) {
                sm.setAudioRouteAllowed(allowed);
            }
        }
    }

    public boolean getAudioRouteAllowed(BluetoothDevice device) {
        synchronized (mStateMachineMap) {
            HeadsetClientStateMachine sm = mStateMachineMap.get(device);
            if (sm != null) {
                return sm.getAudioRouteAllowed();
            }
        }
        return false;
    }

Loading