blob: aef35c324b8796307fb6aee8e6ee6f1f7f28a315 [file] [log] [blame]
Robert Shih75e12cc2019-11-10 13:34:06 -08001/*
2 * Copyright (C) 2019 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#include <android/hardware/drm/1.1/types.h>
18#include <hidl/HidlSupport.h>
19#include <media/stagefright/foundation/ABase.h>
20
21#ifndef ANDROID_IDRMMETRICSCONSUMER_H_
22
23#define ANDROID_IDRMMETRICSCONSUMER_H_
24
25using ::android::hardware::hidl_vec;
26using ::android::hardware::drm::V1_1::DrmMetricGroup;
27
28namespace android {
29
30class MediaDrmMetrics;
31class String8;
32
33/**
34 * Interface to consume metrics produced by the IDrm/ICrypto
35 *
36 * To use with IDrm:
37 * drm->exportMetrics(&consumer);
38 *
39 * IDrmMetricsConsumer::consumeFrameworkMetrics &
40 * IDrmMetricsConsumer::consumeHidlMetrics implementations
41 * would each be invoked once per call to IDrm::exportMetrics.
42 * |consumeFrameworkMetrics| would be called for plugin-agnostic
43 * framework metrics; |consumeHidlMetrics| would be called for
44 * plugin specific metrics.
45 *
46 * ----------------------------------------
47 *
48 * To use with ICrypto:
49 * crypto->exportMetrics(&consumer);
50 *
51 * IDrmMetricsConsumer::consumeHidlMetrics implementation
52 * would each be invoked once per call to ICrypto::exportMetrics.
53 * ICrypto metrics are plugin agnostic.
54 *
55 * ----------------------------------------
56 *
57 * For an example implementation of IDrmMetricsConsumer, please
Robert Shih93538812019-11-12 12:21:35 -080058 * see DrmMetricsConsumer. DrmMetricsConsumer consumes IDrm/ICrypto
59 * metrics and saves the metrics to a PersistableBundle.
Robert Shih75e12cc2019-11-10 13:34:06 -080060 *
61 */
62struct IDrmMetricsConsumer : public RefBase {
63
64 virtual ~IDrmMetricsConsumer() {}
65
66 /**
67 * Consume framework (plugin agnostic) MediaDrmMetrics
68 */
69 virtual status_t consumeFrameworkMetrics(const MediaDrmMetrics &) = 0;
70
71 /**
72 * Consume list of DrmMetricGroup with optional Drm vendor name
73 */
74 virtual status_t consumeHidlMetrics(
75 const String8 &vendor,
76 const hidl_vec<DrmMetricGroup> &pluginMetrics) = 0;
77
78protected:
79 IDrmMetricsConsumer() {}
80
81private:
82 DISALLOW_EVIL_CONSTRUCTORS(IDrmMetricsConsumer);
83};
84
85} // namespace android
86
87#endif // ANDROID_IDRMMETRICSCONSUMER_H_