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

Commit 297e3c47 authored by Jack He's avatar Jack He Committed by Automerger Merge Worker
Browse files

Merge changes I343ff48c,I4b1ecf81 am: 2e6d4b42 am: 3a88d77b

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1985329

Change-Id: Ief6c039c89a686586c943be57be24861e0694198
parents f1e50d06 3a88d77b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import com.android.bluetooth.Utils;
import com.android.bluetooth.a2dp.A2dpService;
import com.android.bluetooth.btservice.storage.DatabaseManager;
import com.android.bluetooth.csip.CsipSetCoordinatorService;
import com.android.bluetooth.hap.HapClientService;
import com.android.bluetooth.hearingaid.HearingAidService;
import com.android.bluetooth.hfp.HeadsetService;
import com.android.bluetooth.hid.HidHostService;
@@ -296,6 +297,7 @@ class PhonePolicy {
             mFactory.getCsipSetCoordinatorService();
        VolumeControlService volumeControlService =
             mFactory.getVolumeControlService();
        HapClientService hapClientService = mFactory.getHapClientService();

        // Set profile priorities only for the profiles discovered on the remote device.
        // This avoids needless auto-connect attempts to profiles non-existent on the remote device
@@ -364,6 +366,14 @@ class PhonePolicy {
            mAdapterService.getDatabase().setProfileConnectionPolicy(device,
                    BluetoothProfile.VOLUME_CONTROL, BluetoothProfile.CONNECTION_POLICY_ALLOWED);
        }

        if ((hapClientService != null) && Utils.arrayContains(uuids,
                BluetoothUuid.HAS) && (hapClientService.getConnectionPolicy(device)
                == BluetoothProfile.CONNECTION_POLICY_UNKNOWN)) {
            debugLog("setting hearing access profile priority for device " + device);
            mAdapterService.getDatabase().setProfileConnectionPolicy(device,
                    BluetoothProfile.HAP_CLIENT, BluetoothProfile.CONNECTION_POLICY_ALLOWED);
        }
    }

    @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)
+5 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.bluetooth.btservice;
import com.android.bluetooth.a2dp.A2dpService;
import com.android.bluetooth.avrcp.AvrcpTargetService;
import com.android.bluetooth.csip.CsipSetCoordinatorService;
import com.android.bluetooth.hap.HapClientService;
import com.android.bluetooth.hearingaid.HearingAidService;
import com.android.bluetooth.hfp.HeadsetService;
import com.android.bluetooth.hid.HidDeviceService;
@@ -73,4 +74,8 @@ public class ServiceFactory {
    public VolumeControlService getVolumeControlService() {
        return VolumeControlService.getVolumeControlService();
    }

    public HapClientService getHapClientService() {
        return HapClientService.getHapClientService();
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -168,8 +168,7 @@ public class GattService extends ProfileService {
            UUID.fromString("00001850-0000-1000-8000-00805F9B34FB"), // PACS
            UUID.fromString("0000184E-0000-1000-8000-00805F9B34FB"), // ASCS
            UUID.fromString("0000184F-0000-1000-8000-00805F9B34FB"), // BASS
            /* FIXME: Not known yet, using a placeholder instead. */
            UUID.fromString("EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"), // HAP
            UUID.fromString("00001854-0000-1000-8000-00805F9B34FB"), // HAP
    };

    /**
+474 −291

File changed.

Preview size limit exceeded, changes collapsed.

+18 −25
Original line number Diff line number Diff line
@@ -47,20 +47,15 @@ public class HapClientStackEvent {
    static final int CONNECTION_STATE_DISCONNECTING = 3;

    // Possible operation results
    static final int STATUS_SET_NAME_NOT_ALLOWED =
            IBluetoothHapClient.STATUS_SET_NAME_NOT_ALLOWED;
    static final int STATUS_OPERATION_NOT_SUPPORTED =
            IBluetoothHapClient.STATUS_OPERATION_NOT_SUPPORTED;
    static final int STATUS_OPERATION_NOT_POSSIBLE =
            IBluetoothHapClient.STATUS_OPERATION_NOT_POSSIBLE;
    static final int STATUS_INVALID_PRESET_NAME_LENGTH =
            IBluetoothHapClient.STATUS_INVALID_PRESET_NAME_LENGTH;
    static final int STATUS_INVALID_PRESET_INDEX =
            IBluetoothHapClient.STATUS_INVALID_PRESET_INDEX;
    static final int STATUS_GROUP_OPERATION_NOT_SUPPORTED =
            IBluetoothHapClient.STATUS_GROUP_OPERATION_NOT_SUPPORTED;
    static final int STATUS_PROCEDURE_ALREADY_IN_PROGRESS =
            IBluetoothHapClient.STATUS_PROCEDURE_ALREADY_IN_PROGRESS;
    /* WARNING: Matches status codes defined in bta_has.h */
    static final int STATUS_NO_ERROR = 0;
    static final int STATUS_SET_NAME_NOT_ALLOWED = 1;
    static final int STATUS_OPERATION_NOT_SUPPORTED = 2;
    static final int STATUS_OPERATION_NOT_POSSIBLE = 3;
    static final int STATUS_INVALID_PRESET_NAME_LENGTH = 4;
    static final int STATUS_INVALID_PRESET_INDEX = 5;
    static final int STATUS_GROUP_OPERATION_NOT_SUPPORTED = 6;
    static final int STATUS_PROCEDURE_ALREADY_IN_PROGRESS = 7;

    // Supported features
    public static final int FEATURE_BIT_NUM_TYPE_MONAURAL =
@@ -77,16 +72,12 @@ public class HapClientStackEvent {
            IBluetoothHapClient.FEATURE_BIT_NUM_WRITABLE_PRESETS;

    // Preset Info notification reason
    public static final int PRESET_INFO_REASON_ALL_PRESET_INFO =
            IBluetoothHapClient.PRESET_INFO_REASON_ALL_PRESET_INFO;
    public static final int PRESET_INFO_REASON_PRESET_INFO_UPDATE =
            IBluetoothHapClient.PRESET_INFO_REASON_PRESET_INFO_UPDATE;
    public static final int PRESET_INFO_REASON_PRESET_DELETED =
            IBluetoothHapClient.PRESET_INFO_REASON_PRESET_DELETED;
    public static final int PRESET_INFO_REASON_PRESET_AVAILABILITY_CHANGED =
            IBluetoothHapClient.PRESET_INFO_REASON_PRESET_AVAILABILITY_CHANGED;
    public static final int PRESET_INFO_REASON_PRESET_INFO_REQUEST_RESPONSE =
            IBluetoothHapClient.PRESET_INFO_REASON_PRESET_INFO_REQUEST_RESPONSE;
    /* WARNING: Matches status codes defined in bta_has.h */
    public static final int PRESET_INFO_REASON_ALL_PRESET_INFO = 0;
    public static final int PRESET_INFO_REASON_PRESET_INFO_UPDATE = 1;
    public static final int PRESET_INFO_REASON_PRESET_DELETED = 2;
    public static final int PRESET_INFO_REASON_PRESET_AVAILABILITY_CHANGED = 3;
    public static final int PRESET_INFO_REASON_PRESET_INFO_REQUEST_RESPONSE = 4;

    public int type;
    public BluetoothDevice device;
@@ -207,6 +198,8 @@ public class HapClientStackEvent {

    private String statusCodeValueToString(int value) {
        switch (value) {
            case STATUS_NO_ERROR:
                return "STATUS_NO_ERROR";
            case STATUS_SET_NAME_NOT_ALLOWED:
                return "STATUS_SET_NAME_NOT_ALLOWED";
            case STATUS_OPERATION_NOT_SUPPORTED:
@@ -222,7 +215,7 @@ public class HapClientStackEvent {
            case STATUS_PROCEDURE_ALREADY_IN_PROGRESS:
                return "STATUS_PROCEDURE_ALREADY_IN_PROGRESS";
            default:
                return "UNKNOWN_STATUS_CODE";
                return "ERROR_UNKNOWN";
        }
    }

Loading