Merge "codec2: skip adding new color formats for older vendor images" into tm-dev am: 89324d3640
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/18740193
Change-Id: I4f98bd485a0d654c14ff100cff51e6f6bc0dbb10
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/media/codec2/sfplugin/Codec2InfoBuilder.cpp b/media/codec2/sfplugin/Codec2InfoBuilder.cpp
index 3f9a40d..1c362ae 100644
--- a/media/codec2/sfplugin/Codec2InfoBuilder.cpp
+++ b/media/codec2/sfplugin/Codec2InfoBuilder.cpp
@@ -309,8 +309,13 @@
if (trait.name.find("android") != std::string::npos) {
addDefaultColorFormat(COLOR_FormatSurface);
}
- for (int32_t colorFormat : supportedColorFormats) {
- caps->addColorFormat(colorFormat);
+
+ static const int kVendorSdkVersion = ::android::base::GetIntProperty(
+ "ro.vendor.build.version.sdk", android_get_device_api_level());
+ if (kVendorSdkVersion >= __ANDROID_API_T__) {
+ for (int32_t colorFormat : supportedColorFormats) {
+ caps->addColorFormat(colorFormat);
+ }
}
}
}