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

Commit 3ce137c4 authored by Avichal Rakesh's avatar Avichal Rakesh Committed by Android (Google) Code Review
Browse files

Merge "cameraservice: Allow AIDL Devices to not support sensor readout timestamp" into main

parents 65321074 d6b51642
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ cc_defaults {
        "android.frameworks.cameraservice.device-V2-ndk",
        "android.hardware.camera.common-V1-ndk",
        "android.hardware.camera.device-V3-ndk",
        "android.hardware.camera.metadata-V2-ndk",
        "android.hardware.camera.metadata-V3-ndk",
        "android.hardware.camera.provider@2.4",
        "android.hardware.camera.provider@2.5",
        "android.hardware.camera.provider@2.6",
+5 −10
Original line number Diff line number Diff line
@@ -1807,18 +1807,13 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::addReadoutTimestampTa
    auto& c = mCameraCharacteristics;

    auto entry = c.find(ANDROID_SENSOR_READOUT_TIMESTAMP);
    if (entry.count != 0) {
        ALOGE("%s: CameraCharacteristics must not contain ANDROID_SENSOR_READOUT_TIMESTAMP!",
                __FUNCTION__);
    }

    uint8_t readoutTimestamp = ANDROID_SENSOR_READOUT_TIMESTAMP_NOT_SUPPORTED;
    if (readoutTimestampSupported) {
        readoutTimestamp = ANDROID_SENSOR_READOUT_TIMESTAMP_HARDWARE;
    if (entry.count == 0) {
        uint8_t defaultReadoutTimestamp = readoutTimestampSupported ?
                                          ANDROID_SENSOR_READOUT_TIMESTAMP_HARDWARE :
                                          ANDROID_SENSOR_READOUT_TIMESTAMP_NOT_SUPPORTED;
        res = c.update(ANDROID_SENSOR_READOUT_TIMESTAMP, &defaultReadoutTimestamp, 1);
    }

    res = c.update(ANDROID_SENSOR_READOUT_TIMESTAMP, &readoutTimestamp, 1);

    return res;
}

+13 −2
Original line number Diff line number Diff line
@@ -339,6 +339,16 @@ status_t AidlCamera3Device::initialize(sp<CameraProviderManager> manager,

    mBatchSizeLimitEnabled = (deviceVersion >= CAMERA_DEVICE_API_VERSION_1_2);

    camera_metadata_entry readoutSupported = mDeviceInfo.find(ANDROID_SENSOR_READOUT_TIMESTAMP);
    if (readoutSupported.count == 0) {
        ALOGW("%s: Could not find value corresponding to ANDROID_SENSOR_READOUT_TIMESTAMP. "
              "Assuming true.", __FUNCTION__);
        mSensorReadoutTimestampSupported = true;
    } else {
        mSensorReadoutTimestampSupported =
                readoutSupported.data.u8[0] == ANDROID_SENSOR_READOUT_TIMESTAMP_HARDWARE;
    }

    return initializeCommonLocked();
}

@@ -452,7 +462,7 @@ status_t AidlCamera3Device::initialize(sp<CameraProviderManager> manager,
        mOverrideToPortrait, mActivePhysicalId}, mResultMetadataQueue
    };
    for (const auto& msg : msgs) {
        camera3::notify(states, msg);
        camera3::notify(states, msg, mSensorReadoutTimestampSupported);
    }
    return ::ndk::ScopedAStatus::ok();

@@ -623,7 +633,8 @@ status_t AidlCamera3Device::switchToOffline(
            mDistortionMappers, mZoomRatioMappers, mRotateAndCropMappers);

    *session = new AidlCamera3OfflineSession(mId, inputStream, offlineStreamSet,
            std::move(bufferRecords), offlineReqs, offlineStates, offlineSession);
                                             std::move(bufferRecords), offlineReqs, offlineStates,
                                             offlineSession, mSensorReadoutTimestampSupported);

    // Delete all streams that has been transferred to offline session
    Mutex::Autolock l(mLock);
+3 −0
Original line number Diff line number Diff line
@@ -289,6 +289,9 @@ class AidlCamera3Device :
    // capture requests.
    bool mBatchSizeLimitEnabled = false;

    // Whether the HAL supports reporting sensor readout timestamp
    bool mSensorReadoutTimestampSupported = true;

}; // class AidlCamera3Device

}; // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ status_t AidlCamera3OfflineSession::initialize(wp<NotificationListener> listener
        /*overrideToPortrait*/false, activePhysicalId}, mResultMetadataQueue
    };
    for (const auto& msg : msgs) {
        camera3::notify(states, msg);
        camera3::notify(states, msg, mSensorReadoutTimestampSupported);
    }
    return ::ndk::ScopedAStatus::ok();
}
Loading