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

Commit 03eddc61 authored by Vance Yu's avatar Vance Yu Committed by William Escande
Browse files

Add system properties to config pairing UI

Add and get audio codec priorities from the property below
bluetooth.pairing_ui_package.name

Bug: 270032693
Test: manually test in local build
(cherry picked from https://android-review.googlesource.com/q/commit:9687c012d1f4ddf9d6a008650c01eb249764f9e0)
Merged-In: I359dba7eae531053653caa69eaf0cd6353255833
Change-Id: I359dba7eae531053653caa69eaf0cd6353255833
Bug: 263323082
parent aa546de6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ public final class Utils {
     */
    public static final char PAUSE = ',';
    public static final char WAIT = ';';
    public static final String PAIRING_UI_PROPERTY = "bluetooth.pairing_ui_package.name";

    private static boolean isPause(char c) {
        return c == 'p' || c == 'P';
+3 −1
Original line number Diff line number Diff line
@@ -877,7 +877,9 @@ final class RemoteDevices {
                // Send PAIRING_CANCEL intent to dismiss any dialog requesting bonding.
                intent = new Intent(BluetoothDevice.ACTION_PAIRING_CANCEL);
                intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
                intent.setPackage(sAdapterService.getString(R.string.pairing_ui_package));
                intent.setPackage(SystemProperties.get(
                        Utils.PAIRING_UI_PROPERTY,
                        sAdapterService.getString(R.string.pairing_ui_package)));
                sAdapterService.sendBroadcast(intent, BLUETOOTH_CONNECT,
                        Utils.getTempAllowlistBroadcastOptions());
            }
+4 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemProperties;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.PhoneLookup;
@@ -107,7 +108,9 @@ public class AtPhonebook {

    public AtPhonebook(Context context, HeadsetNativeInterface nativeInterface) {
        mContext = context;
        mPairingPackage = context.getString(R.string.pairing_ui_package);
        mPairingPackage = SystemProperties.get(
            Utils.PAIRING_UI_PROPERTY,
            context.getString(R.string.pairing_ui_package));
        mContentResolver = context.getContentResolver();
        mNativeInterface = nativeInterface;
        mPhonebooks.put("DC", new PhonebookResult());  // dialled calls
+7 −2
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import android.os.Message;
import android.os.ParcelUuid;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.sysprop.BluetoothProperties;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
@@ -384,7 +385,9 @@ public class BluetoothMapService extends ProfileService {
                case USER_TIMEOUT:
                    if (mIsWaitingAuthorization) {
                        Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL);
                        intent.setPackage(getString(R.string.pairing_ui_package));
                        intent.setPackage(SystemProperties.get(
                                Utils.PAIRING_UI_PROPERTY,
                                getString(R.string.pairing_ui_package)));
                        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, sRemoteDevice);
                        intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                                BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
@@ -950,7 +953,9 @@ public class BluetoothMapService extends ProfileService {
        if (sendIntent) {
            // This will trigger Settings app's dialog.
            Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST);
            intent.setPackage(getString(R.string.pairing_ui_package));
            intent.setPackage(SystemProperties.get(
                    Utils.PAIRING_UI_PROPERTY,
                    getString(R.string.pairing_ui_package)));
            intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                    BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, sRemoteDevice);
+4 −1
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.PowerManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.sysprop.BluetoothProperties;
@@ -376,7 +377,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
                    break;
                case USER_TIMEOUT:
                    Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL);
                    intent.setPackage(getString(R.string.pairing_ui_package));
                    intent.setPackage(SystemProperties.get(
                            Utils.PAIRING_UI_PROPERTY,
                            getString(R.string.pairing_ui_package)));
                    PbapStateMachine stateMachine = (PbapStateMachine) msg.obj;
                    intent.putExtra(BluetoothDevice.EXTRA_DEVICE, stateMachine.getRemoteDevice());
                    intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
Loading