blob: 1bcb35261adc81b57f058668327bc37b089d4f07 [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 <binder/PersistableBundle.h>
18#include <mediadrm/IDrmMetricsConsumer.h>
19#include <utils/Errors.h>
20
21#ifndef ANDROID_BUNDLEMETRICSCONSUMER_H_
22
23#define ANDROID_BUNDLEMETRICSCONSUMER_H_
24
25namespace android {
26
27/**
28 * IDrmMetricsConsumer which saves IDrm/ICrypto metrics into a PersistableBundle.
29 *
30 * Example usage:
31 *
32 * PersistableBundle bundle;
33 * BundleDrmMetricsConsumer consumer(&bundle);
34 * drm->exportMetrics(&consumer);
35 * crypto->exportMetrics(&consumer);
36 * // bundle now contains metrics from drm/crypto.
37 *
38 */
39struct BundleDrmMetricsConsumer : public IDrmMetricsConsumer {
40 BundleDrmMetricsConsumer(os::PersistableBundle*) {}
41
42 status_t consumeFrameworkMetrics(const MediaDrmMetrics &) override {
43 return OK;
44 }
45
46 status_t consumeHidlMetrics(
47 const String8 &/*vendor*/,
48 const hidl_vec<DrmMetricGroup> &/*pluginMetrics*/) override {
49 return OK;
50 }
51
52private:
53 DISALLOW_EVIL_CONSTRUCTORS(BundleDrmMetricsConsumer);
54};
55
56} // namespace android
57
58#endif // ANDROID_BUNDLEMETRICSCONSUMER_H_