Loading android/app/jni/bluetooth_socket_manager.cc +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ Status BluetoothSocketManagerBinderServer::connectSocket( } _aidl_return->reset(new ParcelFileDescriptor()); (*_aidl_return)->fd = socket_fd; (*_aidl_return)->setFileDescriptor(socket_fd, true); return Status::ok(); } Loading Loading @@ -96,7 +96,7 @@ Status BluetoothSocketManagerBinderServer::createSocketChannel( } _aidl_return->reset(new ParcelFileDescriptor()); (*_aidl_return)->fd = socket_fd; (*_aidl_return)->setFileDescriptor(socket_fd, true); return Status::ok(); } Loading android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ #include <sys/prctl.h> #include <sys/stat.h> #include <mutex> using base::StringPrintf; using bluetooth::Uuid; using android::bluetooth::BluetoothSocketManagerBinderServer; Loading Loading @@ -75,7 +77,8 @@ static jobject sJniCallbacksObj; static jfieldID sJniCallbacksField; namespace { android::sp<BluetoothSocketManagerBinderServer> socketManager = NULL; android::sp<BluetoothSocketManagerBinderServer> sSocketManager = NULL; std::mutex sSocketManagerMutex; } const bt_interface_t* getBluetoothInterface() { return sBluetoothInterface; } Loading Loading @@ -738,8 +741,10 @@ static bool cleanupNative(JNIEnv* env, jobject obj) { env->DeleteGlobalRef(android_bluetooth_UidTraffic.clazz); android_bluetooth_UidTraffic.clazz = NULL; } socketManager = nullptr; { std::lock_guard<std::mutex> lock(sSocketManagerMutex); sSocketManager = nullptr; } return JNI_TRUE; } Loading Loading @@ -1114,11 +1119,12 @@ static jboolean getRemoteServicesNative(JNIEnv* env, jobject obj, } static jobject getSocketManagerNative(JNIEnv* env) { if (!socketManager.get()) socketManager = std::lock_guard<std::mutex> lock(sSocketManagerMutex); if (!sSocketManager.get()) { sSocketManager = new BluetoothSocketManagerBinderServer(sBluetoothSocketInterface); return javaObjectForIBinder(env, IInterface::asBinder(socketManager)); } return javaObjectForIBinder(env, IInterface::asBinder(sSocketManager)); } static void setSystemUiUidNative(JNIEnv* env, jobject obj, jint uid) { Loading android/app/jni/com_android_bluetooth_hfp.cpp +0 −47 Original line number Diff line number Diff line Loading @@ -668,31 +668,6 @@ static jboolean cindResponseNative(JNIEnv* env, jobject object, jint service, return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static jboolean bindResponseNative(JNIEnv* env, jobject object, jint ind_id, jboolean ind_status, jbyteArray address) { ALOGI("%s: sBluetoothHfpInterface: %p", __func__, sBluetoothHfpInterface); std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sBluetoothHfpInterface) return JNI_FALSE; jbyte* addr = env->GetByteArrayElements(address, NULL); if (!addr) { jniThrowIOException(env, EINVAL); return JNI_FALSE; } bt_status_t status = sBluetoothHfpInterface->bind_response( (bthf_hf_ind_type_t)ind_id, ind_status ? BTHF_HF_IND_ENABLED : BTHF_HF_IND_DISABLED, (RawAddress*)addr); if (status != BT_STATUS_SUCCESS) ALOGE("%s: Failed bind_response, status: %d", __func__, status); env->ReleaseByteArrayElements(address, addr, 0); return (status == BT_STATUS_SUCCESS ? JNI_TRUE : JNI_FALSE); } static jboolean atResponseStringNative(JNIEnv* env, jobject object, jstring response_str, jbyteArray address) { Loading Loading @@ -786,26 +761,6 @@ static jboolean phoneStateChangeNative(JNIEnv* env, jobject object, return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static jboolean configureWBSNative(JNIEnv* env, jobject object, jbyteArray address, jint codec_config) { std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sBluetoothHfpInterface) return JNI_FALSE; jbyte* addr = env->GetByteArrayElements(address, NULL); if (!addr) { jniThrowIOException(env, EINVAL); return JNI_FALSE; } bt_status_t status = sBluetoothHfpInterface->configure_wbs( (RawAddress*)addr, (bthf_wbs_config_t)codec_config); if (status != BT_STATUS_SUCCESS) { ALOGE("Failed HF WBS codec config, status: %d", status); } env->ReleaseByteArrayElements(address, addr, 0); return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static jboolean setScoAllowedNative(JNIEnv* env, jobject object, jboolean value) { if (!sBluetoothHfpInterface) return JNI_FALSE; Loading Loading @@ -834,7 +789,6 @@ static JNINativeMethod sMethods[] = { {"copsResponseNative", "(Ljava/lang/String;[B)Z", (void*)copsResponseNative}, {"cindResponseNative", "(IIIIIII[B)Z", (void*)cindResponseNative}, {"bindResponseNative", "(IZ[B)Z", (void*)bindResponseNative}, {"atResponseStringNative", "(Ljava/lang/String;[B)Z", (void*)atResponseStringNative}, {"atResponseCodeNative", "(II[B)Z", (void*)atResponseCodeNative}, Loading @@ -842,7 +796,6 @@ static JNINativeMethod sMethods[] = { (void*)clccResponseNative}, {"phoneStateChangeNative", "(IIILjava/lang/String;I)Z", (void*)phoneStateChangeNative}, {"configureWBSNative", "([BI)Z", (void*)configureWBSNative}, {"setScoAllowedNative", "(Z)Z", (void*)setScoAllowedNative}, }; Loading android/app/res/values-pt-rPT/strings.xml +4 −2 Original line number Diff line number Diff line Loading @@ -111,12 +111,12 @@ <string name="outbound_noti_title" msgid="8051906709452260849">"Partilha por Bluetooth: ficheiros enviados"</string> <string name="inbound_noti_title" msgid="4143352641953027595">"Partilha por Bluetooth: ficheiros recebidos"</string> <plurals name="noti_caption_unsuccessful" formatted="false" msgid="2020750076679526122"> <item quantity="one"><xliff:g id="UNSUCCESSFUL_NUMBER_0">%1$d</xliff:g> sem êxito.</item> <item quantity="other"><xliff:g id="UNSUCCESSFUL_NUMBER_1">%1$d</xliff:g> sem êxito.</item> <item quantity="one"><xliff:g id="UNSUCCESSFUL_NUMBER_0">%1$d</xliff:g> sem êxito.</item> </plurals> <plurals name="noti_caption_success" formatted="false" msgid="1572472450257645181"> <item quantity="one"><xliff:g id="SUCCESSFUL_NUMBER_0">%1$d</xliff:g> com êxito, %2$s</item> <item quantity="other"><xliff:g id="SUCCESSFUL_NUMBER_1">%1$d</xliff:g> com êxito, %2$s</item> <item quantity="one"><xliff:g id="SUCCESSFUL_NUMBER_0">%1$d</xliff:g> com êxito, %2$s</item> </plurals> <string name="transfer_menu_clear_all" msgid="790017462957873132">"Limpar lista"</string> <string name="transfer_menu_open" msgid="3368984869083107200">"Abrir"</string> Loading @@ -132,4 +132,6 @@ <string name="bluetooth_connected" msgid="6718623220072656906">"Áudio Bluetooth ligado"</string> <string name="bluetooth_disconnected" msgid="3318303728981478873">"Áudio Bluetooth desligado"</string> <string name="a2dp_sink_mbs_label" msgid="7566075853395412558">"Áudio Bluetooth"</string> <!-- no translation found for bluetooth_opp_file_limit_exceeded (8894450394309084519) --> <skip /> </resources> android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java +0 −29 Original line number Diff line number Diff line Loading @@ -343,19 +343,6 @@ public class HeadsetNativeInterface { batteryCharge, Utils.getByteAddress(device)); } /** * Response for BIND command * * @param device target device * @param indId indicator id * @param indStatus indicator value * @return True on success, False on failure */ @VisibleForTesting public boolean bindResponse(BluetoothDevice device, int indId, boolean indStatus) { return bindResponseNative(indId, indStatus, Utils.getByteAddress(device)); } /** * Combined device status change notification * Loading Loading @@ -423,18 +410,6 @@ public class HeadsetNativeInterface { callState.mCallState, callState.mNumber, callState.mType); } /** * Configure Wid-Band-Speech codec for HFP audio (SCO) * * @param device target device * @param codecConfig codec configuration * @return True on success, False on failure */ @VisibleForTesting public boolean configureWBS(BluetoothDevice device, int codecConfig) { return configureWBSNative(Utils.getByteAddress(device), codecConfig); } /** * Set whether we will initiate SCO or not * Loading Loading @@ -474,8 +449,6 @@ public class HeadsetNativeInterface { private native boolean cindResponseNative(int service, int numActive, int numHeld, int callState, int signal, int roam, int batteryCharge, byte[] address); private native boolean bindResponseNative(int indId, boolean indStatus, byte[] address); private native boolean notifyDeviceStatusNative(int networkState, int serviceType, int signal, int batteryCharge); Loading @@ -487,7 +460,5 @@ public class HeadsetNativeInterface { private native boolean phoneStateChangeNative(int numActive, int numHeld, int callState, String number, int type); private native boolean configureWBSNative(byte[] address, int codecConfig); private native boolean setScoAllowedNative(boolean value); } Loading
android/app/jni/bluetooth_socket_manager.cc +2 −2 Original line number Diff line number Diff line Loading @@ -57,7 +57,7 @@ Status BluetoothSocketManagerBinderServer::connectSocket( } _aidl_return->reset(new ParcelFileDescriptor()); (*_aidl_return)->fd = socket_fd; (*_aidl_return)->setFileDescriptor(socket_fd, true); return Status::ok(); } Loading Loading @@ -96,7 +96,7 @@ Status BluetoothSocketManagerBinderServer::createSocketChannel( } _aidl_return->reset(new ParcelFileDescriptor()); (*_aidl_return)->fd = socket_fd; (*_aidl_return)->setFileDescriptor(socket_fd, true); return Status::ok(); } Loading
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +13 −7 Original line number Diff line number Diff line Loading @@ -36,6 +36,8 @@ #include <sys/prctl.h> #include <sys/stat.h> #include <mutex> using base::StringPrintf; using bluetooth::Uuid; using android::bluetooth::BluetoothSocketManagerBinderServer; Loading Loading @@ -75,7 +77,8 @@ static jobject sJniCallbacksObj; static jfieldID sJniCallbacksField; namespace { android::sp<BluetoothSocketManagerBinderServer> socketManager = NULL; android::sp<BluetoothSocketManagerBinderServer> sSocketManager = NULL; std::mutex sSocketManagerMutex; } const bt_interface_t* getBluetoothInterface() { return sBluetoothInterface; } Loading Loading @@ -738,8 +741,10 @@ static bool cleanupNative(JNIEnv* env, jobject obj) { env->DeleteGlobalRef(android_bluetooth_UidTraffic.clazz); android_bluetooth_UidTraffic.clazz = NULL; } socketManager = nullptr; { std::lock_guard<std::mutex> lock(sSocketManagerMutex); sSocketManager = nullptr; } return JNI_TRUE; } Loading Loading @@ -1114,11 +1119,12 @@ static jboolean getRemoteServicesNative(JNIEnv* env, jobject obj, } static jobject getSocketManagerNative(JNIEnv* env) { if (!socketManager.get()) socketManager = std::lock_guard<std::mutex> lock(sSocketManagerMutex); if (!sSocketManager.get()) { sSocketManager = new BluetoothSocketManagerBinderServer(sBluetoothSocketInterface); return javaObjectForIBinder(env, IInterface::asBinder(socketManager)); } return javaObjectForIBinder(env, IInterface::asBinder(sSocketManager)); } static void setSystemUiUidNative(JNIEnv* env, jobject obj, jint uid) { Loading
android/app/jni/com_android_bluetooth_hfp.cpp +0 −47 Original line number Diff line number Diff line Loading @@ -668,31 +668,6 @@ static jboolean cindResponseNative(JNIEnv* env, jobject object, jint service, return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static jboolean bindResponseNative(JNIEnv* env, jobject object, jint ind_id, jboolean ind_status, jbyteArray address) { ALOGI("%s: sBluetoothHfpInterface: %p", __func__, sBluetoothHfpInterface); std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sBluetoothHfpInterface) return JNI_FALSE; jbyte* addr = env->GetByteArrayElements(address, NULL); if (!addr) { jniThrowIOException(env, EINVAL); return JNI_FALSE; } bt_status_t status = sBluetoothHfpInterface->bind_response( (bthf_hf_ind_type_t)ind_id, ind_status ? BTHF_HF_IND_ENABLED : BTHF_HF_IND_DISABLED, (RawAddress*)addr); if (status != BT_STATUS_SUCCESS) ALOGE("%s: Failed bind_response, status: %d", __func__, status); env->ReleaseByteArrayElements(address, addr, 0); return (status == BT_STATUS_SUCCESS ? JNI_TRUE : JNI_FALSE); } static jboolean atResponseStringNative(JNIEnv* env, jobject object, jstring response_str, jbyteArray address) { Loading Loading @@ -786,26 +761,6 @@ static jboolean phoneStateChangeNative(JNIEnv* env, jobject object, return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static jboolean configureWBSNative(JNIEnv* env, jobject object, jbyteArray address, jint codec_config) { std::shared_lock<std::shared_timed_mutex> lock(interface_mutex); if (!sBluetoothHfpInterface) return JNI_FALSE; jbyte* addr = env->GetByteArrayElements(address, NULL); if (!addr) { jniThrowIOException(env, EINVAL); return JNI_FALSE; } bt_status_t status = sBluetoothHfpInterface->configure_wbs( (RawAddress*)addr, (bthf_wbs_config_t)codec_config); if (status != BT_STATUS_SUCCESS) { ALOGE("Failed HF WBS codec config, status: %d", status); } env->ReleaseByteArrayElements(address, addr, 0); return (status == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; } static jboolean setScoAllowedNative(JNIEnv* env, jobject object, jboolean value) { if (!sBluetoothHfpInterface) return JNI_FALSE; Loading Loading @@ -834,7 +789,6 @@ static JNINativeMethod sMethods[] = { {"copsResponseNative", "(Ljava/lang/String;[B)Z", (void*)copsResponseNative}, {"cindResponseNative", "(IIIIIII[B)Z", (void*)cindResponseNative}, {"bindResponseNative", "(IZ[B)Z", (void*)bindResponseNative}, {"atResponseStringNative", "(Ljava/lang/String;[B)Z", (void*)atResponseStringNative}, {"atResponseCodeNative", "(II[B)Z", (void*)atResponseCodeNative}, Loading @@ -842,7 +796,6 @@ static JNINativeMethod sMethods[] = { (void*)clccResponseNative}, {"phoneStateChangeNative", "(IIILjava/lang/String;I)Z", (void*)phoneStateChangeNative}, {"configureWBSNative", "([BI)Z", (void*)configureWBSNative}, {"setScoAllowedNative", "(Z)Z", (void*)setScoAllowedNative}, }; Loading
android/app/res/values-pt-rPT/strings.xml +4 −2 Original line number Diff line number Diff line Loading @@ -111,12 +111,12 @@ <string name="outbound_noti_title" msgid="8051906709452260849">"Partilha por Bluetooth: ficheiros enviados"</string> <string name="inbound_noti_title" msgid="4143352641953027595">"Partilha por Bluetooth: ficheiros recebidos"</string> <plurals name="noti_caption_unsuccessful" formatted="false" msgid="2020750076679526122"> <item quantity="one"><xliff:g id="UNSUCCESSFUL_NUMBER_0">%1$d</xliff:g> sem êxito.</item> <item quantity="other"><xliff:g id="UNSUCCESSFUL_NUMBER_1">%1$d</xliff:g> sem êxito.</item> <item quantity="one"><xliff:g id="UNSUCCESSFUL_NUMBER_0">%1$d</xliff:g> sem êxito.</item> </plurals> <plurals name="noti_caption_success" formatted="false" msgid="1572472450257645181"> <item quantity="one"><xliff:g id="SUCCESSFUL_NUMBER_0">%1$d</xliff:g> com êxito, %2$s</item> <item quantity="other"><xliff:g id="SUCCESSFUL_NUMBER_1">%1$d</xliff:g> com êxito, %2$s</item> <item quantity="one"><xliff:g id="SUCCESSFUL_NUMBER_0">%1$d</xliff:g> com êxito, %2$s</item> </plurals> <string name="transfer_menu_clear_all" msgid="790017462957873132">"Limpar lista"</string> <string name="transfer_menu_open" msgid="3368984869083107200">"Abrir"</string> Loading @@ -132,4 +132,6 @@ <string name="bluetooth_connected" msgid="6718623220072656906">"Áudio Bluetooth ligado"</string> <string name="bluetooth_disconnected" msgid="3318303728981478873">"Áudio Bluetooth desligado"</string> <string name="a2dp_sink_mbs_label" msgid="7566075853395412558">"Áudio Bluetooth"</string> <!-- no translation found for bluetooth_opp_file_limit_exceeded (8894450394309084519) --> <skip /> </resources>
android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java +0 −29 Original line number Diff line number Diff line Loading @@ -343,19 +343,6 @@ public class HeadsetNativeInterface { batteryCharge, Utils.getByteAddress(device)); } /** * Response for BIND command * * @param device target device * @param indId indicator id * @param indStatus indicator value * @return True on success, False on failure */ @VisibleForTesting public boolean bindResponse(BluetoothDevice device, int indId, boolean indStatus) { return bindResponseNative(indId, indStatus, Utils.getByteAddress(device)); } /** * Combined device status change notification * Loading Loading @@ -423,18 +410,6 @@ public class HeadsetNativeInterface { callState.mCallState, callState.mNumber, callState.mType); } /** * Configure Wid-Band-Speech codec for HFP audio (SCO) * * @param device target device * @param codecConfig codec configuration * @return True on success, False on failure */ @VisibleForTesting public boolean configureWBS(BluetoothDevice device, int codecConfig) { return configureWBSNative(Utils.getByteAddress(device), codecConfig); } /** * Set whether we will initiate SCO or not * Loading Loading @@ -474,8 +449,6 @@ public class HeadsetNativeInterface { private native boolean cindResponseNative(int service, int numActive, int numHeld, int callState, int signal, int roam, int batteryCharge, byte[] address); private native boolean bindResponseNative(int indId, boolean indStatus, byte[] address); private native boolean notifyDeviceStatusNative(int networkState, int serviceType, int signal, int batteryCharge); Loading @@ -487,7 +460,5 @@ public class HeadsetNativeInterface { private native boolean phoneStateChangeNative(int numActive, int numHeld, int callState, String number, int type); private native boolean configureWBSNative(byte[] address, int codecConfig); private native boolean setScoAllowedNative(boolean value); }