Camera: assert no HAL1 in devices launched in P+
Also remove the length check for getCameraIdList as external
camera providers are supposed to report 0 there.
Test: atest VtsHalCameraProviderV2_4Target (on marlin)
Bug: 69473913
Change-Id: I9059a699a6c46a3aac76454e7e8673d2539d0fa1
diff --git a/camera/provider/2.4/vts/functional/Android.bp b/camera/provider/2.4/vts/functional/Android.bp
index 7bc4253..08b9222 100644
--- a/camera/provider/2.4/vts/functional/Android.bp
+++ b/camera/provider/2.4/vts/functional/Android.bp
@@ -23,6 +23,7 @@
shared_libs: [
"libbinder",
"libcamera_metadata",
+ "libcutils",
"libfmq",
"libgui",
"libui",
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index e78dbe8..abd875a 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -35,6 +35,7 @@
#include <binder/MemoryHeapBase.h>
#include <CameraMetadata.h>
#include <CameraParameters.h>
+#include <cutils/properties.h>
#include <fmq/MessageQueue.h>
#include <grallocusage/GrallocUsageConversion.h>
#include <gui/BufferItemConsumer.h>
@@ -1100,6 +1101,22 @@
return cameraDeviceNames;
}
+// Test devices with first_api_level >= P does not advertise device@1.0
+TEST_F(CameraHidlTest, noHal1AfterP) {
+ constexpr int32_t HAL1_PHASE_OUT_API_LEVEL = 28;
+ int32_t firstApiLevel = property_get_int32("ro.product.first_api_level", /*default*/-1);
+ ASSERT_GT(firstApiLevel, 0); // first_api_level must exist
+
+ if (firstApiLevel >= HAL1_PHASE_OUT_API_LEVEL) {
+ hidl_vec<hidl_string> cameraDeviceNames = getCameraDeviceNames(mProvider);
+ for (const auto& name : cameraDeviceNames) {
+ int deviceVersion = getCameraDeviceVersion(name, mProviderType);
+ ASSERT_NE(deviceVersion, 0); // Must be a valid device version
+ ASSERT_NE(deviceVersion, CAMERA_DEVICE_API_VERSION_1_0); // Must not be device@1.0
+ }
+ }
+}
+
// Test if ICameraProvider::isTorchModeSupported returns Status::OK
TEST_F(CameraHidlTest, isTorchModeSupported) {
Return<void> ret;
@@ -1119,9 +1136,6 @@
ALOGI("Camera Id[%zu] is %s", i, idList[i].c_str());
}
ASSERT_EQ(Status::OK, status);
- // This is true for internal camera provider.
- // Not necessary hold for external cameras providers
- ASSERT_GT(idList.size(), 0u);
});
ASSERT_TRUE(ret.isOk());
}