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

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

Merge "Codec2CommonUtils: Reduce android_get_device_api_level() calls" into...

Merge "Codec2CommonUtils: Reduce android_get_device_api_level() calls" into main am: ba71b568 am: e58559a5

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



Change-Id: I88594d873a47c36cde725981eef5012a330a9c9a
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f11041b0 e58559a5
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -32,10 +32,15 @@
namespace android {


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() >= version || !strcmp(deviceCodeName, codeName);
static bool isAtLeast(int version, const std::string codeName) {
    static std::once_flag sCheckOnce;
    static std::string sDeviceCodeName;
    static int sDeviceApiLevel;
    std::call_once(sCheckOnce, [&](){
        sDeviceCodeName = base::GetProperty("ro.build.version.codename", "");
        sDeviceApiLevel = android_get_device_api_level();
    });
    return sDeviceApiLevel >= version || sDeviceCodeName == codeName;
}

bool isAtLeastT() {