1 /* 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 25 using ::android::hardware::hidl_vec; 26 using ::android::hardware::drm::V1_1::DrmMetricGroup; 27 28 namespace android { 29 30 class MediaDrmMetrics; 31 class 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 58 * see DrmMetricsConsumer. DrmMetricsConsumer consumes IDrm/ICrypto 59 * metrics and saves the metrics to a PersistableBundle. 60 * 61 */ 62 struct IDrmMetricsConsumer : public RefBase { 63 ~IDrmMetricsConsumerIDrmMetricsConsumer64 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 78 protected: IDrmMetricsConsumerIDrmMetricsConsumer79 IDrmMetricsConsumer() {} 80 81 private: 82 DISALLOW_EVIL_CONSTRUCTORS(IDrmMetricsConsumer); 83 }; 84 85 } // namespace android 86 87 #endif // ANDROID_IDRMMETRICSCONSUMER_H_ 88