summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorJack He <siyuanh@google.com>2022-02-23 16:58:03 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-02-23 16:58:03 +0000
commit3a88d77b08c87cb1517fa63cbdf7f99ca10100db (patch)
treec2c8d3e52f453cfd79776457c35d2935a698b93c /system
parent89b965d721c1b41755dc4935e576158d554714e5 (diff)
parent2e6d4b42917664491cd42bc0e13a2961ef058db4 (diff)
Merge changes I343ff48c,I4b1ecf81 am: 2e6d4b4291
Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1985329 Change-Id: Id92c7e06e2d4a4ecbbf63942a922613ce6484020
Diffstat (limited to 'system')
-rw-r--r--system/binder/Android.bp1
-rw-r--r--system/binder/android/bluetooth/IBluetoothHapClient.aidl44
-rw-r--r--system/binder/android/bluetooth/IBluetoothHapClientCallback.aidl39
-rw-r--r--system/bta/has/has_client.cc12
-rw-r--r--system/bta/has/has_types.h2
-rw-r--r--system/btif/src/btif_dm.cc3
-rw-r--r--system/include/hardware/bt_has.h7
7 files changed, 68 insertions, 40 deletions
diff --git a/system/binder/Android.bp b/system/binder/Android.bp
index 54b7f01be7..44cbc36339 100644
--- a/system/binder/Android.bp
+++ b/system/binder/Android.bp
@@ -25,6 +25,7 @@ filegroup {
"android/bluetooth/IBluetoothHeadset.aidl",
"android/bluetooth/IBluetoothHearingAid.aidl",
"android/bluetooth/IBluetoothHapClient.aidl",
+ "android/bluetooth/IBluetoothHapClientCallback.aidl",
"android/bluetooth/IBluetoothVolumeControl.aidl",
"android/bluetooth/IBluetoothHidHost.aidl",
"android/bluetooth/IBluetoothLeAudio.aidl",
diff --git a/system/binder/android/bluetooth/IBluetoothHapClient.aidl b/system/binder/android/bluetooth/IBluetoothHapClient.aidl
index 672ab409c6..ee956c3210 100644
--- a/system/binder/android/bluetooth/IBluetoothHapClient.aidl
+++ b/system/binder/android/bluetooth/IBluetoothHapClient.aidl
@@ -18,6 +18,7 @@
package android.bluetooth;
import android.bluetooth.BluetoothDevice;
+import android.bluetooth.IBluetoothHapClientCallback;
import android.content.AttributionSource;
import com.android.modules.utils.SynchronousResultReceiver;
@@ -30,10 +31,6 @@ import com.android.modules.utils.SynchronousResultReceiver;
oneway interface IBluetoothHapClient {
// Public API
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
- void connect(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
- @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
- void disconnect(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
- @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
void getConnectedDevices(in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
void getDevicesMatchingConnectionStates(in int[] states, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@@ -43,55 +40,46 @@ oneway interface IBluetoothHapClient {
void setConnectionPolicy(in BluetoothDevice device, int connectionPolicy, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
void getConnectionPolicy(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
-
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
void getHapGroup(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
void getActivePresetIndex(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
+ void getActivePresetInfo(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void selectActivePreset(in BluetoothDevice device, int presetIndex, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void selectPreset(in BluetoothDevice device, int presetIndex, in AttributionSource attributionSource);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void groupSelectActivePreset(int groupId, int presetIndex, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void selectPresetForGroup(int groupId, int presetIndex, in AttributionSource attributionSource);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void nextActivePreset(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void switchToNextPreset(in BluetoothDevice device, in AttributionSource attributionSource);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void groupNextActivePreset(int groupId, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void switchToNextPresetForGroup(int groupId, in AttributionSource attributionSource);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void previousActivePreset(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void switchToPreviousPreset(in BluetoothDevice device, in AttributionSource attributionSource);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void groupPreviousActivePreset(int groupId, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void switchToPreviousPresetForGroup(int groupId, in AttributionSource attributionSource);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
void getPresetInfo(in BluetoothDevice device, int presetIndex, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
- void getAllPresetsInfo(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ void getAllPresetInfo(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
void getFeatures(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void setPresetName(in BluetoothDevice device, int presetIndex, in String name, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void setPresetName(in BluetoothDevice device, int presetIndex, in String name, in AttributionSource attributionSource);
@JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
- void groupSetPresetName(int groupId, int presetIndex, in String name, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ oneway void setPresetNameForGroup(int groupId, int presetIndex, in String name, in AttributionSource attributionSource);
+ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
+ void registerCallback(in IBluetoothHapClientCallback callback, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
+ @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
+ void unregisterCallback(in IBluetoothHapClientCallback callback, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
const int PRESET_INDEX_UNAVAILABLE = 0;
const int GROUP_ID_UNAVAILABLE = -1;
- const int STATUS_SET_NAME_NOT_ALLOWED = 1;
- const int STATUS_OPERATION_NOT_SUPPORTED = 2;
- const int STATUS_OPERATION_NOT_POSSIBLE = 3;
- const int STATUS_INVALID_PRESET_NAME_LENGTH = 4;
- const int STATUS_INVALID_PRESET_INDEX = 5;
- const int STATUS_GROUP_OPERATION_NOT_SUPPORTED = 6;
- const int STATUS_PROCEDURE_ALREADY_IN_PROGRESS = 7;
-
const int FEATURE_BIT_NUM_TYPE_MONAURAL = 0;
const int FEATURE_BIT_NUM_TYPE_BANDED = 1;
const int FEATURE_BIT_NUM_SYNCHRONIZATED_PRESETS = 2;
const int FEATURE_BIT_NUM_INDEPENDENT_PRESETS = 3;
const int FEATURE_BIT_NUM_DYNAMIC_PRESETS = 4;
const int FEATURE_BIT_NUM_WRITABLE_PRESETS = 5;
-
- const int PRESET_INFO_REASON_ALL_PRESET_INFO = 0;
- const int PRESET_INFO_REASON_PRESET_INFO_UPDATE = 1;
- const int PRESET_INFO_REASON_PRESET_DELETED = 2;
- const int PRESET_INFO_REASON_PRESET_AVAILABILITY_CHANGED = 3;
- const int PRESET_INFO_REASON_PRESET_INFO_REQUEST_RESPONSE = 4;
}
diff --git a/system/binder/android/bluetooth/IBluetoothHapClientCallback.aidl b/system/binder/android/bluetooth/IBluetoothHapClientCallback.aidl
new file mode 100644
index 0000000000..5e2d8fa30b
--- /dev/null
+++ b/system/binder/android/bluetooth/IBluetoothHapClientCallback.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.bluetooth;
+
+import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothHapPresetInfo;
+
+import java.util.List;
+
+/**
+ * Callback definitions for interacting with HAP Client service
+ *
+ * @hide
+ */
+oneway interface IBluetoothHapClientCallback {
+ void onActivePresetChanged(in BluetoothDevice device, in int presetIndex);
+ void onSelectActivePresetFailed(in BluetoothDevice device, in int statusCode);
+ void onSelectActivePresetForGroupFailed(in int hapGroupId, in int statusCode);
+ void onPresetInfoChanged(in BluetoothDevice device,
+ in List<BluetoothHapPresetInfo> presetInfoList,
+ in int statusCode);
+ void onHapFeaturesAvailable(in BluetoothDevice device, in int hapFeatures);
+ void onSetPresetNameFailed(in BluetoothDevice device, in int status);
+ void onSetPresetNameForGroupFailed(in int hapGroupId, in int status);
+}
diff --git a/system/bta/has/has_client.cc b/system/bta/has/has_client.cc
index 7c6bbdc3c9..044713437f 100644
--- a/system/bta/has/has_client.cc
+++ b/system/bta/has/has_client.cc
@@ -1044,14 +1044,14 @@ class HasClientImpl : public HasClient {
/* Journal update */
device->has_journal_.Append(HasJournalRecord(features, true));
- /* When service is not yet validated, report the available device and
- * notify features otherwise.
+ /* When service is not yet validated, report the available device with
+ * features.
*/
- if (!device->isGattServiceValid()) {
+ if (!device->isGattServiceValid())
callbacks_->OnDeviceAvailable(device->addr, device->GetFeatures());
- } else {
- callbacks_->OnFeaturesUpdate(device->addr, device->GetFeatures());
- }
+
+ /* Notify features */
+ callbacks_->OnFeaturesUpdate(device->addr, device->GetFeatures());
MarkDeviceValidIfInInitialDiscovery(*device);
}
diff --git a/system/bta/has/has_types.h b/system/bta/has/has_types.h
index 89ed82a8ce..d726f07cf7 100644
--- a/system/bta/has/has_types.h
+++ b/system/bta/has/has_types.h
@@ -72,7 +72,7 @@ static_assert(sizeof(HasGattOpContext) <= sizeof(void*));
/* Service UUIDs */
/* FIXME: actually these were not yet assigned - using placeholders for now. */
static const bluetooth::Uuid kUuidHearingAccessService =
- bluetooth::Uuid::From16Bit(0xEEEE);
+ bluetooth::Uuid::From16Bit(0x1854);
static const bluetooth::Uuid kUuidHearingAidFeatures =
bluetooth::Uuid::From16Bit(0xEEED);
static const bluetooth::Uuid kUuidHearingAidPresetControlPoint =
diff --git a/system/btif/src/btif_dm.cc b/system/btif/src/btif_dm.cc
index c427f50e4e..28abdabf5e 100644
--- a/system/btif/src/btif_dm.cc
+++ b/system/btif/src/btif_dm.cc
@@ -95,8 +95,7 @@ const Uuid UUID_VC = Uuid::FromString("1844");
const Uuid UUID_CSIS = Uuid::FromString("1846");
const Uuid UUID_LE_AUDIO = Uuid::FromString("184E");
const Uuid UUID_LE_MIDI = Uuid::FromString("03B80E5A-EDE8-4B33-A751-6CE34EC4C700");
-/* FIXME: Not known yet, using a placeholder instead. */
-const Uuid UUID_HAS = Uuid::FromString("EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE");
+const Uuid UUID_HAS = Uuid::FromString("1854");
const bool enable_address_consolidate = true; // TODO remove
#define COD_MASK 0x07FF
diff --git a/system/include/hardware/bt_has.h b/system/include/hardware/bt_has.h
index 4fdd316852..739edc041f 100644
--- a/system/include/hardware/bt_has.h
+++ b/system/include/hardware/bt_has.h
@@ -36,9 +36,10 @@ enum class ConnectionState : uint8_t {
/** Results codes for the failed preset operations */
enum class ErrorCode : uint8_t {
NO_ERROR = 0,
- SET_NAME_NOT_ALLOWED,
- OPERATION_NOT_SUPPORTED,
- OPERATION_NOT_POSSIBLE,
+ SET_NAME_NOT_ALLOWED, // Preset cannot be written (read only preset)
+ OPERATION_NOT_SUPPORTED, // If theres no optional characteristic,
+ // or request opcode is invalid or not supported
+ OPERATION_NOT_POSSIBLE, // Operation cannot be performed at this time
INVALID_PRESET_NAME_LENGTH,
INVALID_PRESET_INDEX,
GROUP_OPERATION_NOT_SUPPORTED,