1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| F:\Khadas_Edge_Android_Q\frameworks\av\services\camera\libcameraservice\CameraService.cpp Status CameraService::connectDevice( const sp<hardware::camera2::ICameraDeviceCallbacks>& cameraCb, const String16& cameraId, const String16& clientPackageName, int clientUid, sp<hardware::camera2::ICameraDeviceUser>* device) {
ATRACE_CALL(); Status ret = Status::ok(); String8 id = String8(cameraId); sp<CameraDeviceClient> client = nullptr; String16 clientPackageNameAdj = clientPackageName; ...... ret = connectHelper<hardware::camera2::ICameraDeviceCallbacks,CameraDeviceClient>(cameraCb, id, -1, CAMERA_HAL_API_VERSION_UNSPECIFIED, clientPackageNameAdj, clientUid, USE_CALLING_PID, API_2, false, client); ...... *device = client; return ret; }
template<class CALLBACK, class CLIENT> Status CameraService::connectHelper(const sp<CALLBACK>& cameraCb, const String8& cameraId, int api1CameraId, int halVersion, const String16& clientPackageName, int clientUid, int clientPid, apiLevel effectiveApiLevel, bool shimUpdateOnly, sp<CLIENT>& device) { binder::Status ret = binder::Status::ok();
String8 clientName8(clientPackageName); property_set("vendor.sys.camera.callprocess", clientName8.string());
int originalClientPid = 0;
ALOGI("CameraService::connect call (PID %d \"%s\", camera ID %s) for HAL version %s and " "Camera API version %d", clientPid, clientName8.string(), cameraId.string(), (halVersion == -1) ? "default" : std::to_string(halVersion).c_str(), static_cast<int>(effectiveApiLevel));
if (shouldRejectHiddenCameraConnection(cameraId)) { ALOGW("Attempting to connect to system-only camera id %s, connection rejected", cameraId.c_str()); return STATUS_ERROR_FMT(ERROR_DISCONNECTED, "No camera device with ID \"%s\" currently available", cameraId.string());
} sp<CLIENT> client = nullptr; { ...... mFlashlight->prepareDeviceOpen(cameraId);
int facing = -1; int deviceVersion = getDeviceVersion(cameraId, &facing); ...... sp<BasicClient> tmp = nullptr; if(!(ret = makeClient(this, cameraCb, clientPackageName, cameraId, api1CameraId, facing, clientPid, clientUid, getpid(), halVersion, deviceVersion, effectiveApiLevel, &tmp)).isOk()) { return ret; } client = static_cast<CLIENT*>(tmp.get()); ......
err = client->initialize(mCameraProviderManager, mMonitorTags); ....... }
device = client; return ret; }
|