Loading services/camera/virtualcamera/TEST_MAPPING +8 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,14 @@ "postsubmit": [ { "name": "virtual_camera_tests" }, { "name": "CtsVirtualDevicesCameraTestCases", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" } ] } ] } services/camera/virtualcamera/VirtualCameraDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ class VirtualCameraDevice // "device@{major}.{minor}/virtual/{numerical_id}" std::string getCameraName() const; uint32_t getCameraId() const { return mCameraId; } private: const uint32_t mCameraId; const std::shared_ptr< Loading services/camera/virtualcamera/VirtualCameraService.cc +21 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,27 @@ ndk::ScopedAStatus VirtualCameraService::unregisterCamera( return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus VirtualCameraService::getCameraId( const ::ndk::SpAIBinder& token, int32_t* _aidl_return) { if (_aidl_return == nullptr) { return ndk::ScopedAStatus::fromServiceSpecificError( Status::EX_ILLEGAL_ARGUMENT); } auto camera = getCamera(token); if (camera == nullptr) { ALOGE( "Attempt to get camera id corresponding to unknown binder token: " "0x%" PRIxPTR, reinterpret_cast<uintptr_t>(token.get())); return ndk::ScopedAStatus::ok(); } *_aidl_return = camera->getCameraId(); return ndk::ScopedAStatus::ok(); } std::shared_ptr<VirtualCameraDevice> VirtualCameraService::getCamera( const ::ndk::SpAIBinder& token) { if (token == nullptr) { Loading services/camera/virtualcamera/VirtualCameraService.h +4 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ class VirtualCameraService ndk::ScopedAStatus unregisterCamera(const ::ndk::SpAIBinder& token) override EXCLUDES(mLock); // Returns the camera id corresponding to the binder token. ndk::ScopedAStatus getCameraId( const ::ndk::SpAIBinder& token, int32_t* _aidl_return) override EXCLUDES(mLock); // Returns VirtualCameraDevice corresponding to binder token or nullptr if // there's no camera asociated with the token. std::shared_ptr<VirtualCameraDevice> getCamera(const ::ndk::SpAIBinder& token) Loading services/camera/virtualcamera/aidl/android/companion/virtualcamera/IVirtualCameraService.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,10 @@ interface IVirtualCameraService { * be visible to the camera framework anymore. */ void unregisterCamera(in IBinder token); /** * Returns the camera id for a given binder token. Note that this id corresponds to the id of * the camera device in the camera framework. */ int getCameraId(in IBinder token); } Loading
services/camera/virtualcamera/TEST_MAPPING +8 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,14 @@ "postsubmit": [ { "name": "virtual_camera_tests" }, { "name": "CtsVirtualDevicesCameraTestCases", "options": [ { "exclude-annotation": "androidx.test.filters.FlakyTest" } ] } ] }
services/camera/virtualcamera/VirtualCameraDevice.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,6 +95,8 @@ class VirtualCameraDevice // "device@{major}.{minor}/virtual/{numerical_id}" std::string getCameraName() const; uint32_t getCameraId() const { return mCameraId; } private: const uint32_t mCameraId; const std::shared_ptr< Loading
services/camera/virtualcamera/VirtualCameraService.cc +21 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,27 @@ ndk::ScopedAStatus VirtualCameraService::unregisterCamera( return ndk::ScopedAStatus::ok(); } ndk::ScopedAStatus VirtualCameraService::getCameraId( const ::ndk::SpAIBinder& token, int32_t* _aidl_return) { if (_aidl_return == nullptr) { return ndk::ScopedAStatus::fromServiceSpecificError( Status::EX_ILLEGAL_ARGUMENT); } auto camera = getCamera(token); if (camera == nullptr) { ALOGE( "Attempt to get camera id corresponding to unknown binder token: " "0x%" PRIxPTR, reinterpret_cast<uintptr_t>(token.get())); return ndk::ScopedAStatus::ok(); } *_aidl_return = camera->getCameraId(); return ndk::ScopedAStatus::ok(); } std::shared_ptr<VirtualCameraDevice> VirtualCameraService::getCamera( const ::ndk::SpAIBinder& token) { if (token == nullptr) { Loading
services/camera/virtualcamera/VirtualCameraService.h +4 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,10 @@ class VirtualCameraService ndk::ScopedAStatus unregisterCamera(const ::ndk::SpAIBinder& token) override EXCLUDES(mLock); // Returns the camera id corresponding to the binder token. ndk::ScopedAStatus getCameraId( const ::ndk::SpAIBinder& token, int32_t* _aidl_return) override EXCLUDES(mLock); // Returns VirtualCameraDevice corresponding to binder token or nullptr if // there's no camera asociated with the token. std::shared_ptr<VirtualCameraDevice> getCamera(const ::ndk::SpAIBinder& token) Loading
services/camera/virtualcamera/aidl/android/companion/virtualcamera/IVirtualCameraService.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -35,4 +35,10 @@ interface IVirtualCameraService { * be visible to the camera framework anymore. */ void unregisterCamera(in IBinder token); /** * Returns the camera id for a given binder token. Note that this id corresponds to the id of * the camera device in the camera framework. */ int getCameraId(in IBinder token); }