Loading android/app/jni/com_android_bluetooth.h +0 −2 Original line number Diff line number Diff line Loading @@ -158,8 +158,6 @@ int register_com_android_bluetooth_hap_client(JNIEnv* env); int register_com_android_bluetooth_btservice_BluetoothKeystore(JNIEnv* env); int register_com_android_bluetooth_btservice_activity_attribution(JNIEnv* env); int register_com_android_bluetooth_le_audio(JNIEnv* env); int register_com_android_bluetooth_vc(JNIEnv* env); Loading android/app/jni/com_android_bluetooth_btservice_ActivityAttribution.cppdeleted 100644 → 0 +0 −73 Original line number Diff line number Diff line /* * Copyright 2020 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. */ #define LOG_TAG "BluetoothActivityAttributionJni" #include <string.h> #include <shared_mutex> #include "base/logging.h" #include "com_android_bluetooth.h" #include "hardware/bt_activity_attribution.h" using bluetooth::activity_attribution::ActivityAttributionInterface; namespace android { static ActivityAttributionInterface* sActivityAttributionInterface = nullptr; static void notifyActivityAttributionInfoNative(JNIEnv* env, jobject object, jint uid, jstring packageName, jstring deviceAddress) { const bt_interface_t* btInf = getBluetoothInterface(); if (btInf == nullptr) { LOG(ERROR) << "Bluetooth module is not loaded"; return; } sActivityAttributionInterface = (ActivityAttributionInterface*)btInf->get_profile_interface( BT_ACTIVITY_ATTRIBUTION_ID); if (sActivityAttributionInterface == nullptr) { LOG(ERROR) << "Failed to get ActivityAttribution Interface"; return; } if (packageName == nullptr || deviceAddress == nullptr) { LOG(ERROR) << "Failed to get package name or device address"; return; } const char* nativeName = env->GetStringUTFChars(packageName, nullptr); const char* nativeAddress = env->GetStringUTFChars(deviceAddress, nullptr); sActivityAttributionInterface->NotifyActivityAttributionInfo(uid, nativeName, nativeAddress); env->ReleaseStringUTFChars(packageName, nativeName); env->ReleaseStringUTFChars(deviceAddress, nativeAddress); } int register_com_android_bluetooth_btservice_activity_attribution(JNIEnv* env) { const JNINativeMethod methods[] = { {"notifyActivityAttributionInfoNative", "(ILjava/lang/String;Ljava/lang/String;)V", (void*)notifyActivityAttributionInfoNative}, }; return REGISTER_NATIVE_METHODS( env, "com/android/bluetooth/btservice/activityattribution/" "ActivityAttributionNativeInterface", methods); } } // namespace android android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -2243,13 +2243,6 @@ jint JNI_OnLoad(JavaVM* jvm, void* reserved) { return JNI_ERR; } status = android::register_com_android_bluetooth_btservice_activity_attribution(e); if (status < 0) { ALOGE("jni activity attribution registration failure: %d", status); return JNI_ERR; } status = android::register_com_android_bluetooth_btservice_BluetoothKeystore(e); if (status < 0) { Loading android/app/src/com/android/bluetooth/a2dp/A2dpService.java +0 −10 Original line number Diff line number Diff line Loading @@ -200,11 +200,6 @@ public class A2dpService extends ProfileService { // Step 8: Mark service as started setA2dpService(this); BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); // Step 9: Clear active device removeActiveDevice(false); Loading @@ -224,11 +219,6 @@ public class A2dpService extends ProfileService { removeActiveDevice(true); // Step 8: Mark service as stopped BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); setA2dpService(null); // Step 7: Unregister broadcast receivers Loading android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkService.java +0 −10 Original line number Diff line number Diff line Loading @@ -106,21 +106,11 @@ public class A2dpSinkService extends ProfileService { } setA2dpSinkService(this); BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); return true; } @Override protected boolean stop() { BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); setA2dpSinkService(null); mNativeInterface.cleanup(); for (A2dpSinkStateMachine stateMachine : mDeviceStateMap.values()) { Loading Loading
android/app/jni/com_android_bluetooth.h +0 −2 Original line number Diff line number Diff line Loading @@ -158,8 +158,6 @@ int register_com_android_bluetooth_hap_client(JNIEnv* env); int register_com_android_bluetooth_btservice_BluetoothKeystore(JNIEnv* env); int register_com_android_bluetooth_btservice_activity_attribution(JNIEnv* env); int register_com_android_bluetooth_le_audio(JNIEnv* env); int register_com_android_bluetooth_vc(JNIEnv* env); Loading
android/app/jni/com_android_bluetooth_btservice_ActivityAttribution.cppdeleted 100644 → 0 +0 −73 Original line number Diff line number Diff line /* * Copyright 2020 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. */ #define LOG_TAG "BluetoothActivityAttributionJni" #include <string.h> #include <shared_mutex> #include "base/logging.h" #include "com_android_bluetooth.h" #include "hardware/bt_activity_attribution.h" using bluetooth::activity_attribution::ActivityAttributionInterface; namespace android { static ActivityAttributionInterface* sActivityAttributionInterface = nullptr; static void notifyActivityAttributionInfoNative(JNIEnv* env, jobject object, jint uid, jstring packageName, jstring deviceAddress) { const bt_interface_t* btInf = getBluetoothInterface(); if (btInf == nullptr) { LOG(ERROR) << "Bluetooth module is not loaded"; return; } sActivityAttributionInterface = (ActivityAttributionInterface*)btInf->get_profile_interface( BT_ACTIVITY_ATTRIBUTION_ID); if (sActivityAttributionInterface == nullptr) { LOG(ERROR) << "Failed to get ActivityAttribution Interface"; return; } if (packageName == nullptr || deviceAddress == nullptr) { LOG(ERROR) << "Failed to get package name or device address"; return; } const char* nativeName = env->GetStringUTFChars(packageName, nullptr); const char* nativeAddress = env->GetStringUTFChars(deviceAddress, nullptr); sActivityAttributionInterface->NotifyActivityAttributionInfo(uid, nativeName, nativeAddress); env->ReleaseStringUTFChars(packageName, nativeName); env->ReleaseStringUTFChars(deviceAddress, nativeAddress); } int register_com_android_bluetooth_btservice_activity_attribution(JNIEnv* env) { const JNINativeMethod methods[] = { {"notifyActivityAttributionInfoNative", "(ILjava/lang/String;Ljava/lang/String;)V", (void*)notifyActivityAttributionInfoNative}, }; return REGISTER_NATIVE_METHODS( env, "com/android/bluetooth/btservice/activityattribution/" "ActivityAttributionNativeInterface", methods); } } // namespace android
android/app/jni/com_android_bluetooth_btservice_AdapterService.cpp +0 −7 Original line number Diff line number Diff line Loading @@ -2243,13 +2243,6 @@ jint JNI_OnLoad(JavaVM* jvm, void* reserved) { return JNI_ERR; } status = android::register_com_android_bluetooth_btservice_activity_attribution(e); if (status < 0) { ALOGE("jni activity attribution registration failure: %d", status); return JNI_ERR; } status = android::register_com_android_bluetooth_btservice_BluetoothKeystore(e); if (status < 0) { Loading
android/app/src/com/android/bluetooth/a2dp/A2dpService.java +0 −10 Original line number Diff line number Diff line Loading @@ -200,11 +200,6 @@ public class A2dpService extends ProfileService { // Step 8: Mark service as started setA2dpService(this); BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); // Step 9: Clear active device removeActiveDevice(false); Loading @@ -224,11 +219,6 @@ public class A2dpService extends ProfileService { removeActiveDevice(true); // Step 8: Mark service as stopped BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); setA2dpService(null); // Step 7: Unregister broadcast receivers Loading
android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkService.java +0 −10 Original line number Diff line number Diff line Loading @@ -106,21 +106,11 @@ public class A2dpSinkService extends ProfileService { } setA2dpSinkService(this); BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); return true; } @Override protected boolean stop() { BluetoothDevice activeDevice = getActiveDevice(); String deviceAddress = activeDevice != null ? activeDevice.getAddress() : AdapterService.ACTIVITY_ATTRIBUTION_NO_ACTIVE_DEVICE_ADDRESS; mAdapterService.notifyActivityAttributionInfo(getAttributionSource(), deviceAddress); setA2dpSinkService(null); mNativeInterface.cleanup(); for (A2dpSinkStateMachine stateMachine : mDeviceStateMap.values()) { Loading