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

Commit 8deec1e6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Camera: remove flag use_system_api_for_vndk_version" into main

parents 9f123d34 be0be6f5
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -62,13 +62,6 @@ flag {
    bug: "301588215"
}

flag {
    namespace: "camera_platform"
    name: "use_ro_board_api_level_for_vndk_version"
    description: "Enable using ro.board.api_level instead of ro.vndk.version to get VNDK version"
    bug: "312315580"
}

flag {
    namespace: "camera_platform"
    name: "camera_extensions_characteristics_get"
@@ -145,16 +138,6 @@ flag {
    bug: "332557570"
}

flag {
    namespace: "camera_platform"
    name: "use_system_api_for_vndk_version"
    description: "ro.board.api_level isn't reliable. Use system api to replace ro.vndk.version"
    bug: "312315580"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    namespace: "camera_platform"
    name: "multi_res_raw_reprocessing"
+0 −37
Original line number Diff line number Diff line
@@ -25,44 +25,7 @@

namespace android {

namespace flags = com::android::internal::camera::flags;

namespace {
constexpr const char* LEGACY_VNDK_VERSION_PROP = "ro.vndk.version";
constexpr const char* BOARD_API_LEVEL_PROP = "ro.board.api_level";
constexpr int MAX_VENDOR_API_LEVEL = 1000000;
constexpr int FIRST_VNDK_VERSION = 202404;

int legacyGetVNDKVersionFromProp(int defaultVersion) {
    if (!flags::use_ro_board_api_level_for_vndk_version()) {
        return base::GetIntProperty(LEGACY_VNDK_VERSION_PROP, defaultVersion);
    }

    int vndkVersion = base::GetIntProperty(BOARD_API_LEVEL_PROP, MAX_VENDOR_API_LEVEL);

    if (vndkVersion == MAX_VENDOR_API_LEVEL) {
        // Couldn't find property
        return defaultVersion;
    }

    if (vndkVersion < __ANDROID_API_V__) {
        // VNDK versions below V return the corresponding SDK version.
        return vndkVersion;
    }

    // VNDK for Android V and above are of the format YYYYMM starting with 202404 and is bumped
    // up once a year. So V would be 202404 and the next one would be 202504.
    // This is the same assumption as that made in system/core/init/property_service.cpp.
    vndkVersion = (vndkVersion - FIRST_VNDK_VERSION) / 100;
    return __ANDROID_API_V__ + vndkVersion;
}
}  // anonymous namespace

int getVNDKVersionFromProp(int defaultVersion) {
    if (!flags::use_system_api_for_vndk_version()) {
        return legacyGetVNDKVersionFromProp(defaultVersion);
    }

    int vendorApiLevel = AVendorSupport_getVendorApiLevel();
    if (vendorApiLevel == 0) {
        // Couldn't find vendor API level, return default