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

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

Merge "Add system properties to config pairing UI"

parents e92e1147 9687c012
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -110,6 +110,7 @@ public final class Utils {
     */
     */
    public static final char PAUSE = ',';
    public static final char PAUSE = ',';
    public static final char WAIT = ';';
    public static final char WAIT = ';';
    public static final String PAIRING_UI_PROPERTY = "bluetooth.pairing_ui_package.name";


    private static boolean isPause(char c) {
    private static boolean isPause(char c) {
        return c == 'p' || c == 'P';
        return c == 'p' || c == 'P';
+4 −1
Original line number Original line Diff line number Diff line
@@ -1088,7 +1088,10 @@ final class RemoteDevices {
                // Send PAIRING_CANCEL intent to dismiss any dialog requesting bonding.
                // Send PAIRING_CANCEL intent to dismiss any dialog requesting bonding.
                intent = new Intent(BluetoothDevice.ACTION_PAIRING_CANCEL);
                intent = new Intent(BluetoothDevice.ACTION_PAIRING_CANCEL);
                intent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
                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.sendBroadcast(mAdapterService, intent, BLUETOOTH_CONNECT,
                        Utils.getTempAllowlistBroadcastOptions());
                        Utils.getTempAllowlistBroadcastOptions());
            } else if (device.getBondState() == BluetoothDevice.BOND_NONE) {
            } else if (device.getBondState() == BluetoothDevice.BOND_NONE) {
+4 −1
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.Intent;
import android.database.Cursor;
import android.database.Cursor;
import android.net.Uri;
import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
import android.os.SystemProperties;
import android.provider.CallLog.Calls;
import android.provider.CallLog.Calls;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.CommonDataKinds.Phone;
import android.provider.ContactsContract.PhoneLookup;
import android.provider.ContactsContract.PhoneLookup;
@@ -107,7 +108,9 @@ public class AtPhonebook {


    public AtPhonebook(Context context, HeadsetNativeInterface nativeInterface) {
    public AtPhonebook(Context context, HeadsetNativeInterface nativeInterface) {
        mContext = context;
        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();
        mContentResolver = context.getContentResolver();
        mNativeInterface = nativeInterface;
        mNativeInterface = nativeInterface;
        mPhonebooks.put("DC", new PhonebookResult());  // dialled calls
        mPhonebooks.put("DC", new PhonebookResult());  // dialled calls
+7 −2
Original line number Original line Diff line number Diff line
@@ -42,6 +42,7 @@ import android.os.Message;
import android.os.ParcelUuid;
import android.os.ParcelUuid;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.sysprop.BluetoothProperties;
import android.sysprop.BluetoothProperties;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.TextUtils;
@@ -384,7 +385,9 @@ public class BluetoothMapService extends ProfileService {
                case USER_TIMEOUT:
                case USER_TIMEOUT:
                    if (mIsWaitingAuthorization) {
                    if (mIsWaitingAuthorization) {
                        Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL);
                        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_DEVICE, sRemoteDevice);
                        intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                        intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                                BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
                                BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
@@ -951,7 +954,9 @@ public class BluetoothMapService extends ProfileService {
        if (sendIntent) {
        if (sendIntent) {
            // This will trigger Settings app's dialog.
            // This will trigger Settings app's dialog.
            Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST);
            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,
            intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                    BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
                    BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, sRemoteDevice);
            intent.putExtra(BluetoothDevice.EXTRA_DEVICE, sRemoteDevice);
+4 −1
Original line number Original line Diff line number Diff line
@@ -57,6 +57,7 @@ import android.os.HandlerThread;
import android.os.Looper;
import android.os.Looper;
import android.os.Message;
import android.os.Message;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.os.UserManager;
import android.sysprop.BluetoothProperties;
import android.sysprop.BluetoothProperties;
@@ -457,7 +458,9 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
                    break;
                    break;
                case USER_TIMEOUT:
                case USER_TIMEOUT:
                    Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL);
                    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;
                    PbapStateMachine stateMachine = (PbapStateMachine) msg.obj;
                    intent.putExtra(BluetoothDevice.EXTRA_DEVICE, stateMachine.getRemoteDevice());
                    intent.putExtra(BluetoothDevice.EXTRA_DEVICE, stateMachine.getRemoteDevice());
                    intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                    intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
Loading