blob: 92136373fe47483cbc74907a981d97f1f6de0163 [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
42 // generate a unique sessionID to use across multiple requests
43 // 'unique' is within this device, since last reboot
44 virtual MediaAnalyticsItem::SessionID_t generateUniqueSessionID() = 0;
45
46 // submit the indicated record to the mediaanalytics service, where
47 // it will be merged (if appropriate) with incomplete records that
48 // share the same key and sessionid.
49 // 'forcenew' marks any matching incomplete record as complete before
50 // inserting this new record.
51 // returns the sessionID associated with that item.
Ray Essickb5fac8e2016-12-12 11:33:56 -080052 // caller continues to own the passed item
53 virtual MediaAnalyticsItem::SessionID_t submit(MediaAnalyticsItem *item, bool forcenew) = 0;
Ray Essick3938dc62016-11-01 08:56:56 -070054
55
56 // return lists of records that match the supplied parameters.
57 // finished [or not] records since time 'ts' with key 'key'
58 // timestamp 'ts' is nanoseconds, unix time.
Ray Essickb5fac8e2016-12-12 11:33:56 -080059 // caller responsible for deallocating returned data structures
60 virtual List<MediaAnalyticsItem *> *getMediaAnalyticsItemList(bool finished, int64_t ts) = 0;
61 virtual List<MediaAnalyticsItem *> *getMediaAnalyticsItemList(bool finished, int64_t ts, MediaAnalyticsItem::Key key) = 0;
Ray Essick3938dc62016-11-01 08:56:56 -070062
63};
64
65// ----------------------------------------------------------------------------
66
67class BnMediaAnalyticsService: public BnInterface<IMediaAnalyticsService>
68{
69public:
70 virtual status_t onTransact( uint32_t code,
71 const Parcel& data,
72 Parcel* reply,
73 uint32_t flags = 0);
74};
75
76}; // namespace android
77
78#endif // ANDROID_IMEDIASTATISTICSSERVICE_H