From 97eb3f1bd2d55bb23afa64c3908377645981cc74 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Wed, 10 Mar 2021 11:55:09 -0800 Subject: [PATCH] os.Build: add MEDIA_PERFORMANCE_CLASS Bug: 175813535 Test: atest android.mediapc.cts.PerformanceClassTest Test: atest android.os.cts.BuildTest Change-Id: I66e172f4c619a3277bde1004ba4828e2173f69a0 --- core/api/current.txt | 1 + core/java/android/os/Build.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/core/api/current.txt b/core/api/current.txt index ba98ed6595365..25287fb069cf8 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -30425,6 +30425,7 @@ package android.os { field public static final String BASE_OS; field public static final String CODENAME; field public static final String INCREMENTAL; + field public static final int MEDIA_PERFORMANCE_CLASS; field public static final int PREVIEW_SDK_INT; field public static final String RELEASE; field @NonNull public static final String RELEASE_OR_CODENAME; diff --git a/core/java/android/os/Build.java b/core/java/android/os/Build.java index 83f78a56487aa..0d9f715c11d4a 100755 --- a/core/java/android/os/Build.java +++ b/core/java/android/os/Build.java @@ -27,6 +27,7 @@ import android.app.ActivityThread; import android.app.Application; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; +import android.sysprop.DeviceProperties; import android.sysprop.SocProperties; import android.sysprop.TelephonyProperties; import android.text.TextUtils; @@ -297,6 +298,19 @@ public class Build { public static final String SECURITY_PATCH = SystemProperties.get( "ro.build.version.security_patch", ""); + /** + * The media performance class of the device or 0 if none. + *

+ * If this value is not 0, the device conforms to the media performance class + * definition of the SDK version of this value. This value never changes while a device is + * booted, but it may increase when the hardware manufacturer provides an OTA update. + *

+ * Possible non-zero values are defined in {@link Build.VERSION_CODES} starting with + * {@link Build.VERSION_CODES#S}. + */ + public static final int MEDIA_PERFORMANCE_CLASS = + DeviceProperties.media_performance_class().orElse(0); + /** * The user-visible SDK version of the framework in its raw String * representation; use {@link #SDK_INT} instead.