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

Commit f00cdfe1 authored by William Escande's avatar William Escande Committed by Gerrit Code Review
Browse files

Merge "Changing params for SendBroadcastMultiplePermissions"

parents ff373caa 5f2d22d4
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -982,7 +982,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();
@@ -995,9 +1005,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
@@ -718,11 +718,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
@@ -360,7 +360,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