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

Commit 28ad2eae authored by Emilian Peev's avatar Emilian Peev
Browse files

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
parent e1c8daf1
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -1883,14 +1883,7 @@ Status CameraService::supportsCameraApi(const String16& cameraId, int apiVersion
            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: