Camera: Check for invalid camera during API version calls
CTS test case 'testCameraManagerInvalidDevice' will try
to query the static characteristics of invalid devices.
The supported camera API will also get checked as
part of the current call flow. A camera device access
exception will be thrown which is not expected. The
correct exception should be "IllegalArgumentException".
BUG: 35095452
Test: run cts -m Camera -t
android.hardware.camera2.cts.CameraManagerTest#testCameraManagerInvalidDevice
-d -o --abi armeabi-v7a --disable-reboot
Change-Id:I055deea116d5f3a69ed1a47b00d820be88a87232
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index f429df8..17f6b5a 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -1883,14 +1883,7 @@
return STATUS_ERROR(ERROR_ILLEGAL_ARGUMENT, msg.string());
}
- int facing = -1;
- int deviceVersion = getDeviceVersion(id, /*out*/ &facing);
- if (facing == -1) {
- String8 msg = String8::format("Unable to get facing for camera device %s",
- id.string());
- ALOGE("%s: %s", __FUNCTION__, msg.string());
- return STATUS_ERROR(ERROR_INVALID_OPERATION, msg.string());
- }
+ int deviceVersion = getDeviceVersion(id);
switch(deviceVersion) {
case CAMERA_DEVICE_API_VERSION_1_0:
case CAMERA_DEVICE_API_VERSION_3_0: