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

Commit ce9dd85b authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Łukasz Rymanowski
Browse files

LeAudio: Remove set member available

LeAudio will learn about set members form CsipSetCoordinator

Bug: 150670922
Tag: #feature
Sponsor: jpawlowski@
Test: atest BluetoothInstrumentationTests
Change-Id: Ib1497a85381238917b80d26d2de16b3947f585cd
parent f26c5847
Loading
Loading
Loading
Loading
+0 −24
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ namespace android {
static jmethodID method_onConnectionStateChanged;
static jmethodID method_onGroupStatus;
static jmethodID method_onAudioConf;
static jmethodID method_onSetMemberAvailable;

static LeAudioClientInterface* sLeAudioClientInterface = nullptr;
static std::shared_timed_mutex interface_mutex;
@@ -96,27 +95,6 @@ class LeAudioClientCallbacksImpl : public LeAudioClientCallbacks {
                                 (jint)sink_audio_location,
                                 (jint)source_audio_location, (jint)avail_cont);
  }

  void OnSetMemberAvailable(const RawAddress& bd_addr,
                            uint8_t group_id) override {
    LOG(INFO) << __func__ << ", group id:" << int(group_id);

    std::shared_lock<std::shared_timed_mutex> lock(callbacks_mutex);
    CallbackEnv sCallbackEnv(__func__);
    if (!sCallbackEnv.valid() || mCallbacksObj == nullptr) return;

    ScopedLocalRef<jbyteArray> addr(
        sCallbackEnv.get(), sCallbackEnv->NewByteArray(sizeof(RawAddress)));
    if (!addr.get()) {
      LOG(ERROR) << "Failed to new jbyteArray bd addr for connection state";
      return;
    }

    sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress),
                                     (jbyte*)&bd_addr);
    sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onSetMemberAvailable,
                                 addr.get(), (jint)group_id);
  }
};

static LeAudioClientCallbacksImpl sLeAudioClientCallbacks;
@@ -126,8 +104,6 @@ static void classInitNative(JNIEnv* env, jclass clazz) {
  method_onAudioConf = env->GetMethodID(clazz, "onAudioConf", "(IIIII)V");
  method_onConnectionStateChanged =
      env->GetMethodID(clazz, "onConnectionStateChanged", "(I[B)V");
  method_onSetMemberAvailable =
      env->GetMethodID(clazz, "onSetMemberAvailable", "([BI)V");
}

static void initNative(JNIEnv* env, jobject object) {
+0 −14
Original line number Diff line number Diff line
@@ -99,20 +99,6 @@ public class LeAudioNativeInterface {
        sendMessageToService(event);
    }

    // Callbacks from the native stack back into the Java framework.
    // All callbacks are routed via the Service which will disambiguate which
    // state machine the message should be routed to.
    private void onSetMemberAvailable(byte[] address, int groupId) {
        LeAudioStackEvent event =
                new LeAudioStackEvent(LeAudioStackEvent.EVENT_TYPE_SET_MEMBER_AVAILABLE);
        event.device = getDevice(address);
        event.valueInt1 = groupId;
        if (DBG) {
            Log.d(TAG, "onSetMemberAvailable: " + event);
        }
        sendMessageToService(event);
    }

    private void onGroupStatus(int groupId, int groupStatus, int groupFlags) {
        LeAudioStackEvent event =
                new LeAudioStackEvent(LeAudioStackEvent.EVENT_TYPE_GROUP_STATUS_CHANGED);
+2 −7
Original line number Diff line number Diff line
@@ -30,9 +30,8 @@ public class LeAudioStackEvent {
    public static final int EVENT_TYPE_GROUP_STATUS_CHANGED = 2;
    public static final int EVENT_TYPE_GROUP_NODE_STATUS_CHANGED = 3;
    public static final int EVENT_TYPE_AUDIO_CONF_CHANGED = 4;
    public static final int EVENT_TYPE_SET_MEMBER_AVAILABLE = 5;
        // -------- DO NOT PUT ANY NEW UNICAST EVENTS BELOW THIS LINE-------------
    public static final int EVENT_TYPE_UNICAST_MAX = 7;
    public static final int EVENT_TYPE_UNICAST_MAX = 5;

    // Do not modify without updating the HAL bt_le_audio.h files.
    // Match up with GroupStatus enum of bt_le_audio.h
@@ -91,8 +90,6 @@ public class LeAudioStackEvent {
                return "EVENT_TYPE_GROUP_NODE_STATUS_CHANGED";
            case EVENT_TYPE_AUDIO_CONF_CHANGED:
                return "EVENT_TYPE_AUDIO_CONF_CHANGED";
            case EVENT_TYPE_SET_MEMBER_AVAILABLE:
                return "EVENT_TYPE_SET_MEMBER_AVAILABLE";
            default:
                return "EVENT_TYPE_UNKNOWN:" + type;
        }
@@ -117,8 +114,6 @@ public class LeAudioStackEvent {
                // same as EVENT_TYPE_GROUP_STATUS_CHANGED
            case EVENT_TYPE_GROUP_STATUS_CHANGED:
                // same as EVENT_TYPE_GROUP_STATUS_CHANGED
            case EVENT_TYPE_SET_MEMBER_AVAILABLE:
                // same as EVENT_TYPE_GROUP_STATUS_CHANGED
            case EVENT_TYPE_AUDIO_CONF_CHANGED:
                // FIXME: It should have proper direction names here
                return "{direction:" + value + "}";