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

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

Merge changes I06880640,Ida99e0e5 into main

* changes:
  Errorprone: Fix & enforce RedundantControlFlow
  Errorprone: Fix & enforce DuplicateBranches
parents 7f3e5612 8ead8b1a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ java_defaults {
            "-Xep:ClassCanBeStatic:ERROR",
            "-Xep:DateFormatConstant:ERROR",
            "-Xep:DirectInvocationOnMock:ERROR",
            "-Xep:DuplicateBranches:ERROR",
            "-Xep:EmptyBlockTag:ERROR",
            "-Xep:EmptyCatch:ERROR",
            "-Xep:EnumOrdinal:ERROR",
@@ -152,6 +153,7 @@ java_defaults {
            "-Xep:NullableVoid:ERROR",
            "-Xep:ObjectEqualsForPrimitives:ERROR",
            "-Xep:OperatorPrecedence:ERROR",
            "-Xep:RedundantControlFlow:ERROR",
            "-Xep:ReferenceEquality:ERROR",
            "-Xep:ReturnAtTheEndOfVoidFunction:ERROR",
            "-Xep:ReturnFromVoid:ERROR",
+16 −18
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.bluetooth.bass_client;
import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static android.Manifest.permission.BLUETOOTH_SCAN;
import static android.bluetooth.BluetoothProfile.STATE_CONNECTED;
import static android.bluetooth.IBluetoothLeAudio.LE_AUDIO_GROUP_ID_INVALID;

import static com.android.bluetooth.flags.Flags.leaudioAllowedContextMask;
@@ -1532,7 +1533,7 @@ public class BassClientService extends ProfileService {
            return BluetoothStatusCodes.ERROR_BAD_PARAMETERS;
        }

        if (getConnectionState(device) != BluetoothProfile.STATE_CONNECTED) {
        if (getConnectionState(device) != STATE_CONNECTED) {
            log("validateParameters: device is not connected, device: " + device);
            return BluetoothStatusCodes.ERROR_REMOTE_LINK_ERROR;
        }
@@ -1661,10 +1662,10 @@ public class BassClientService extends ProfileService {
            }

            /* Restore allowed context mask for unicast in case if last connected broadcast
             * delegator device which has external source disconnectes.
             * delegator device which has external source disconnects.
             */
            checkAndResetGroupAllowedContextMask();
        } else if (toState == BluetoothProfile.STATE_CONNECTED) {
        } else if (toState == STATE_CONNECTED) {
            handleReconnectingAudioSharingModeDevice(device);
        }
    }
@@ -3579,7 +3580,7 @@ public class BassClientService extends ProfileService {
                if (devices.stream()
                        .anyMatch(
                                d ->
                                        ((getConnectionState(d) == BluetoothProfile.STATE_CONNECTED)
                                        ((getConnectionState(d) == STATE_CONNECTED)
                                                && leAudioService.isPrimaryDevice(d)))) {
                    continue;
                }
@@ -3600,8 +3601,7 @@ public class BassClientService extends ProfileService {
                                        d ->
                                                !d.equals(sink)
                                                        && (getConnectionState(d)
                                                                == BluetoothProfile
                                                                        .STATE_CONNECTED))) {
                                                                == STATE_CONNECTED))) {
                    iterator.remove();
                    leAudioService.stopBroadcast(broadcastId);
                    continue;
@@ -3612,10 +3612,9 @@ public class BassClientService extends ProfileService {
                        .anyMatch(
                                d ->
                                        !d.equals(sink)
                                                && (getConnectionState(d)
                                                        == BluetoothProfile.STATE_CONNECTED))) {
                                                && (getConnectionState(d) == STATE_CONNECTED))) {
                    continue;
                } else {
                }
                Log.d(
                        TAG,
                        "handleUnintendedDeviceDisconnection: No more potential broadcast "
@@ -3627,7 +3626,6 @@ public class BassClientService extends ProfileService {
            }
        }
    }
    }

    /** Handle device newly connected and its peer device still has active source */
    private void checkAndResumeBroadcast(BluetoothDevice sink) {
@@ -4185,7 +4183,7 @@ public class BassClientService extends ProfileService {
                    try {
                        invokeCallback(callback, msg);
                    } catch (RemoteException e) {
                        continue;
                        // Ignore exception
                    }
                }
                mCallbacksList.finishBroadcast();
+0 −2
Original line number Diff line number Diff line
@@ -649,8 +649,6 @@ public class HeadsetClientStateMachine extends StateMachine {
                    action = HeadsetClientHalConstants.CALL_ACTION_CHLD_1;
                } else if (getCall(HfpClientCall.CALL_STATE_ACTIVE) != null) {
                    action = HeadsetClientHalConstants.CALL_ACTION_CHLD_3;
                } else if (flag == BluetoothHeadsetClient.CALL_ACCEPT_NONE) {
                    action = HeadsetClientHalConstants.CALL_ACTION_CHLD_2;
                } else {
                    action = HeadsetClientHalConstants.CALL_ACTION_CHLD_2;
                }
+14 −14
Original line number Diff line number Diff line
@@ -2900,7 +2900,7 @@ public class LeAudioService extends ProfileService {
                            .getBroadcastItem(i)
                            .onGroupStreamStatusChanged(groupId, groupStreamStatus);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -2916,7 +2916,7 @@ public class LeAudioService extends ProfileService {
                            .getBroadcastItem(i)
                            .onBroadcastToUnicastFallbackGroupChanged(groupId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -4768,7 +4768,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onGroupNodeAdded(device, groupId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -4847,7 +4847,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onGroupNodeRemoved(device, groupId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -4861,7 +4861,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onGroupStatusChanged(groupId, status);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -4875,7 +4875,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onCodecConfigChanged(groupId, status);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -4889,7 +4889,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStarted(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -4903,7 +4903,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStartFailed(reason);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -4917,7 +4917,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStopped(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -4931,7 +4931,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStopFailed(reason);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -4945,7 +4945,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onPlaybackStarted(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -4959,7 +4959,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onPlaybackStopped(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -4975,7 +4975,7 @@ public class LeAudioService extends ProfileService {
                            .getBroadcastItem(i)
                            .onBroadcastUpdateFailed(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -4992,7 +4992,7 @@ public class LeAudioService extends ProfileService {
                            .getBroadcastItem(i)
                            .onBroadcastMetadataChanged(broadcastId, metadata);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
+0 −2
Original line number Diff line number Diff line
@@ -3483,8 +3483,6 @@ public class BluetoothMapContent {
                        BluetoothProtoEnums.BLUETOOTH_MAP_CONTENT,
                        BluetoothStatsLog.BLUETOOTH_CONTENT_PROFILE_ERROR_REPORTED__TYPE__EXCEPTION,
                        4);
                // skip this id
                continue;
            }
        }

Loading