Loading system/btif/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ 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", Loading system/btif/include/btif_activity_attribution.h 0 → 100644 +25 −0 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. */ #include <hardware/bt_activity_attribution.h> namespace bluetooth { namespace activity_attribution { ActivityAttributionInterface* getActivityAttributionInterface(); } // namespace activity_attribution } // namespace bluetooth No newline at end of file system/btif/src/bluetooth.cc +6 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ #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" Loading Loading @@ -430,6 +431,11 @@ static const void* get_profile_interface(const char* profile_id) { if (is_profile(profile_id, BT_KEYSTORE_ID)) return bluetooth::bluetooth_keystore::getBluetoothKeystoreInterface(); if (is_profile(profile_id, BT_ACTIVITY_ATTRIBUTION_ID)) { return bluetooth::activity_attribution::getActivityAttributionInterface(); } return NULL; } Loading system/btif/src/btif_activity_attribution.cc 0 → 100644 +63 −0 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. * ******************************************************************************/ /* Activity Attribution Interface */ #include <hardware/bt_activity_attribution.h> #include "btif/include/btif_common.h" #include "stack/include/btu.h" using base::Bind; using base::Unretained; namespace bluetooth { namespace activity_attribution { std::unique_ptr<ActivityAttributionInterface> activityAttributionInstance; class ActivityAttributionInterfaceImpl : public ActivityAttributionCallbacks, public ActivityAttributionInterface { ~ActivityAttributionInterfaceImpl() override = default; void Init(ActivityAttributionCallbacks* callbacks) override { this->callbacks = callbacks; } 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 {} private: ActivityAttributionCallbacks* callbacks; }; ActivityAttributionInterface* getActivityAttributionInterface() { if (!activityAttributionInstance) activityAttributionInstance.reset(new ActivityAttributionInterfaceImpl()); return activityAttributionInstance.get(); } } // namespace activity_attribution } // namespace bluetooth system/include/hardware/bluetooth.h +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ #define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl" #define BT_PROFILE_HEARING_AID_ID "hearing_aid" #define BT_KEYSTORE_ID "bluetooth_keystore" #define BT_ACTIVITY_ATTRIBUTION_ID "activity_attribution" /** Bluetooth Device Name */ typedef struct { uint8_t name[249]; } __attribute__((packed)) bt_bdname_t; Loading Loading
system/btif/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ 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", Loading
system/btif/include/btif_activity_attribution.h 0 → 100644 +25 −0 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. */ #include <hardware/bt_activity_attribution.h> namespace bluetooth { namespace activity_attribution { ActivityAttributionInterface* getActivityAttributionInterface(); } // namespace activity_attribution } // namespace bluetooth No newline at end of file
system/btif/src/bluetooth.cc +6 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ #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" Loading Loading @@ -430,6 +431,11 @@ static const void* get_profile_interface(const char* profile_id) { if (is_profile(profile_id, BT_KEYSTORE_ID)) return bluetooth::bluetooth_keystore::getBluetoothKeystoreInterface(); if (is_profile(profile_id, BT_ACTIVITY_ATTRIBUTION_ID)) { return bluetooth::activity_attribution::getActivityAttributionInterface(); } return NULL; } Loading
system/btif/src/btif_activity_attribution.cc 0 → 100644 +63 −0 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. * ******************************************************************************/ /* Activity Attribution Interface */ #include <hardware/bt_activity_attribution.h> #include "btif/include/btif_common.h" #include "stack/include/btu.h" using base::Bind; using base::Unretained; namespace bluetooth { namespace activity_attribution { std::unique_ptr<ActivityAttributionInterface> activityAttributionInstance; class ActivityAttributionInterfaceImpl : public ActivityAttributionCallbacks, public ActivityAttributionInterface { ~ActivityAttributionInterfaceImpl() override = default; void Init(ActivityAttributionCallbacks* callbacks) override { this->callbacks = callbacks; } 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 {} private: ActivityAttributionCallbacks* callbacks; }; ActivityAttributionInterface* getActivityAttributionInterface() { if (!activityAttributionInstance) activityAttributionInstance.reset(new ActivityAttributionInterfaceImpl()); return activityAttributionInstance.get(); } } // namespace activity_attribution } // namespace bluetooth
system/include/hardware/bluetooth.h +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ #define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl" #define BT_PROFILE_HEARING_AID_ID "hearing_aid" #define BT_KEYSTORE_ID "bluetooth_keystore" #define BT_ACTIVITY_ATTRIBUTION_ID "activity_attribution" /** Bluetooth Device Name */ typedef struct { uint8_t name[249]; } __attribute__((packed)) bt_bdname_t; Loading