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

Commit ded20a06 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Gerrit Code Review
Browse files

Merge changes from topic "csis"

* changes:
  csip: Coordinated Set Identification Profile implementation
  groups: Add module to manage devices groups
  csip: Introduce Coordinated Set Identification Profile
parents c0f5c1f5 06a5be26
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -17,6 +17,9 @@ filegroup {
        "android/bluetooth/IBluetoothAvrcpController.aidl",
        "android/bluetooth/IBluetoothAvrcpTarget.aidl",
        "android/bluetooth/IBluetoothCallback.aidl",
        "android/bluetooth/IBluetoothCsipSetCoordinator.aidl",
        "android/bluetooth/IBluetoothCsipSetCoordinatorCallback.aidl",
        "android/bluetooth/IBluetoothCsipSetCoordinatorLockCallback.aidl",
        "android/bluetooth/IBluetoothProfileServiceConnection.aidl",
        "android/bluetooth/IBluetoothHeadset.aidl",
        "android/bluetooth/IBluetoothHearingAid.aidl",
+73 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 HIMSA II K/S - www.himsa.com.
 * Represented by EHIMA - www.ehima.com
 *
 * 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.os.ParcelUuid;
import android.bluetooth.IBluetoothCsipSetCoordinatorLockCallback;
import java.util.List;
import java.util.Map;

/**
 * APIs for Bluetooth CSIP Set Coordinator
 *
 * @hide
 */
interface IBluetoothCsipSetCoordinator {
  boolean connect(in BluetoothDevice device);
  boolean disconnect(in BluetoothDevice device);
  List<BluetoothDevice> getConnectedDevices();
  List<BluetoothDevice> getDevicesMatchingConnectionStates(in int[] states);
  int getConnectionState(in BluetoothDevice device);
  boolean setConnectionPolicy(in BluetoothDevice device, int connectionPolicy);
  int getConnectionPolicy(in BluetoothDevice device);

  /**
    * Get the list of group identifiers for the given context {@var uuid}.
    * @return group identifiers as <code>List<Integer></code>
    */
  List getAllGroupIds(in ParcelUuid uuid);

  /**
    * Get all groups that {@var device} belongs to.
    * @return group identifiers and their context uuids as <code>Map<Integer, ParcelUuid></code>
    */
  Map getGroupUuidMapByDevice(in BluetoothDevice device);

  /**
   * Get the number of known group members or
   * {@link android.bluetooth.IBluetoothCsipSetCoordinator.CSIS_GROUP_SIZE_UNKNOWN} if unknown.
   * @return group size
   */
  int getDesiredGroupSize(in int groupId);

  /**
   * Lock group identified with {@var groupId}.
   * @return unique lock identifier required for unlocking
   */
  ParcelUuid groupLock(int groupId, in IBluetoothCsipSetCoordinatorLockCallback callback);

  /**
   * Unlock group using {@var lockUuid} acquired through
   * {@link android.bluetooth.IBluetoothCsipSetCoordinator.groupLock}.
   */
  void groupUnlock(in ParcelUuid lockUuid);

  const int CSIS_GROUP_ID_INVALID = -1;
  const int CSIS_GROUP_SIZE_UNKNOWN = 1;
}
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 HIMSA II K/S - www.himsa.com.
 * Represented by EHIMA - www.ehima.com
 *
 * 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;

/**
 * Callback definitions for interacting with CSIP Set Coordinator
 *
 * @hide
 */
oneway interface IBluetoothCsipSetCoordinatorCallback {
    void onCsisSetMemberAvailable(in BluetoothDevice device, in int groupId);
}
+27 −0
Original line number Diff line number Diff line
/*
 * Copyright 2021 HIMSA II K/S - www.himsa.com.
 * Represented by EHIMA - www.ehima.com
 *
 * 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;

/**
 * Callback definitions for interacting with CSIP Set Coordinator group locking method
 *
 * @hide
 */
oneway interface IBluetoothCsipSetCoordinatorLockCallback {
    void onGroupLockSet(in int groupId, in int opStatus, in boolean isLocked);
}
+94 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ cc_library_static {
        "av/bta_av_ci.cc",
        "av/bta_av_main.cc",
        "av/bta_av_ssm.cc",
        "csis/csis_client.cc",
        "gatt/bta_gattc_act.cc",
        "gatt/bta_gattc_api.cc",
        "gatt/bta_gattc_cache.cc",
@@ -87,6 +88,7 @@ cc_library_static {
        "gatt/bta_gatts_utils.cc",
        "gatt/database.cc",
        "gatt/database_builder.cc",
        "groups/groups.cc",
        "vc/device.cc",
        "vc/vc.cc",
        "hearing_aid/hearing_aid.cc",
@@ -257,6 +259,98 @@ cc_test {
    cflags: ["-DBUILDCFG"],
}

// csis unit tests for host
cc_test {
    name: "bluetooth_csis_test",
    test_suites: ["device-tests"],
    defaults: [
        "fluoride_bta_defaults",
        "clang_coverage_bin",
    ],
    host_supported: true,
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/groups",
        "packages/modules/Bluetooth/system/bta/include",
        "packages/modules/Bluetooth/system/bta/test/common",
        "packages/modules/Bluetooth/system/btif/include",
        "packages/modules/Bluetooth/system/osi/include",
    ],
    srcs : [
        ":TestMockBtif",
        "csis/csis_client.cc",
        "csis/csis_client_test.cc",
        "groups/groups.cc",
        "gatt/database.cc",
        "gatt/database_builder.cc",
        "test/common/bta_dm_api_mock.cc",
        "test/common/bta_gatt_api_mock.cc",
        "test/common/bta_gatt_queue_mock.cc",
        "test/common/btm_api_mock.cc",
    ],
    shared_libs: [
        "libprotobuf-cpp-lite",
        "libcrypto",
    ],
    static_libs : [
        "crypto_toolbox_for_tests",
        "libgmock",
        "libbt-common",
        "libbt-protos-lite",
        "libosi",
    ],
    sanitize: {
        cfi: true,
        scs: true,
        address: true,
        all_undefined: true,
        integer_overflow: true,
        diag: {
            undefined : true
        },
    },
}

// groups unit tests for host
cc_test {
    name: "bluetooth_groups_test",
    test_suites: ["device-tests"],
    defaults: [
        "fluoride_bta_defaults",
        "clang_coverage_bin",
    ],
    host_supported: true,
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/include",
    ],
    srcs : [
        ":TestMockBtif",
        "groups/groups_test.cc",
        "groups/groups.cc",
    ],
    shared_libs: [
        "libprotobuf-cpp-lite",
        "libcrypto",
    ],
    static_libs : [
        "crypto_toolbox_for_tests",
        "libgmock",
        "libbt-common",
        "libbt-protos-lite",
        "libosi",
    ],
    sanitize: {
        cfi: true,
        scs: true,
        address: true,
        all_undefined: true,
        integer_overflow: true,
        diag: {
            undefined : true
        },
    },
}

// bta unit tests for host
cc_test {
Loading