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

Commit c6ffc79a authored by Roopa Sattiraju's avatar Roopa Sattiraju
Browse files

Changing params for SendBroadcastMultiplePermissions as per the API

change

Bug: 216731966
Test: Compile and Test
Change-Id: I3fcb188ddcd7652c2596149be44a6a42373a43fa
parent 00aad92a
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -983,7 +983,17 @@ public final class Utils {
        return 1 == context.getContentResolver().update(uri, values, null, null);
    }

    /**
     * Returns bundled broadcast options.
     */
    public static @NonNull Bundle getTempAllowlistBroadcastOptions() {
        return getTempBroadcastOptions().toBundle();
    }

    /**
     * Returns broadcast options.
     */
    public static @NonNull BroadcastOptions getTempBroadcastOptions() {
        // Use the Bluetooth process identity to pass permission check when reading DeviceConfig
        final long ident = Binder.clearCallingIdentity();
        final BroadcastOptions bOptions = BroadcastOptions.makeBasic();
@@ -996,9 +1006,8 @@ public final class Utils {
        } finally {
            Binder.restoreCallingIdentity(ident);
        }
        return bOptions.toBundle();
        return bOptions;
    }

    /**
     * Checks that value is present as at least one of the elements of the array.
     * @param array the array to check in
+2 −2
Original line number Diff line number Diff line
@@ -714,11 +714,11 @@ final class RemoteDevices {
                if (pkg.getPermission() != null) {
                    sAdapterService.sendBroadcastMultiplePermissions(intent,
                            new String[] { BLUETOOTH_SCAN, pkg.getPermission() },
                            Utils.getTempAllowlistBroadcastOptions());
                            Utils.getTempBroadcastOptions());
                } else {
                    sAdapterService.sendBroadcastMultiplePermissions(intent,
                            new String[] { BLUETOOTH_SCAN },
                            Utils.getTempAllowlistBroadcastOptions());
                            Utils.getTempBroadcastOptions());
                }
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -1934,7 +1934,7 @@ public class HeadsetClientStateMachine extends StateMachine {

        mService.sendBroadcastMultiplePermissions(intent,
                new String[] {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
                Utils.getTempAllowlistBroadcastOptions());
                Utils.getTempBroadcastOptions());

        HfpClientConnectionService.onConnectionStateChanged(device, newState, prevState);
    }
+1 −1
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ class MceStateMachine extends StateMachine {
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        mService.sendBroadcastMultiplePermissions(intent,
                new String[] {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
                Utils.getTempAllowlistBroadcastOptions());
                Utils.getTempBroadcastOptions());
    }

    public synchronized int getState() {
+1 −1
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ final class PbapClientStateMachine extends StateMachine {
        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
        mService.sendBroadcastMultiplePermissions(intent,
                new String[] {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
                Utils.getTempAllowlistBroadcastOptions());
                Utils.getTempBroadcastOptions());
    }

    public void disconnect(BluetoothDevice device) {
Loading