Ray Essick | 3938dc6 | 2016-11-01 08:56:56 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 35 | namespace android { |
| 36 | |
| 37 | class IMediaAnalyticsService: public IInterface |
| 38 | { |
| 39 | public: |
| 40 | DECLARE_META_INTERFACE(MediaAnalyticsService); |
| 41 | |
Andy Hung | c89c8dc | 2019-10-16 17:48:21 -0700 | [diff] [blame^] | 42 | /** |
| 43 | * Returns a unique sessionID to use across multiple requests; |
| 44 | * 'unique' is within this device, since last reboot. |
| 45 | */ |
Ray Essick | 3938dc6 | 2016-11-01 08:56:56 -0700 | [diff] [blame] | 46 | virtual MediaAnalyticsItem::SessionID_t generateUniqueSessionID() = 0; |
| 47 | |
Andy Hung | c89c8dc | 2019-10-16 17:48:21 -0700 | [diff] [blame^] | 48 | /** |
| 49 | * Submits the indicated record to the mediaanalytics service, where |
| 50 | * it will be merged (if appropriate) with incomplete records that |
| 51 | * share the same key and sessionID. |
| 52 | * |
| 53 | * \param item the item to submit. |
| 54 | * \param forcenew marks any matching incomplete record as complete before |
| 55 | * inserting this new record. |
| 56 | * |
| 57 | * \return the sessionID associated with that item or |
| 58 | * MediaAnalyticsItem::SessionIDInvalid on failure. |
| 59 | */ |
Ray Essick | b5fac8e | 2016-12-12 11:33:56 -0800 | [diff] [blame] | 60 | virtual MediaAnalyticsItem::SessionID_t submit(MediaAnalyticsItem *item, bool forcenew) = 0; |
Ray Essick | 3938dc6 | 2016-11-01 08:56:56 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | // ---------------------------------------------------------------------------- |
| 64 | |
| 65 | class BnMediaAnalyticsService: public BnInterface<IMediaAnalyticsService> |
| 66 | { |
| 67 | public: |
Andy Hung | c89c8dc | 2019-10-16 17:48:21 -0700 | [diff] [blame^] | 68 | status_t onTransact(uint32_t code, |
| 69 | const Parcel& data, |
| 70 | Parcel* reply, |
| 71 | uint32_t flags = 0) override; |
Ray Essick | 3938dc6 | 2016-11-01 08:56:56 -0700 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | }; // namespace android |
| 75 | |
| 76 | #endif // ANDROID_IMEDIASTATISTICSSERVICE_H |