blob: 30c63e7141d880fc7d855dae7789a92b5947e377 [file] [log] [blame]
Ray Essick3938dc62016-11-01 08:56:56 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_IMEDIAANALYTICSSERVICE_H
18#define ANDROID_IMEDIAANALYTICSSERVICE_H
19
20#include <utils/String8.h>
21#include <binder/IInterface.h>
22#include <binder/Parcel.h>
23
24#include <sys/types.h>
25#include <utils/Errors.h>
26#include <utils/Log.h>
27#include <utils/RefBase.h>
28#include <utils/List.h>
29
30#include <binder/IServiceManager.h>
31
32#include <media/MediaAnalyticsItem.h>
33// nope...#include <media/MediaAnalytics.h>
34
35namespace android {
36
37class IMediaAnalyticsService: public IInterface
38{
39public:
40 DECLARE_META_INTERFACE(MediaAnalyticsService);
41
Andy Hungc89c8dc2019-10-16 17:48:21 -070042 /**
Andy Hungc89c8dc2019-10-16 17:48:21 -070043 * Submits the indicated record to the mediaanalytics service, where
44 * it will be merged (if appropriate) with incomplete records that
45 * share the same key and sessionID.
46 *
47 * \param item the item to submit.
Andy Hunga87e69c2019-10-18 10:07:40 -070048 * \return status which is negative if an error is detected (some errors
49 may be silent and return 0 - success).
Andy Hungc89c8dc2019-10-16 17:48:21 -070050 */
Andy Hunga87e69c2019-10-18 10:07:40 -070051 virtual status_t submit(MediaAnalyticsItem *item) = 0;
Andy Hung1efc9c62019-12-03 13:43:33 -080052
53 virtual status_t submitBuffer(const char *buffer, size_t length) = 0;
Ray Essick3938dc62016-11-01 08:56:56 -070054};
55
56// ----------------------------------------------------------------------------
57
58class BnMediaAnalyticsService: public BnInterface<IMediaAnalyticsService>
59{
60public:
Andy Hungc89c8dc2019-10-16 17:48:21 -070061 status_t onTransact(uint32_t code,
62 const Parcel& data,
63 Parcel* reply,
64 uint32_t flags = 0) override;
Andy Hunga87e69c2019-10-18 10:07:40 -070065
66protected:
67 // Internal call where release is true if the service is to delete the item.
68 virtual status_t submitInternal(
69 MediaAnalyticsItem *item, bool release) = 0;
Ray Essick3938dc62016-11-01 08:56:56 -070070};
71
72}; // namespace android
73
74#endif // ANDROID_IMEDIASTATISTICSSERVICE_H