--- /dev/null
+/*
+ * 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
#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"
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;
}
--- /dev/null
+/******************************************************************************
+ *
+ * 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