Loading camera/Camera.cpp +31 −3 Original line number Original line Diff line number Diff line Loading @@ -98,9 +98,37 @@ status_t Camera::connectLegacy(int cameraId, int halVersion, c->mStatus = NO_ERROR; c->mStatus = NO_ERROR; camera = c; camera = c; } else { } else { switch(ret.serviceSpecificErrorCode()) { case hardware::ICameraService::ERROR_DISCONNECTED: status = -ENODEV; break; case hardware::ICameraService::ERROR_CAMERA_IN_USE: status = -EBUSY; break; case hardware::ICameraService::ERROR_INVALID_OPERATION: status = -EINVAL; break; case hardware::ICameraService::ERROR_MAX_CAMERAS_IN_USE: status = -EUSERS; break; case hardware::ICameraService::ERROR_ILLEGAL_ARGUMENT: status = BAD_VALUE; break; case hardware::ICameraService::ERROR_DEPRECATED_HAL: status = -EOPNOTSUPP; break; case hardware::ICameraService::ERROR_DISABLED: status = -EACCES; break; case hardware::ICameraService::ERROR_PERMISSION_DENIED: status = PERMISSION_DENIED; break; default: status = -EINVAL; ALOGW("An error occurred while connecting to camera %d: %s", cameraId, ALOGW("An error occurred while connecting to camera %d: %s", cameraId, (cs != nullptr) ? "Service not available" : ret.toString8().string()); (cs != nullptr) ? "Service not available" : ret.toString8().string()); status = -EINVAL; break; } c.clear(); c.clear(); } } return status; return status; Loading services/camera/libcameraservice/CameraService.h +24 −3 Original line number Original line Diff line number Diff line Loading @@ -909,10 +909,31 @@ binder::Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const if ((err = client->initialize(mModule)) != OK) { if ((err = client->initialize(mModule)) != OK) { ALOGE("%s: Could not initialize client from HAL module.", __FUNCTION__); ALOGE("%s: Could not initialize client from HAL module.", __FUNCTION__); // Errors could be from the HAL module open call or from AppOpsManager switch(err) { case BAD_VALUE: return STATUS_ERROR_FMT(ERROR_ILLEGAL_ARGUMENT, "Illegal argument to HAL module for camera \"%s\"", cameraId.string()); case -EBUSY: return STATUS_ERROR_FMT(ERROR_CAMERA_IN_USE, "Camera \"%s\" is already open", cameraId.string()); case -EUSERS: return STATUS_ERROR_FMT(ERROR_MAX_CAMERAS_IN_USE, "Too many cameras already open, cannot open camera \"%s\"", cameraId.string()); case PERMISSION_DENIED: return STATUS_ERROR_FMT(ERROR_PERMISSION_DENIED, "No permission to open camera \"%s\"", cameraId.string()); case -EACCES: return STATUS_ERROR_FMT(ERROR_DISABLED, "Camera \"%s\" disabled by policy", cameraId.string()); case -ENODEV: default: return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION, return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION, "Failed to initialize camera \"%s\": %s (%d)", cameraId.string(), "Failed to initialize camera \"%s\": %s (%d)", cameraId.string(), strerror(-err), err); strerror(-err), err); } } } // Update shim paremeters for legacy clients // Update shim paremeters for legacy clients if (effectiveApiLevel == API_1) { if (effectiveApiLevel == API_1) { Loading Loading
camera/Camera.cpp +31 −3 Original line number Original line Diff line number Diff line Loading @@ -98,9 +98,37 @@ status_t Camera::connectLegacy(int cameraId, int halVersion, c->mStatus = NO_ERROR; c->mStatus = NO_ERROR; camera = c; camera = c; } else { } else { switch(ret.serviceSpecificErrorCode()) { case hardware::ICameraService::ERROR_DISCONNECTED: status = -ENODEV; break; case hardware::ICameraService::ERROR_CAMERA_IN_USE: status = -EBUSY; break; case hardware::ICameraService::ERROR_INVALID_OPERATION: status = -EINVAL; break; case hardware::ICameraService::ERROR_MAX_CAMERAS_IN_USE: status = -EUSERS; break; case hardware::ICameraService::ERROR_ILLEGAL_ARGUMENT: status = BAD_VALUE; break; case hardware::ICameraService::ERROR_DEPRECATED_HAL: status = -EOPNOTSUPP; break; case hardware::ICameraService::ERROR_DISABLED: status = -EACCES; break; case hardware::ICameraService::ERROR_PERMISSION_DENIED: status = PERMISSION_DENIED; break; default: status = -EINVAL; ALOGW("An error occurred while connecting to camera %d: %s", cameraId, ALOGW("An error occurred while connecting to camera %d: %s", cameraId, (cs != nullptr) ? "Service not available" : ret.toString8().string()); (cs != nullptr) ? "Service not available" : ret.toString8().string()); status = -EINVAL; break; } c.clear(); c.clear(); } } return status; return status; Loading
services/camera/libcameraservice/CameraService.h +24 −3 Original line number Original line Diff line number Diff line Loading @@ -909,10 +909,31 @@ binder::Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const if ((err = client->initialize(mModule)) != OK) { if ((err = client->initialize(mModule)) != OK) { ALOGE("%s: Could not initialize client from HAL module.", __FUNCTION__); ALOGE("%s: Could not initialize client from HAL module.", __FUNCTION__); // Errors could be from the HAL module open call or from AppOpsManager switch(err) { case BAD_VALUE: return STATUS_ERROR_FMT(ERROR_ILLEGAL_ARGUMENT, "Illegal argument to HAL module for camera \"%s\"", cameraId.string()); case -EBUSY: return STATUS_ERROR_FMT(ERROR_CAMERA_IN_USE, "Camera \"%s\" is already open", cameraId.string()); case -EUSERS: return STATUS_ERROR_FMT(ERROR_MAX_CAMERAS_IN_USE, "Too many cameras already open, cannot open camera \"%s\"", cameraId.string()); case PERMISSION_DENIED: return STATUS_ERROR_FMT(ERROR_PERMISSION_DENIED, "No permission to open camera \"%s\"", cameraId.string()); case -EACCES: return STATUS_ERROR_FMT(ERROR_DISABLED, "Camera \"%s\" disabled by policy", cameraId.string()); case -ENODEV: default: return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION, return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION, "Failed to initialize camera \"%s\": %s (%d)", cameraId.string(), "Failed to initialize camera \"%s\": %s (%d)", cameraId.string(), strerror(-err), err); strerror(-err), err); } } } // Update shim paremeters for legacy clients // Update shim paremeters for legacy clients if (effectiveApiLevel == API_1) { if (effectiveApiLevel == API_1) { Loading