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

Commit 69687588 authored by William Escande's avatar William Escande
Browse files

Remove Btaa since it is not used

Bug: 291187783
Test: mm
Test: atest BluetoothInstrumentationTests
Change-Id: Ie1f95065d9ab291096c97aafab728faa131b6c05
parent 0387ae9d
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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);
+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
+0 −7
Original line number Diff line number Diff line
@@ -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) {
+0 −10
Original line number Diff line number Diff line
@@ -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);
@@ -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
+0 −10
Original line number Diff line number Diff line
@@ -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