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

Commit 8ead8b1a authored by William Escande's avatar William Escande
Browse files

Errorprone: Fix & enforce RedundantControlFlow

Bug: 311772251
Test: m .
Flag: Exempt no-op change to respect lint recommendation
Change-Id: I06880640026315e1aa20f3d0aadddd6e50804666
parent f4c29143
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -153,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();
+14 −14
Original line number Diff line number Diff line
@@ -2968,7 +2968,7 @@ public class LeAudioService extends ProfileService {
                            .getBroadcastItem(i)
                            .onGroupStreamStatusChanged(groupId, groupStreamStatus);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -2984,7 +2984,7 @@ public class LeAudioService extends ProfileService {
                            .getBroadcastItem(i)
                            .onBroadcastToUnicastFallbackGroupChanged(groupId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -4910,7 +4910,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onGroupNodeAdded(device, groupId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -4989,7 +4989,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onGroupNodeRemoved(device, groupId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -5003,7 +5003,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onGroupStatusChanged(groupId, status);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -5017,7 +5017,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mLeAudioCallbacks.getBroadcastItem(i).onCodecConfigChanged(groupId, status);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mLeAudioCallbacks.finishBroadcast();
@@ -5031,7 +5031,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStarted(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -5045,7 +5045,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStartFailed(reason);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -5059,7 +5059,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStopped(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -5073,7 +5073,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onBroadcastStopFailed(reason);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -5087,7 +5087,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onPlaybackStarted(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -5101,7 +5101,7 @@ public class LeAudioService extends ProfileService {
                try {
                    mBroadcastCallbacks.getBroadcastItem(i).onPlaybackStopped(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -5117,7 +5117,7 @@ public class LeAudioService extends ProfileService {
                            .getBroadcastItem(i)
                            .onBroadcastUpdateFailed(reason, broadcastId);
                } catch (RemoteException e) {
                    continue;
                    // Ignore Exception
                }
            }
            mBroadcastCallbacks.finishBroadcast();
@@ -5134,7 +5134,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;
            }
        }

+0 −1
Original line number Diff line number Diff line
@@ -323,7 +323,6 @@ public class BluetoothMapConvoListingElement
            } else {
                Log.w(TAG, "Unknown XML tag: " + name);
                Utils.skipCurrentTag(parser);
                continue;
            }
        }
        // As we have extracted all attributes, we should expect an end-tag
Loading