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

Commit 4b5dce8b authored by Pawin Vongmasa's avatar Pawin Vongmasa
Browse files

Use safe_union in FieldSupportedValues

Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice

Bug: 129084824
Change-Id: I9ae77a6a6697dcc508415090640a21841caba345
parent 6ce6ad3f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ d36f747f9c9a8f2f21db2f8323c2d755dd08b34ce813932d7339979f7d490dab android.hardwar
21aa259585caaa27b6470ebcd8509aabde0ef5d039160aa6425d589cb787488b android.hardware.media.c2@1.0::IInputSink
b9422a9aca84df1ff9623dc12c0562abce97716e28d63a965f2bfb88f9ad9607 android.hardware.media.c2@1.0::IInputSurface
0a786a19e6753f9774a7ca7781c2a2edfe5c0b5fa112355dfa0e50ebedeb08b9 android.hardware.media.c2@1.0::IInputSurfaceConnection
4cb139f729c29d8d6f4ecdab149c4feb571dad8a06e56cd57fcb52e70208bab4 android.hardware.media.c2@1.0::types
7d3c292ca75ec3e22a8fd4ae72d2edb0659d280257e763786e766f3429954dd1 android.hardware.media.c2@1.0::types
4880af120fc1640225abdc2c60bda6d79617d73484d5124913c7278af3b11e2d android.hardware.neuralnetworks@1.2::IBurstCallback
19877e466ad8c6ed42b38050b77bd010cf7800ff365fdc8574f45bbfda03a758 android.hardware.neuralnetworks@1.2::IBurstContext
96249c852dabeefa3a9496ecdfc44681a071c665bfbf88527bf775c88bf1ab1b android.hardware.neuralnetworks@1.2::IDevice
+1 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ hidl_interface {
        "android.hardware.media.omx@1.0",
        "android.hardware.media@1.0",
        "android.hidl.base@1.0",
        "android.hidl.safe_union@1.0",
    ],
    gen_java: false,
}
+52 −72
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.media.c2@1.0;

import android.hardware.media.bufferpool@2.0::BufferStatusMessage;
import android.hidl.safe_union@1.0::Monostate;

/**
 * Common return values for Codec2 operations.
@@ -190,19 +191,13 @@ struct ParamDescriptor {
 */
typedef uint64_t PrimitiveValue;

/*
 * Description of supported values for a field.
 *
 * This can be a continuous range or a discrete set of values.
 */
struct FieldSupportedValues {
/**
     * Used if #type is `RANGE`.
 * Description of a set of values.
 *
 * If the `step` member is 0, and `num` and `denom` are both 1, the `Range`
 * structure represents a closed interval bounded by `min` and `max`.
 *
     * Otherwise, the #Range structure represents a finite sequence of numbers
 * Otherwise, the #ValueRange structure represents a finite sequence of numbers
 * produced from the following recurrence relation:
 *
 * @code
@@ -218,7 +213,7 @@ struct FieldSupportedValues {
 * The division in the formula may truncate the result if the data type of
 * these values is an integral type.
 */
    struct Range {
struct ValueRange {
    /**
     * Lower end of the range (inclusive).
     */
@@ -241,38 +236,23 @@ struct FieldSupportedValues {
    PrimitiveValue denom;
};

    enum Type : int32_t {
        /** No supported values */
        EMPTY = 0,
        /** Numeric range, described in a #Range structure */
        RANGE,
        /** List of values */
        VALUES,
        /** List of flags that can be OR-ed */
        FLAGS,
    };
    /**
     * Type of the supported values.
     */
    Type type;

    /**
     * When #type is #Type.RANGE, #range shall specify the range of possible
     * values.
/*
 * Description of supported values for a field.
 *
     * The intended type of members of #range shall be clear in the context
     * where `FieldSupportedValues` is used.
     */
    Range range;

    /**
     * When #type is #Type.VALUES or #Type.FLAGS, #value shall list supported
     * values/flags.
 * This can be a continuous range or a discrete set of values.
 *
     * The intended type of components of #value shall be clear in the context
     * where `FieldSupportedValues` is used.
 * The intended type of values must be made clear in the context where
 * `FieldSupportedValues` is used.
 */
safe_union FieldSupportedValues {
    /** No supported values */
    Monostate empty;
    /** Numeric range, described in a #ValueRange structure */
    ValueRange range;
    /** List of values */
    vec<PrimitiveValue> values;
    /** List of flags that can be OR-ed */
    vec<PrimitiveValue> flags;
};

/**