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

Commit be9fffe7 authored by William Escande's avatar William Escande
Browse files

Inline sendBroadcast

Test: m .
Bug: 311772251
Flag: Exempt, Mechanical refactor
Change-Id: I995c5c1104f9bd8bddb821367a33e7ca223f9331
parent 6d8c9821
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -1187,18 +1187,6 @@ public final class Utils {
        return bOptions;
    }

    /**
     * Sends the {@code intent} as a broadcast in the provided {@code context} to receivers that
     * have been granted the specified {@code receiverPermission} with the {@link BroadcastOptions}
     * {@code options}.
     *
     * @see Context#sendBroadcast(Intent, String, Bundle)
     */
    public static void sendBroadcast(@NonNull Context context, @NonNull Intent intent,
            @Nullable String receiverPermission, @Nullable Bundle options) {
        context.sendBroadcast(intent, receiverPermission, options);
    }

    /**
     * @see Context#sendOrderedBroadcast(Intent, String, Bundle, BroadcastReceiver, Handler,
     *          int, String, Bundle)
+2 −4
Original line number Diff line number Diff line
@@ -1097,8 +1097,7 @@ public class A2dpService extends ProfileService {
        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
                        | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
        Utils.sendBroadcast(this, intent, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions());
        sendBroadcast(intent, BLUETOOTH_CONNECT, Utils.getTempAllowlistBroadcastOptions());
    }

    private void broadcastCodecConfig(BluetoothDevice device, BluetoothCodecStatus codecStatus) {
@@ -1108,8 +1107,7 @@ public class A2dpService extends ProfileService {
        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
                        | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
        Utils.sendBroadcast(this, intent, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions());
        sendBroadcast(intent, BLUETOOTH_CONNECT, Utils.getTempAllowlistBroadcastOptions());
    }

    public void handleBondStateChanged(BluetoothDevice device, int fromState, int toState) {
+4 −4
Original line number Diff line number Diff line
@@ -741,8 +741,8 @@ final class A2dpStateMachine extends StateMachine {
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
                        | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
        mA2dpService.handleConnectionStateChanged(mDevice, prevState, newState);
        Utils.sendBroadcast(mA2dpService, intent, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions());
        mA2dpService.sendBroadcast(
                intent, BLUETOOTH_CONNECT, Utils.getTempAllowlistBroadcastOptions());
    }

    private void broadcastAudioState(int newState, int prevState) {
@@ -753,8 +753,8 @@ final class A2dpStateMachine extends StateMachine {
        intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState);
        intent.putExtra(BluetoothProfile.EXTRA_STATE, newState);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        Utils.sendBroadcast(mA2dpService, intent, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions());
        mA2dpService.sendBroadcast(
                intent, BLUETOOTH_CONNECT, Utils.getTempAllowlistBroadcastOptions());
    }

    @Override
+1 −2
Original line number Diff line number Diff line
@@ -318,7 +318,6 @@ class A2dpSinkStateMachine extends StateMachine {
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        mService.connectionStateChanged(mDevice, mMostRecentState, currentState);
        mMostRecentState = currentState;
        Utils.sendBroadcast(mService, intent, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions());
        mService.sendBroadcast(intent, BLUETOOTH_CONNECT, Utils.getTempAllowlistBroadcastOptions());
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -1359,8 +1359,7 @@ class AvrcpControllerStateMachine extends StateMachine {
        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice);
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        mMostRecentState = currentState;
        Utils.sendBroadcast(mService, intent, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions());
        mService.sendBroadcast(intent, BLUETOOTH_CONNECT, Utils.getTempAllowlistBroadcastOptions());
    }

    private boolean shouldRequestFocus() {
Loading