From: Michael Sun Date: Mon, 23 Nov 2020 07:07:01 +0000 (+0000) Subject: btaa: undo btaa implementation is fluoride stack X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=6e81df00dfb9a5758747c93f84d4a27cd092a93b;p=android-x86%2Fsystem-bt.git btaa: undo btaa implementation is fluoride stack Undo most btaa implementation in the fluoride stack to get ready for migrating to gd. Tag: #feature Bug: 172501038 Test: m Change-Id: Ibd696edd95ab4eb73ab2387114eca3af14ea66d8 --- diff --git a/btaa/Android.bp b/btaa/Android.bp deleted file mode 100644 index 37dd627ba..000000000 --- a/btaa/Android.bp +++ /dev/null @@ -1,28 +0,0 @@ -// libbtaa static library for target -// ======================================================== -cc_library_static { - name: "libbtaa", - defaults: ["fluoride_defaults"], - include_dirs: [ - "system/bt", - "system/bt/hci/include", - "system/bt/stack/include", - ], - local_include_dirs: [ - "include", - ], - srcs: [ - "src/activity_attribution.cc", - ], - static_libs: [ - "libbt-hci", - ], - shared_libs: [ - "android.system.suspend.control-ndk", - "libbinder_ndk", - ], - apex_available: [ - "//apex_available:platform", - "com.android.bluetooth.updatable", - ], -} diff --git a/btaa/include/activity_attribution.h b/btaa/include/activity_attribution.h deleted file mode 100644 index 137fc67ff..000000000 --- a/btaa/include/activity_attribution.h +++ /dev/null @@ -1,52 +0,0 @@ -/****************************************************************************** - * - * 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. - * - ******************************************************************************/ - -#pragma once - -#include -#include -#include - -using aidl::android::system::suspend::BnSuspendCallback; -using aidl::android::system::suspend::BnWakelockCallback; -using Status = ::ndk::ScopedAStatus; - -namespace bluetooth { -namespace activity_attribution { -class ActivityAttribution { - public: - virtual ~ActivityAttribution() = default; - - static void CleanUp(); - static void Initialize(ActivityAttributionCallbacks* callbacks); -}; - -class WakelockCallback : public BnWakelockCallback { - public: - Status notifyAcquired(void) override; - Status notifyReleased(void) override; -}; - -class WakeupCallback : public BnSuspendCallback { - public: - Status notifyWakeup(bool success, - const std::vector& wakeupReasons) override; -}; - -} // namespace activity_attribution -} // namespace bluetooth diff --git a/btaa/src/activity_attribution.cc b/btaa/src/activity_attribution.cc deleted file mode 100644 index 213b27796..000000000 --- a/btaa/src/activity_attribution.cc +++ /dev/null @@ -1,129 +0,0 @@ -/****************************************************************************** - * - * 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. - * - ******************************************************************************/ - -#include "activity_attribution.h" - -#include -#include -#include - -#include "btsnoop_mem.h" - -using aidl::android::system::suspend::ISuspendCallback; -using aidl::android::system::suspend::ISuspendControlService; -using namespace ndk; - -namespace bluetooth { -namespace activity_attribution { - -static const std::string kBtWakelockName("hal_bluetooth_lock"); - -class ActivityAttributionImpl; -static std::shared_ptr controlService; -static std::unique_ptr instance; - -class ActivityAttributionImpl : public ActivityAttribution { - public: - ~ActivityAttributionImpl() override = default; - ActivityAttributionImpl(ActivityAttributionCallbacks* callbacks); - - static void onHciCaptured(const uint16_t type, const uint8_t* data, - const size_t length, const uint64_t timestamp_us); - void onWakelockAcquired(void); - void onWakelockReleased(void); - void onWakeup(bool success, const std::vector& wakeupReasons); - - private: - [[maybe_unused]] ActivityAttributionCallbacks* mCallbacks; -}; - -ActivityAttributionImpl::ActivityAttributionImpl( - ActivityAttributionCallbacks* callbacks) - : mCallbacks(callbacks) {} - -void ActivityAttributionImpl::onHciCaptured(const uint16_t type, - const uint8_t* data, - const size_t length, - const uint64_t timestamp_us) {} - -void ActivityAttributionImpl::onWakelockAcquired(void) {} - -void ActivityAttributionImpl::onWakelockReleased(void) {} - -void ActivityAttributionImpl::onWakeup( - bool success, const std::vector& wakeupReasons) {} - -Status WakelockCallback::notifyAcquired(void) { - if (instance) { - instance->onWakelockAcquired(); - } - return Status::ok(); -} - -Status WakelockCallback::notifyReleased(void) { - if (instance) { - instance->onWakelockReleased(); - } - return Status::ok(); -} - -Status WakeupCallback::notifyWakeup( - bool success, const std::vector& wakeupReasons) { - if (instance) { - instance->onWakeup(success, wakeupReasons); - } - return Status::ok(); -} - -void ActivityAttribution::CleanUp() { instance.reset(); }; - -void ActivityAttribution::Initialize(ActivityAttributionCallbacks* callbacks) { - bool is_registered = false; - - if (instance) { - LOG(ERROR) << __func__ << " Already initialized!"; - return; - } - instance.reset(new ActivityAttributionImpl(callbacks)); - - activity_attribution_set_callback(instance->onHciCaptured); - - controlService = ISuspendControlService::fromBinder( - SpAIBinder(AServiceManager_getService("suspend_control"))); - if (!controlService) { - LOG(ERROR) << __func__ << " Fail to obtain suspend_control"; - return; - } - - Status register_callback_status = controlService->registerCallback( - SharedRefBase::make(), &is_registered); - if (!is_registered || !register_callback_status.isOk()) { - LOG(ERROR) << __func__ << " Fail to register wakeup callback"; - return; - } - - register_callback_status = controlService->registerWakelockCallback( - SharedRefBase::make(), kBtWakelockName, &is_registered); - if (!is_registered || !register_callback_status.isOk()) { - LOG(ERROR) << __func__ << " Fail to register wakelock callback"; - return; - } -} - -} // namespace activity_attribution -} // namespace bluetooth diff --git a/btif/Android.bp b/btif/Android.bp index a072cff5b..50dc1292d 100755 --- a/btif/Android.bp +++ b/btif/Android.bp @@ -49,7 +49,6 @@ cc_library_static { "src/btif_a2dp_control.cc", "src/btif_a2dp_sink.cc", "src/btif_a2dp_source.cc", - "src/btif_activity_attribution.cc", "src/btif_av.cc", "src/btif_avrcp_audio_track.cc", "src/btif_ble_advertiser.cc", @@ -97,7 +96,6 @@ cc_library_static { shared_libs: [ "android.hardware.bluetooth.a2dp@1.0", "android.hardware.bluetooth.audio@2.0", - "android.system.suspend.control-ndk", "libaaudio", "libcrypto", "libcutils", @@ -113,7 +111,6 @@ cc_library_static { "lib-bt-packets", "libaudio-a2dp-hw-utils", "libbt-audio-hal-interface", - "libbtaa", ], cflags: [ "-DBUILDCFG", diff --git a/btif/include/btif_activity_attribution.h b/btif/include/btif_activity_attribution.h deleted file mode 100644 index 3194d3321..000000000 --- a/btif/include/btif_activity_attribution.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ - -#include - -namespace bluetooth { -namespace activity_attribution { - -ActivityAttributionInterface* getActivityAttributionInterface(); - -} // namespace activity_attribution -} // namespace bluetooth \ No newline at end of file diff --git a/btif/src/bluetooth.cc b/btif/src/bluetooth.cc index c272cf119..cda0f5959 100644 --- a/btif/src/bluetooth.cc +++ b/btif/src/bluetooth.cc @@ -49,7 +49,6 @@ #include "bta/include/bta_hf_client_api.h" #include "btif/avrcp/avrcp_service.h" #include "btif_a2dp.h" -#include "btif_activity_attribution.h" #include "btif_api.h" #include "btif_av.h" #include "btif_bqr.h" @@ -433,7 +432,7 @@ static const void* get_profile_interface(const char* profile_id) { return bluetooth::bluetooth_keystore::getBluetoothKeystoreInterface(); if (is_profile(profile_id, BT_ACTIVITY_ATTRIBUTION_ID)) { - return bluetooth::activity_attribution::getActivityAttributionInterface(); + return NULL; } return NULL; diff --git a/btif/src/btif_activity_attribution.cc b/btif/src/btif_activity_attribution.cc deleted file mode 100644 index 7131e7ef7..000000000 --- a/btif/src/btif_activity_attribution.cc +++ /dev/null @@ -1,73 +0,0 @@ -/****************************************************************************** - * - * 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. - * - ******************************************************************************/ - -/* Activity Attribution Interface */ - -#include - -#include "btaa/include/activity_attribution.h" -#include "btif/include/btif_common.h" -#include "gd/common/init_flags.h" -#include "stack/include/btu.h" - -using base::Bind; -using base::Unretained; - -namespace bluetooth { -namespace activity_attribution { - -std::unique_ptr activityAttributionInstance; - -class ActivityAttributionInterfaceImpl : public ActivityAttributionCallbacks, - public ActivityAttributionInterface { - ~ActivityAttributionInterfaceImpl() override = default; - - void Init(ActivityAttributionCallbacks* callbacks) override { - if (!bluetooth::common::InitFlags::BtaaHciLogEnabled()) { - LOG(INFO) << __func__ << " BTAA not enabled!"; - return; - } - - this->callbacks = callbacks; - ActivityAttribution::Initialize(this); - } - - void OnWakeup(Activity activity, const RawAddress& address) override { - VLOG(2) << __func__ << " activity: " << (int)activity - << " address: " << address; - do_in_jni_thread(FROM_HERE, Bind(&ActivityAttributionCallbacks::OnWakeup, - Unretained(callbacks), activity, address)); - } - - void Cleanup(void) override { - do_in_main_thread(FROM_HERE, Bind(&ActivityAttribution::CleanUp)); - } - - private: - ActivityAttributionCallbacks* callbacks; -}; - -ActivityAttributionInterface* getActivityAttributionInterface() { - if (!activityAttributionInstance) - activityAttributionInstance.reset(new ActivityAttributionInterfaceImpl()); - - return activityAttributionInstance.get(); -} - -} // namespace activity_attribution -} // namespace bluetooth diff --git a/test/headless/Android.bp b/test/headless/Android.bp index ba18f8a8e..16b322da5 100644 --- a/test/headless/Android.bp +++ b/test/headless/Android.bp @@ -46,10 +46,8 @@ cc_test { "android.hardware.bluetooth.audio@2.0", "android.hardware.bluetooth@1.0", "android.hardware.bluetooth@1.1", - "android.system.suspend.control-ndk", "libaaudio", "libbase", - "libbinder_ndk", "libcrypto", "libcutils", // property_get_bool "libfmq",