Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6a04d658 authored by Adam Stone's avatar Adam Stone
Browse files

Added definition for getMetrics to IDrmPlugin.

Also added the appropriate type information for exporting metrics from a
plugin.

Bug: 64001676
Bug: 64001680

Change-Id: I9ccd4fbcf7201990e6d08c24e814e24833459a23
Test: Verified that the interface builds. No implementation, yet.
parent cc192817
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.hardware.drm@1.1;
import @1.0::IDrmPlugin;
import @1.0::IDrmPluginListener;
import @1.0::Status;
import @1.1::DrmMetricGroup;
import @1.1::HdcpLevel;
import @1.1::SecurityLevel;

@@ -106,4 +107,17 @@ interface IDrmPlugin extends @1.0::IDrmPlugin {
     */
    setSecurityLevel(vec<uint8_t> sessionId, SecurityLevel level)
            generates(Status status);

    /**
     * Returns the plugin-specific metrics. Multiple metric groups may be
     * returned in one call to getMetrics(). The scope and definition of the
     * metrics is defined by the plugin.
     *
     * @return status the status of the call. The status must be OK or
     *         ERROR_DRM_INVALID_STATE if the metrics are not available to be
     *         returned.
     * @return metric_groups the collection of metric groups provided by the
     *         plugin.
     */
    getMetrics() generates (Status status, vec<DrmMetricGroup> metric_groups);
};
+98 −0
Original line number Diff line number Diff line
@@ -16,6 +16,103 @@

package android.hardware.drm@1.1;

/**
 * This message contains plugin-specific metrics made available to the client.
 * The message is used for making vendor-specific metrics available to an
 * application. The framework is not consuming any of the information.
 *
 * Metrics are grouped in instances of DrmMetricGroup. Each group contains
 * multiple instances of Metric.
 *
 * Example:
 *
 * Capture the timing information of a buffer copy event, "buf_copy", broken
 * out by the "size" of the buffer.
 *
 * DrmMetricGroup {
 *   metrics[0] {
 *     name: "buf_copy"
 *     attributes[0] {
 *       name: "size"
 *       type: INT64_TYPE
 *       int64Value: 1024
 *     }
 *     values[0] {
 *       componentName: "operation_count"
 *       type: INT64_TYPE
 *       int64Value: 75
 *     }
 *     values[1] {
 *       component_name: "average_time_seconds"
 *       type: DOUBLE_TYPE
 *       doubleValue: 0.00000042
 *     }
 *   }
 * }
 */
struct DrmMetricGroup {
    /**
     * Used to discriminate the type of value being stored in the structs
     * below.
     */
    enum ValueType : uint8_t {
        INT64_TYPE,
        DOUBLE_TYPE,
        STRING_TYPE,
    };

    /**
     * A detail about the metric being captured. The fields of an Attribute
     * are opaque to the framework.
     */
    struct Attribute {
        string name;
        /**
         * The type field indicates which of the following values is used.
         */
        ValueType type;
        int64_t int64Value;
        double doubleValue;
        string stringValue;
    };

    /**
     * A value of the metric. A metric may have multiple values. The
     * component name may be left empty if there is only supposed to be
     * one value for the given metric. The fields of the Value are
     * opaque to the framework.
     */
    struct Value {
        string componentName;
        /**
         * The type field indicates which of the following values is used.
         */
        ValueType type;
        int64_t int64Value;
        double doubleValue;
        string stringValue;
    };

    /**
     * The metric being captured. A metric must have a name and at least one
     * value. A metric may have 0 or more attributes. The fields of a Metric
     * are opaque to the framework.
     */
    struct Metric {
        string name;
        vec<Attribute> attributes;
        // A Metric may have one or more values. Multiple values are useful
        // for capturing different aspects of the same metric. E.g. capture
        // the min, max, average, count, and stdev of a particular metric.
        vec<Value> values;
    };

    /**
     * The list of metrics to be captured.
     */
    vec<Metric> metrics;
};

/**
 * HDCP specifications are defined by Digital Content Protection LLC (DCP).
 *   "HDCP Specification Rev. 2.2 Interface Independent Adaptation"
@@ -93,3 +190,4 @@ enum SecurityLevel : uint32_t {
     */
    HW_SECURE_ALL,
};