Merge "Camera: require torch API support for Android Q" into qt-dev
diff --git a/camera/provider/2.4/ICameraProvider.hal b/camera/provider/2.4/ICameraProvider.hal
index 8773bc0..74c3ff1 100644
--- a/camera/provider/2.4/ICameraProvider.hal
+++ b/camera/provider/2.4/ICameraProvider.hal
@@ -140,7 +140,8 @@
* Torch API support cannot be queried. This may be due to
* a failure to initialize the camera subsystem, for example.
* @return support Whether the camera devices known to this provider
- * supports setTorchMode API or not.
+ * supports setTorchMode API or not. Devices launched with SDK
+ * level 29 or higher must return true.
*
*/
isSetTorchModeSupported() generates (Status status, bool support);
diff --git a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
index 814b88b..33d23a0 100644
--- a/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
+++ b/camera/provider/2.4/vts/functional/VtsHalCameraProviderV2_4TargetTest.cpp
@@ -272,6 +272,16 @@
ALOGW("Unexpected HAL status code %d", s);
return Status::OPERATION_NOT_SUPPORTED;
}
+
+ void getFirstApiLevel(/*out*/int32_t* outApiLevel) {
+ int32_t firstApiLevel = property_get_int32("ro.product.first_api_level", /*default*/-1);
+ if (firstApiLevel < 0) {
+ firstApiLevel = property_get_int32("ro.build.version.sdk", /*default*/-1);
+ }
+ ASSERT_GT(firstApiLevel, 0); // first_api_level must exist
+ *outApiLevel = firstApiLevel;
+ return;
+ }
}
// Test environment for camera
@@ -1484,11 +1494,8 @@
// 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);
- if (firstApiLevel < 0) {
- firstApiLevel = property_get_int32("ro.build.version.sdk", /*default*/-1);
- }
- ASSERT_GT(firstApiLevel, 0); // first_api_level must exist
+ int32_t firstApiLevel = 0;
+ getFirstApiLevel(&firstApiLevel);
// all devices with first API level == 28 and <= 1GB of RAM must set low_ram
// and thus be allowed to continue using HAL1
@@ -1509,11 +1516,19 @@
}
// Test if ICameraProvider::isTorchModeSupported returns Status::OK
+// Also if first_api_level >= Q torch API must be supported.
TEST_F(CameraHidlTest, isTorchModeSupported) {
+ constexpr int32_t API_LEVEL_Q = 29;
+ int32_t firstApiLevel = 0;
+ getFirstApiLevel(&firstApiLevel);
+
Return<void> ret;
ret = mProvider->isSetTorchModeSupported([&](auto status, bool support) {
ALOGI("isSetTorchModeSupported returns status:%d supported:%d", (int)status, support);
ASSERT_EQ(Status::OK, status);
+ if (firstApiLevel >= API_LEVEL_Q) {
+ ASSERT_EQ(true, support);
+ }
});
ASSERT_TRUE(ret.isOk());
}
diff --git a/current.txt b/current.txt
index b3be610..875be97 100644
--- a/current.txt
+++ b/current.txt
@@ -391,6 +391,7 @@
f8a19622cb0cc890913b1ef3e32b675ffb26089a09e02fef4056ebad324d2b5d android.hardware.camera.device@3.4::types
291638a1b6d4e63283e9e722ab5049d9351717ffa2b66162124f84d1aa7c2835 android.hardware.camera.metadata@3.2::types
23780340c686ee86986aa5a9755c2d8566224fed177bbb22a5ebf06be574b60c android.hardware.camera.metadata@3.3::types
+05d1ee760d81cdd2dc7a70ce0241af9fa830edae33b4be83d9bf5fffe05ddc6f android.hardware.camera.provider@2.4::ICameraProvider
da33234403ff5d60f3473711917b9948e6484a4260b5247acdafb111193a9de2 android.hardware.configstore@1.0::ISurfaceFlingerConfigs
21165b8e30c4b2d52980e4728f661420adc16e38bbe73476c06b2085be908f4c android.hardware.gnss@1.0::IGnssCallback
d702fb01dc2a0733aa820b7eb65435ee3334f75632ef880bafd2fb8803a20a58 android.hardware.gnss@1.0::IGnssMeasurementCallback