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

Commit abb11939 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

Make KEY_MISSING into ordered broadcast

Ordered broadcasts can't require multiple permissions, so require just
the more strict, BLUETOOTH_PRIVILEGED.

Bug: 344915071
Flag: key_missing_as_ordered_broadcast
Test: mma -j68
Merged-In: I396f1d3802629fa27ba53702ee73d9c0a4a1a541
Change-Id: Ie0bd37fba3d096d9973d692991522c04d78c883f
parent 55843315
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -260,6 +260,7 @@ android_app {
        "android.hardware.radio-V1.0-java",
        "android.hardware.radio.sap-V1-java",
        "android.media.audio-aconfig-exported-java",
        "android.os.flags-aconfig-java-export",
        "androidx.annotation_annotation",
        "androidx.core_core",
        "androidx.lifecycle_lifecycle-livedata",
+23 −4
Original line number Diff line number Diff line
@@ -20,7 +20,10 @@ import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
import static android.Manifest.permission.BLUETOOTH_SCAN;

import static com.android.modules.utils.build.SdkLevel.isAtLeastV;

import android.annotation.RequiresPermission;
import android.app.Activity;
import android.app.admin.SecurityLog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAssignedNumbers;
@@ -1405,12 +1408,28 @@ public class RemoteDevices {
                            .addFlags(
                                    Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT
                                            | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);

            if (isAtLeastV()
                    && Flags.keyMissingAsOrderedBroadcast()
                    && android.os.Flags.orderedBroadcastMultiplePermissions()) {
                mAdapterService.sendOrderedBroadcastMultiplePermissions(
                        intent,
                        new String[] {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
                        null /* receiverAppOp */,
                        null /* resultReceiver */,
                        null /* scheduler */,
                        Activity.RESULT_OK /* initialCode */,
                        null /* initialData */,
                        null /* initialExtras */,
                        Utils.getTempBroadcastOptions().toBundle());
            } else {
                mAdapterService.sendBroadcastMultiplePermissions(
                        intent,
                        new String[] {BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED},
                        Utils.getTempBroadcastOptions());
            }
        }
    }

    void encryptionChangeCallback(
            byte[] address,