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

Commit 9687c012 authored by Vance Yu's avatar Vance Yu
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
Change-Id: I359dba7eae531053653caa69eaf0cd6353255833
parent 9712e53b
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,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';
+4 −1
Original line number Diff line number Diff line
@@ -1088,7 +1088,10 @@ 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(mAdapterService.getString(R.string.pairing_ui_package));
                intent.setPackage(SystemProperties.get(
                        Utils.PAIRING_UI_PROPERTY,
                        mAdapterService.getString(R.string.pairing_ui_package)));

                Utils.sendBroadcast(mAdapterService, intent, BLUETOOTH_CONNECT,
                        Utils.getTempAllowlistBroadcastOptions());
            } else if (device.getBondState() == BluetoothDevice.BOND_NONE) {
+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);
@@ -951,7 +954,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
@@ -57,6 +57,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;
@@ -457,7 +458,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