Loading CPPLINT.cfg +40 −1 Original line number Diff line number Diff line Loading @@ -3,3 +3,42 @@ linelength=100 # Do not check access modifier indentation. # CPPLint enforces +1, but our rule is no indentation. filter=-whitespace/indent # TODO: b/364967694 re-enable the warning filter=-whitespace/newline # TODO: b/364967694 re-enable the warning filter=-whitespace/blank_line # TODO: b/364967694 re-enable the warning filter=-whitespace/ending_newline # TODO: b/364967694 re-enable the warning filter=-readability/check # TODO: b/364967694 re-enable the warning filter=-runtime/int # TODO: b/364967694 re-enable the warning filter=-runtime/string # TODO: b/364967694 re-enable the warning filter=-runtime/explicit # TODO: b/364967694 re-enable the warning filter=-readability/braces # TODO: b/364967694 re-enable the warning filter=-whitespace/braces # TODO: b/364967694 re-enable the warning filter=-build/c++11 # TODO: b/364967694 re-enable the warning filter=-readability/todo # TODO: b/364967694 re-enable the warning filter=-readability/multiline_comment # TODO: b/364967694 re-enable the warning filter=-build/namespaces # TODO: b/364967694 re-enable the warning filter=-readability/inheritance # TODO: b/364967694 re-enable the warning filter=-build/header_guard # TODO: b/364967694 re-enable the warning filter=-runtime/references # TODO: b/364967694 re-enable the warning filter=-build/include_what_you_use # TODO: b/364967694 re-enable the warning filter=-build/include_subdir # TODO: b/364967694 re-enable the warning filter=-readability/casting android/app/jni/com_android_bluetooth_BluetoothQualityReport.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ #include <shared_mutex> #include "com_android_bluetooth.h" #include "common/init_flags.h" #include "hardware/bt_bqr.h" using bluetooth::bqr::BluetoothQualityReportCallbacks; Loading android/app/jni/com_android_bluetooth_gatt.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include "com_android_bluetooth.h" #include "com_android_bluetooth_flags.h" #include "common/init_flags.h" #include "hardware/bt_gatt.h" #include "hardware/bt_gatt_types.h" #include "main/shim/le_scanning_manager.h" Loading android/app/jni/com_android_bluetooth_le_audio.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -721,6 +721,7 @@ static jmethodID method_onBroadcastCreated; static jmethodID method_onBroadcastDestroyed; static jmethodID method_onBroadcastStateChanged; static jmethodID method_onBroadcastMetadataChanged; static jmethodID method_onBroadcastAudioSessionCreated; static LeAudioBroadcasterInterface* sLeAudioBroadcasterInterface = nullptr; static std::shared_timed_mutex sBroadcasterInterfaceMutex; Loading Loading @@ -1132,6 +1133,19 @@ public: sCallbackEnv->CallVoidMethod(sBroadcasterCallbacksObj, method_onBroadcastMetadataChanged, (jint)broadcast_id, metadata_obj.get()); } void OnBroadcastAudioSessionCreated(bool success) override { log::info(""); std::shared_lock<std::shared_timed_mutex> lock(sBroadcasterCallbacksMutex); CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid() || sBroadcasterCallbacksObj == nullptr) { return; } sCallbackEnv->CallVoidMethod(sBroadcasterCallbacksObj, method_onBroadcastAudioSessionCreated, success ? JNI_TRUE : JNI_FALSE); } }; static LeAudioBroadcasterCallbacksImpl sLeAudioBroadcasterCallbacks; Loading Loading @@ -1449,6 +1463,7 @@ static int register_com_android_bluetooth_le_audio_broadcaster(JNIEnv* env) { {"onBroadcastStateChanged", "(II)V", &method_onBroadcastStateChanged}, {"onBroadcastMetadataChanged", "(ILandroid/bluetooth/BluetoothLeBroadcastMetadata;)V", &method_onBroadcastMetadataChanged}, {"onBroadcastAudioSessionCreated", "(Z)V", &method_onBroadcastAudioSessionCreated}, }; GET_JAVA_METHODS(env, "com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface", javaMethods); Loading android/app/jni/com_android_bluetooth_vc.cpp +53 −37 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <shared_mutex> #include "com_android_bluetooth.h" #include "./com_android_bluetooth.h" #include "hardware/bt_vc.h" using bluetooth::vc::ConnectionState; Loading @@ -47,7 +47,7 @@ class VolumeControlCallbacksImpl : public VolumeControlCallbacks { public: ~VolumeControlCallbacksImpl() = default; void OnConnectionState(ConnectionState state, const RawAddress& bd_addr) override { log::info("state:{}, addr: {}", int(state), bd_addr.ToRedactedStringForLogging()); log::info("state:{}, addr: {}", static_cast<int>(state), bd_addr.ToRedactedStringForLogging()); std::shared_lock<std::shared_timed_mutex> lock(callbacks_mutex); CallbackEnv sCallbackEnv(__func__); Loading @@ -62,7 +62,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onConnectionStateChanged, (jint)state, addr.get()); } Loading @@ -84,7 +85,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onVolumeStateChanged, (jint)volume, (jboolean)mute, (jint)flags, addr.get(), (jboolean)isAutonomous); } Loading Loading @@ -115,11 +117,12 @@ public: ScopedLocalRef<jbyteArray> addr(sCallbackEnv.get(), sCallbackEnv->NewByteArray(sizeof(RawAddress))); if (!addr.get()) { log::error("Failed to new jbyteArray bd addr for onDeviceAvailable"); log::error("Failed to get addr for {}", bd_addr); return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onDeviceAvailable, (jint)num_offsets, addr.get()); } Loading @@ -143,7 +146,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onExtAudioOutVolumeOffsetChanged, (jint)ext_output_id, (jint)offset, addr.get()); } Loading @@ -165,7 +169,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onExtAudioOutLocationChanged, (jint)ext_output_id, (jint)location, addr.get()); } Loading @@ -189,7 +194,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); jstring description = sCallbackEnv->NewStringUTF(descr.c_str()); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onExtAudioOutDescriptionChanged, (jint)ext_output_id, description, addr.get()); Loading Loading @@ -225,7 +231,10 @@ static void initNative(JNIEnv* env, jobject object) { return; } sVolumeControlInterface = (VolumeControlInterface*)btInf->get_profile_interface(BT_PROFILE_VC_ID); sVolumeControlInterface = const_cast<VolumeControlInterface*>(reinterpret_cast<const VolumeControlInterface*>( btInf->get_profile_interface(BT_PROFILE_VC_ID))); if (sVolumeControlInterface == nullptr) { log::error("Failed to get Bluetooth Volume Control Interface"); return; Loading Loading @@ -270,7 +279,7 @@ static jboolean connectVolumeControlNative(JNIEnv* env, jobject /* object */, jb return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Connect(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -292,7 +301,7 @@ static jboolean disconnectVolumeControlNative(JNIEnv* env, jobject /* object */, return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Disconnect(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -310,7 +319,7 @@ static void setVolumeNative(JNIEnv* env, jobject /* object */, jbyteArray addres return; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetVolume(*tmpraw, volume); env->ReleaseByteArrayElements(address, addr, 0); } Loading @@ -337,7 +346,7 @@ static void muteNative(JNIEnv* env, jobject /* object */, jbyteArray address) { return; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Mute(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); } Loading @@ -362,7 +371,7 @@ static void unmuteNative(JNIEnv* env, jobject /* object */, jbyteArray address) return; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Unmute(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); } Loading Loading @@ -390,7 +399,7 @@ static jboolean getExtAudioOutVolumeOffsetNative(JNIEnv* env, jobject /* object return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->GetExtAudioOutVolumeOffset(*tmpraw, ext_output_id); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -411,7 +420,7 @@ static jboolean setExtAudioOutVolumeOffsetNative(JNIEnv* env, jobject /* object return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetExtAudioOutVolumeOffset(*tmpraw, ext_output_id, offset); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -431,7 +440,7 @@ static jboolean getExtAudioOutLocationNative(JNIEnv* env, jobject /* object */, return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->GetExtAudioOutLocation(*tmpraw, ext_output_id); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -451,7 +460,7 @@ static jboolean setExtAudioOutLocationNative(JNIEnv* env, jobject /* object */, return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetExtAudioOutLocation(*tmpraw, ext_output_id, location); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -471,7 +480,7 @@ static jboolean getExtAudioOutDescriptionNative(JNIEnv* env, jobject /* object * return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->GetExtAudioOutDescription(*tmpraw, ext_output_id); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading Loading @@ -499,7 +508,7 @@ static jboolean setExtAudioOutDescriptionNative(JNIEnv* env, jobject /* object * env->ReleaseStringUTFChars(descr, value); } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetExtAudioOutDescription(*tmpraw, ext_output_id, description); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -507,23 +516,30 @@ static jboolean setExtAudioOutDescriptionNative(JNIEnv* env, jobject /* object * int register_com_android_bluetooth_vc(JNIEnv* env) { const JNINativeMethod methods[] = { {"initNative", "()V", (void*)initNative}, {"cleanupNative", "()V", (void*)cleanupNative}, {"connectVolumeControlNative", "([B)Z", (void*)connectVolumeControlNative}, {"disconnectVolumeControlNative", "([B)Z", (void*)disconnectVolumeControlNative}, {"setVolumeNative", "([BI)V", (void*)setVolumeNative}, {"setGroupVolumeNative", "(II)V", (void*)setGroupVolumeNative}, {"muteNative", "([B)V", (void*)muteNative}, {"muteGroupNative", "(I)V", (void*)muteGroupNative}, {"unmuteNative", "([B)V", (void*)unmuteNative}, {"unmuteGroupNative", "(I)V", (void*)unmuteGroupNative}, {"getExtAudioOutVolumeOffsetNative", "([BI)Z", (void*)getExtAudioOutVolumeOffsetNative}, {"setExtAudioOutVolumeOffsetNative", "([BII)Z", (void*)setExtAudioOutVolumeOffsetNative}, {"getExtAudioOutLocationNative", "([BI)Z", (void*)getExtAudioOutLocationNative}, {"setExtAudioOutLocationNative", "([BII)Z", (void*)setExtAudioOutLocationNative}, {"getExtAudioOutDescriptionNative", "([BI)Z", (void*)getExtAudioOutDescriptionNative}, {"initNative", "()V", reinterpret_cast<void*>(initNative)}, {"cleanupNative", "()V", reinterpret_cast<void*>(cleanupNative)}, {"connectVolumeControlNative", "([B)Z", reinterpret_cast<void*>(connectVolumeControlNative)}, {"disconnectVolumeControlNative", "([B)Z", reinterpret_cast<void*>(disconnectVolumeControlNative)}, {"setVolumeNative", "([BI)V", reinterpret_cast<void*>(setVolumeNative)}, {"setGroupVolumeNative", "(II)V", reinterpret_cast<void*>(setGroupVolumeNative)}, {"muteNative", "([B)V", reinterpret_cast<void*>(muteNative)}, {"muteGroupNative", "(I)V", reinterpret_cast<void*>(muteGroupNative)}, {"unmuteNative", "([B)V", reinterpret_cast<void*>(unmuteNative)}, {"unmuteGroupNative", "(I)V", reinterpret_cast<void*>(unmuteGroupNative)}, {"getExtAudioOutVolumeOffsetNative", "([BI)Z", reinterpret_cast<void*>(getExtAudioOutVolumeOffsetNative)}, {"setExtAudioOutVolumeOffsetNative", "([BII)Z", reinterpret_cast<void*>(setExtAudioOutVolumeOffsetNative)}, {"getExtAudioOutLocationNative", "([BI)Z", reinterpret_cast<void*>(getExtAudioOutLocationNative)}, {"setExtAudioOutLocationNative", "([BII)Z", reinterpret_cast<void*>(setExtAudioOutLocationNative)}, {"getExtAudioOutDescriptionNative", "([BI)Z", reinterpret_cast<void*>(getExtAudioOutDescriptionNative)}, {"setExtAudioOutDescriptionNative", "([BILjava/lang/String;)Z", (void*)setExtAudioOutDescriptionNative}, reinterpret_cast<void*>(setExtAudioOutDescriptionNative)}, }; const int result = REGISTER_NATIVE_METHODS( env, "com/android/bluetooth/vc/VolumeControlNativeInterface", methods); Loading Loading
CPPLINT.cfg +40 −1 Original line number Diff line number Diff line Loading @@ -3,3 +3,42 @@ linelength=100 # Do not check access modifier indentation. # CPPLint enforces +1, but our rule is no indentation. filter=-whitespace/indent # TODO: b/364967694 re-enable the warning filter=-whitespace/newline # TODO: b/364967694 re-enable the warning filter=-whitespace/blank_line # TODO: b/364967694 re-enable the warning filter=-whitespace/ending_newline # TODO: b/364967694 re-enable the warning filter=-readability/check # TODO: b/364967694 re-enable the warning filter=-runtime/int # TODO: b/364967694 re-enable the warning filter=-runtime/string # TODO: b/364967694 re-enable the warning filter=-runtime/explicit # TODO: b/364967694 re-enable the warning filter=-readability/braces # TODO: b/364967694 re-enable the warning filter=-whitespace/braces # TODO: b/364967694 re-enable the warning filter=-build/c++11 # TODO: b/364967694 re-enable the warning filter=-readability/todo # TODO: b/364967694 re-enable the warning filter=-readability/multiline_comment # TODO: b/364967694 re-enable the warning filter=-build/namespaces # TODO: b/364967694 re-enable the warning filter=-readability/inheritance # TODO: b/364967694 re-enable the warning filter=-build/header_guard # TODO: b/364967694 re-enable the warning filter=-runtime/references # TODO: b/364967694 re-enable the warning filter=-build/include_what_you_use # TODO: b/364967694 re-enable the warning filter=-build/include_subdir # TODO: b/364967694 re-enable the warning filter=-readability/casting
android/app/jni/com_android_bluetooth_BluetoothQualityReport.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ #include <shared_mutex> #include "com_android_bluetooth.h" #include "common/init_flags.h" #include "hardware/bt_bqr.h" using bluetooth::bqr::BluetoothQualityReportCallbacks; Loading
android/app/jni/com_android_bluetooth_gatt.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ #include "com_android_bluetooth.h" #include "com_android_bluetooth_flags.h" #include "common/init_flags.h" #include "hardware/bt_gatt.h" #include "hardware/bt_gatt_types.h" #include "main/shim/le_scanning_manager.h" Loading
android/app/jni/com_android_bluetooth_le_audio.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -721,6 +721,7 @@ static jmethodID method_onBroadcastCreated; static jmethodID method_onBroadcastDestroyed; static jmethodID method_onBroadcastStateChanged; static jmethodID method_onBroadcastMetadataChanged; static jmethodID method_onBroadcastAudioSessionCreated; static LeAudioBroadcasterInterface* sLeAudioBroadcasterInterface = nullptr; static std::shared_timed_mutex sBroadcasterInterfaceMutex; Loading Loading @@ -1132,6 +1133,19 @@ public: sCallbackEnv->CallVoidMethod(sBroadcasterCallbacksObj, method_onBroadcastMetadataChanged, (jint)broadcast_id, metadata_obj.get()); } void OnBroadcastAudioSessionCreated(bool success) override { log::info(""); std::shared_lock<std::shared_timed_mutex> lock(sBroadcasterCallbacksMutex); CallbackEnv sCallbackEnv(__func__); if (!sCallbackEnv.valid() || sBroadcasterCallbacksObj == nullptr) { return; } sCallbackEnv->CallVoidMethod(sBroadcasterCallbacksObj, method_onBroadcastAudioSessionCreated, success ? JNI_TRUE : JNI_FALSE); } }; static LeAudioBroadcasterCallbacksImpl sLeAudioBroadcasterCallbacks; Loading Loading @@ -1449,6 +1463,7 @@ static int register_com_android_bluetooth_le_audio_broadcaster(JNIEnv* env) { {"onBroadcastStateChanged", "(II)V", &method_onBroadcastStateChanged}, {"onBroadcastMetadataChanged", "(ILandroid/bluetooth/BluetoothLeBroadcastMetadata;)V", &method_onBroadcastMetadataChanged}, {"onBroadcastAudioSessionCreated", "(Z)V", &method_onBroadcastAudioSessionCreated}, }; GET_JAVA_METHODS(env, "com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface", javaMethods); Loading
android/app/jni/com_android_bluetooth_vc.cpp +53 −37 Original line number Diff line number Diff line Loading @@ -21,7 +21,7 @@ #include <shared_mutex> #include "com_android_bluetooth.h" #include "./com_android_bluetooth.h" #include "hardware/bt_vc.h" using bluetooth::vc::ConnectionState; Loading @@ -47,7 +47,7 @@ class VolumeControlCallbacksImpl : public VolumeControlCallbacks { public: ~VolumeControlCallbacksImpl() = default; void OnConnectionState(ConnectionState state, const RawAddress& bd_addr) override { log::info("state:{}, addr: {}", int(state), bd_addr.ToRedactedStringForLogging()); log::info("state:{}, addr: {}", static_cast<int>(state), bd_addr.ToRedactedStringForLogging()); std::shared_lock<std::shared_timed_mutex> lock(callbacks_mutex); CallbackEnv sCallbackEnv(__func__); Loading @@ -62,7 +62,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onConnectionStateChanged, (jint)state, addr.get()); } Loading @@ -84,7 +85,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onVolumeStateChanged, (jint)volume, (jboolean)mute, (jint)flags, addr.get(), (jboolean)isAutonomous); } Loading Loading @@ -115,11 +117,12 @@ public: ScopedLocalRef<jbyteArray> addr(sCallbackEnv.get(), sCallbackEnv->NewByteArray(sizeof(RawAddress))); if (!addr.get()) { log::error("Failed to new jbyteArray bd addr for onDeviceAvailable"); log::error("Failed to get addr for {}", bd_addr); return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onDeviceAvailable, (jint)num_offsets, addr.get()); } Loading @@ -143,7 +146,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onExtAudioOutVolumeOffsetChanged, (jint)ext_output_id, (jint)offset, addr.get()); } Loading @@ -165,7 +169,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onExtAudioOutLocationChanged, (jint)ext_output_id, (jint)location, addr.get()); } Loading @@ -189,7 +194,8 @@ public: return; } sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), (jbyte*)&bd_addr); sCallbackEnv->SetByteArrayRegion(addr.get(), 0, sizeof(RawAddress), reinterpret_cast<const jbyte*>(&bd_addr)); jstring description = sCallbackEnv->NewStringUTF(descr.c_str()); sCallbackEnv->CallVoidMethod(mCallbacksObj, method_onExtAudioOutDescriptionChanged, (jint)ext_output_id, description, addr.get()); Loading Loading @@ -225,7 +231,10 @@ static void initNative(JNIEnv* env, jobject object) { return; } sVolumeControlInterface = (VolumeControlInterface*)btInf->get_profile_interface(BT_PROFILE_VC_ID); sVolumeControlInterface = const_cast<VolumeControlInterface*>(reinterpret_cast<const VolumeControlInterface*>( btInf->get_profile_interface(BT_PROFILE_VC_ID))); if (sVolumeControlInterface == nullptr) { log::error("Failed to get Bluetooth Volume Control Interface"); return; Loading Loading @@ -270,7 +279,7 @@ static jboolean connectVolumeControlNative(JNIEnv* env, jobject /* object */, jb return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Connect(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -292,7 +301,7 @@ static jboolean disconnectVolumeControlNative(JNIEnv* env, jobject /* object */, return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Disconnect(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -310,7 +319,7 @@ static void setVolumeNative(JNIEnv* env, jobject /* object */, jbyteArray addres return; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetVolume(*tmpraw, volume); env->ReleaseByteArrayElements(address, addr, 0); } Loading @@ -337,7 +346,7 @@ static void muteNative(JNIEnv* env, jobject /* object */, jbyteArray address) { return; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Mute(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); } Loading @@ -362,7 +371,7 @@ static void unmuteNative(JNIEnv* env, jobject /* object */, jbyteArray address) return; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->Unmute(*tmpraw); env->ReleaseByteArrayElements(address, addr, 0); } Loading Loading @@ -390,7 +399,7 @@ static jboolean getExtAudioOutVolumeOffsetNative(JNIEnv* env, jobject /* object return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->GetExtAudioOutVolumeOffset(*tmpraw, ext_output_id); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -411,7 +420,7 @@ static jboolean setExtAudioOutVolumeOffsetNative(JNIEnv* env, jobject /* object return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetExtAudioOutVolumeOffset(*tmpraw, ext_output_id, offset); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -431,7 +440,7 @@ static jboolean getExtAudioOutLocationNative(JNIEnv* env, jobject /* object */, return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->GetExtAudioOutLocation(*tmpraw, ext_output_id); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -451,7 +460,7 @@ static jboolean setExtAudioOutLocationNative(JNIEnv* env, jobject /* object */, return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetExtAudioOutLocation(*tmpraw, ext_output_id, location); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -471,7 +480,7 @@ static jboolean getExtAudioOutDescriptionNative(JNIEnv* env, jobject /* object * return JNI_FALSE; } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->GetExtAudioOutDescription(*tmpraw, ext_output_id); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading Loading @@ -499,7 +508,7 @@ static jboolean setExtAudioOutDescriptionNative(JNIEnv* env, jobject /* object * env->ReleaseStringUTFChars(descr, value); } RawAddress* tmpraw = (RawAddress*)addr; RawAddress* tmpraw = reinterpret_cast<RawAddress*>(addr); sVolumeControlInterface->SetExtAudioOutDescription(*tmpraw, ext_output_id, description); env->ReleaseByteArrayElements(address, addr, 0); return JNI_TRUE; Loading @@ -507,23 +516,30 @@ static jboolean setExtAudioOutDescriptionNative(JNIEnv* env, jobject /* object * int register_com_android_bluetooth_vc(JNIEnv* env) { const JNINativeMethod methods[] = { {"initNative", "()V", (void*)initNative}, {"cleanupNative", "()V", (void*)cleanupNative}, {"connectVolumeControlNative", "([B)Z", (void*)connectVolumeControlNative}, {"disconnectVolumeControlNative", "([B)Z", (void*)disconnectVolumeControlNative}, {"setVolumeNative", "([BI)V", (void*)setVolumeNative}, {"setGroupVolumeNative", "(II)V", (void*)setGroupVolumeNative}, {"muteNative", "([B)V", (void*)muteNative}, {"muteGroupNative", "(I)V", (void*)muteGroupNative}, {"unmuteNative", "([B)V", (void*)unmuteNative}, {"unmuteGroupNative", "(I)V", (void*)unmuteGroupNative}, {"getExtAudioOutVolumeOffsetNative", "([BI)Z", (void*)getExtAudioOutVolumeOffsetNative}, {"setExtAudioOutVolumeOffsetNative", "([BII)Z", (void*)setExtAudioOutVolumeOffsetNative}, {"getExtAudioOutLocationNative", "([BI)Z", (void*)getExtAudioOutLocationNative}, {"setExtAudioOutLocationNative", "([BII)Z", (void*)setExtAudioOutLocationNative}, {"getExtAudioOutDescriptionNative", "([BI)Z", (void*)getExtAudioOutDescriptionNative}, {"initNative", "()V", reinterpret_cast<void*>(initNative)}, {"cleanupNative", "()V", reinterpret_cast<void*>(cleanupNative)}, {"connectVolumeControlNative", "([B)Z", reinterpret_cast<void*>(connectVolumeControlNative)}, {"disconnectVolumeControlNative", "([B)Z", reinterpret_cast<void*>(disconnectVolumeControlNative)}, {"setVolumeNative", "([BI)V", reinterpret_cast<void*>(setVolumeNative)}, {"setGroupVolumeNative", "(II)V", reinterpret_cast<void*>(setGroupVolumeNative)}, {"muteNative", "([B)V", reinterpret_cast<void*>(muteNative)}, {"muteGroupNative", "(I)V", reinterpret_cast<void*>(muteGroupNative)}, {"unmuteNative", "([B)V", reinterpret_cast<void*>(unmuteNative)}, {"unmuteGroupNative", "(I)V", reinterpret_cast<void*>(unmuteGroupNative)}, {"getExtAudioOutVolumeOffsetNative", "([BI)Z", reinterpret_cast<void*>(getExtAudioOutVolumeOffsetNative)}, {"setExtAudioOutVolumeOffsetNative", "([BII)Z", reinterpret_cast<void*>(setExtAudioOutVolumeOffsetNative)}, {"getExtAudioOutLocationNative", "([BI)Z", reinterpret_cast<void*>(getExtAudioOutLocationNative)}, {"setExtAudioOutLocationNative", "([BII)Z", reinterpret_cast<void*>(setExtAudioOutLocationNative)}, {"getExtAudioOutDescriptionNative", "([BI)Z", reinterpret_cast<void*>(getExtAudioOutDescriptionNative)}, {"setExtAudioOutDescriptionNative", "([BILjava/lang/String;)Z", (void*)setExtAudioOutDescriptionNative}, reinterpret_cast<void*>(setExtAudioOutDescriptionNative)}, }; const int result = REGISTER_NATIVE_METHODS( env, "com/android/bluetooth/vc/VolumeControlNativeInterface", methods); Loading