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

Commit 6d57d919 authored by William Escande's avatar William Escande
Browse files

Inline sendOrderedBroadcast

Test: m .
Bug: 311772251
Flag: Exempt, Mechanical refactor
Change-Id: Ic557820493fd9698e992be7c539579a510a68850
parent be9fffe7
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -42,10 +42,8 @@ import android.bluetooth.BluetoothDevice;
import android.companion.AssociationInfo;
import android.companion.CompanionDeviceManager;
import android.content.AttributionSource;
import android.content.BroadcastReceiver;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.location.LocationManager;
@@ -53,7 +51,6 @@ import android.net.Uri;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.ParcelUuid;
import android.os.PowerExemptionManager;
import android.os.Process;
@@ -1187,18 +1184,6 @@ public final class Utils {
        return bOptions;
    }

    /**
     * @see Context#sendOrderedBroadcast(Intent, String, Bundle, BroadcastReceiver, Handler,
     *          int, String, Bundle)
     */
    public static void sendOrderedBroadcast(@NonNull Context context, @NonNull Intent intent,
            @Nullable String receiverPermission, @Nullable Bundle options,
            @Nullable BroadcastReceiver resultReceiver, @Nullable Handler scheduler,
            int initialCode, @Nullable String initialData, @Nullable Bundle initialExtras) {
        context.sendOrderedBroadcast(intent, receiverPermission, options, resultReceiver, scheduler,
                initialCode, initialData, initialExtras);
    }

    /**
     * Checks that value is present as at least one of the elements of the array.
     * @param array the array to check in
+9 −4
Original line number Diff line number Diff line
@@ -463,9 +463,14 @@ final class BondStateMachine extends StateMachine {
        intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        // Workaround for Android Auto until pre-accepting pairing requests is added.
        intent.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
        Utils.sendOrderedBroadcast(mAdapterService, intent, BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions(), null/* resultReceiver */,
                null/* scheduler */, Activity.RESULT_OK/* initialCode */, null/* initialData */,
        mAdapterService.sendOrderedBroadcast(
                intent,
                BLUETOOTH_CONNECT,
                Utils.getTempAllowlistBroadcastOptions(),
                null /* resultReceiver */,
                null /* scheduler */,
                Activity.RESULT_OK /* initialCode */,
                null /* initialData */,
                null /* initialExtras */);
    }

+9 −3
Original line number Diff line number Diff line
@@ -652,9 +652,15 @@ public class AtPhonebook {
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, remoteDevice);
            // Leave EXTRA_PACKAGE_NAME and EXTRA_CLASS_NAME field empty.
            // BluetoothHandsfree's broadcast receiver is anonymous, cannot be targeted.
            Utils.sendOrderedBroadcast(mContext, intent, BLUETOOTH_CONNECT,
                    Utils.getTempAllowlistBroadcastOptions(), null, null,
                    Activity.RESULT_OK, null, null);
            mContext.sendOrderedBroadcast(
                    intent,
                    BLUETOOTH_CONNECT,
                    Utils.getTempAllowlistBroadcastOptions(),
                    null,
                    null,
                    Activity.RESULT_OK,
                    null,
                    null);
        }

        return permission;
+9 −3
Original line number Diff line number Diff line
@@ -970,9 +970,15 @@ public class BluetoothMapService extends ProfileService {
            intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                    BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, sRemoteDevice);
            Utils.sendOrderedBroadcast(this, intent, BLUETOOTH_CONNECT,
                    Utils.getTempAllowlistBroadcastOptions(), null, null,
                    Activity.RESULT_OK, null, null);
            sendOrderedBroadcast(
                    intent,
                    BLUETOOTH_CONNECT,
                    Utils.getTempAllowlistBroadcastOptions(),
                    null,
                    null,
                    Activity.RESULT_OK,
                    null,
                    null);

            Log.v(TAG, "waiting for authorization for connection from: " + sRemoteDeviceName);
            //Queue USER_TIMEOUT to disconnect MAP OBEX session. If user doesn't
+9 −4
Original line number Diff line number Diff line
@@ -951,9 +951,14 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
                    BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS);
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
            intent.putExtra(BluetoothDevice.EXTRA_PACKAGE_NAME, this.getPackageName());
            Utils.sendOrderedBroadcast(this, intent, BLUETOOTH_CONNECT,
                    Utils.getTempAllowlistBroadcastOptions(), null/* resultReceiver */,
                    null/* scheduler */, Activity.RESULT_OK/* initialCode */, null/* initialData */,
            sendOrderedBroadcast(
                    intent,
                    BLUETOOTH_CONNECT,
                    Utils.getTempAllowlistBroadcastOptions(),
                    null /* resultReceiver */,
                    null /* scheduler */,
                    Activity.RESULT_OK /* initialCode */,
                    null /* initialData */,
                    null /* initialExtras */);
            Log.v(TAG, "waiting for authorization for connection from: " + device);
            /* In case car kit time out and try to use HFP for phonebook