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

Commit 74b5ae7a authored by Avichal Rakesh's avatar Avichal Rakesh
Browse files

cameraservice: Use ro.board.api_level instead of ro.vndk.version

With trunk stable, ro.vndk.version has been deprecated and replaced
by ro.board.api_level to represent the API version that the vendor
parition is built against.

From Android V onwards, instead of using the SDK version,
ro.board.api_level will store the API level in YYYYMM format.
So Android V will be designated 202404.

This CL updates the logic in CameraService to map the new
YYYYMM values back to SDK API level that is used to filter
CameraMetadata keys.

Bug: 312315580
Test: Manually verified that the mapping is correct.
Change-Id: I569760223e7f1fac4e747339f129bd86c3aa6af1
parent ee8631cb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -76,3 +76,10 @@ flag {
     description: "Enable creating MultiResolutionImageReader with usage flag configuration"
     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"
}
+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ cc_library {
        "utils/SessionStatsBuilder.cpp",
        "utils/TagMonitor.cpp",
        "utils/LatencyHistogram.cpp",
        "utils/Utils.cpp",
    ],

    header_libs: [
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <aidl/AidlUtils.h>
#include <aidl/android/frameworks/cameraservice/device/CaptureMetadataInfo.h>
#include <android-base/properties.h>
#include <utils/Utils.h>

namespace android::frameworks::cameraservice::device::implementation {

@@ -56,7 +57,7 @@ inline ScopedAStatus fromUStatus(const UStatus& status) {
AidlCameraDeviceUser::AidlCameraDeviceUser(const sp<UICameraDeviceUser>& deviceRemote):
      mDeviceRemote(deviceRemote) {
    mInitSuccess = initDevice();
    mVndkVersion = base::GetIntProperty("ro.vndk.version", __ANDROID_API_FUTURE__);
    mVndkVersion = getVNDKVersionFromProp(__ANDROID_API_FUTURE__);
}

bool AidlCameraDeviceUser::initDevice() {
+2 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <android/binder_manager.h>
#include <binder/Status.h>
#include <hidl/HidlTransportSupport.h>
#include <utils/Utils.h>

namespace android::frameworks::cameraservice::service::implementation {

@@ -79,7 +80,7 @@ bool AidlCameraService::registerService(::android::CameraService* cameraService)

AidlCameraService::AidlCameraService(::android::CameraService* cameraService):
      mCameraService(cameraService) {
    mVndkVersion = base::GetIntProperty("ro.vndk.version", __ANDROID_API_FUTURE__);
    mVndkVersion = getVNDKVersionFromProp(__ANDROID_API_FUTURE__);
}
ScopedAStatus AidlCameraService::getCameraCharacteristics(const std::string& in_cameraId,
                                                          SCameraMetadata* _aidl_return) {
+2 −2
Original line number Diff line number Diff line
@@ -310,8 +310,8 @@ bool areBindersEqual(const ndk::SpAIBinder& b1, const ndk::SpAIBinder& b2) {

status_t filterVndkKeys(int vndkVersion, CameraMetadata &metadata, bool isStatic) {
    if (vndkVersion == __ANDROID_API_FUTURE__) {
        // VNDK version in ro.vndk.version is a version code-name that
        // corresponds to the current version.
        // VNDK version derived from ro.board.api_level is a version code-name that
        // corresponds to the current SDK version.
        return OK;
    }
    const auto &apiLevelToKeys =
Loading