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

Commit a6f3fc38 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Codec2CommonUtils: Restrict encoder usage checks to Android U and...

Merge "Codec2CommonUtils: Restrict encoder usage checks to Android U and above" into main am: 3d1aa862 am: 31ea0606 am: e20fd8bd

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2699633



Change-Id: I7db3cdbeddbe6dbd646af1de325058e94023e95d
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 19359ab4 e20fd8bd
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -31,11 +31,19 @@

namespace android {

bool isAtLeastT() {

static bool isAtLeast(int version, const char *codeName) {
    char deviceCodeName[PROP_VALUE_MAX];
    __system_property_get("ro.build.version.codename", deviceCodeName);
    return android_get_device_api_level() >= __ANDROID_API_T__ ||
           !strcmp(deviceCodeName, "Tiramisu");
    return android_get_device_api_level() >= version || !strcmp(deviceCodeName, codeName);
}

bool isAtLeastT() {
    return isAtLeast(__ANDROID_API_T__, "Tiramisu");
}

bool isAtLeastU() {
    return isAtLeast(__ANDROID_API_U__, "UpsideDownCake");
}

static bool isP010Allowed() {
@@ -127,10 +135,16 @@ bool isHalPixelFormatSupported(AHardwareBuffer_Format format) {
            .rfu0 = 0,
            .rfu1 = 0,
    };

    // Some devices running versions prior to Android U aren't guaranteed to advertise support
    // for some color formats when the consumer is an encoder. Hence limit these checks to
    // Android U and beyond.
    if (isAtLeastU()) {
        return AHardwareBuffer_isSupported(&consumableForDisplayOrGpu)
                && AHardwareBuffer_isSupported(&consumableForHwEncoder)
                && AHardwareBuffer_isSupported(&consumableForSwEncoder);
    } else {
        return AHardwareBuffer_isSupported(&consumableForDisplayOrGpu);
    }
}

}  // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ namespace android {

bool isAtLeastT();

bool isAtLeastU();

bool isVendorApiOrFirstApiAtLeastT();

/**