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

Commit 922fa9c0 authored by Rucha Katakwar's avatar Rucha Katakwar
Browse files

Camera:Add a check for -EINVAL error code.

Add a case for -EINVAL error code so that Illegal Argument errorcode
is returned if torch strength level is not in valid range.

Bug: 221129617

Test: FlashlightTest passes on Pixel 6 device.
Change-Id: I2cac116106eb415bd7b5b4bdad5a34903852064b
parent 3c5f8aaa
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -2139,10 +2139,14 @@ Status CameraService::turnOnTorchWithStrengthLevel(const String16& cameraId, int
                    id.string());
                errorCode = ERROR_CAMERA_IN_USE;
                break;
            case -EINVAL:
                msg = String8::format("Torch strength level %d is not within the "
                        "valid range.", torchStrength);
                errorCode = ERROR_ILLEGAL_ARGUMENT;
                break;
            default:
                msg = String8::format("Changing torch strength level failed.");
                errorCode = ERROR_INVALID_OPERATION;

        }
        ALOGE("%s: %s", __FUNCTION__, msg.string());
        return STATUS_ERROR(errorCode, msg.string());