diff options
author | Avichal Rakesh <arakesh@google.com> | 2022-05-23 21:33:06 +0000 |
---|---|---|
committer | Avichal Rakesh <arakesh@google.com> | 2022-05-24 21:07:53 +0000 |
commit | 9f352766a9a68c6d9158426b7460da7d65bc1ed8 (patch) | |
tree | 7f2f0d20f414f3d1cf4b5eeed031b97e54784176 /camera | |
parent | 4bf91c7e38f72a961785126519371e278e2f6345 (diff) |
Camera VTS: remove duplicate function in anonymous namespace
The anonymous namespace in camera_aidl_test.cpp contained a buggy
implementation of `matchDeviceName` can was being called into by a few
tests. This CL removes the buggy implementation and fixes the faulty
calls to call into the correct function.
Bug: 233252432
Bug: 233221359
Test: atest VtsAidlHalCameraProvider_TargetTest
Change-Id: Icfe9bbc75e38d4d23bdcf64a048120708045b639
Diffstat (limited to 'camera')
-rw-r--r-- | camera/provider/aidl/vts/camera_aidl_test.cpp | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp index fd83e372e8..c11fc0cd2b 100644 --- a/camera/provider/aidl/vts/camera_aidl_test.cpp +++ b/camera/provider/aidl/vts/camera_aidl_test.cpp @@ -55,26 +55,6 @@ using ::ndk::ScopedAStatus; using ::ndk::SpAIBinder; namespace { -bool matchDeviceName(const std::string& deviceName, const std::string& providerType, - std::string* deviceVersion, std::string* cameraId) { - // expected format: device@<major>.<minor>/<type>/<id> - std::stringstream pattern; - pattern << "device@[0-9]+\\.[0-9]+/" << providerType << "/(.+)"; - std::regex e(pattern.str()); - - std::smatch sm; - if (std::regex_match(deviceName, sm, e)) { - if (deviceVersion != nullptr) { - *deviceVersion = sm[1]; - } - if (cameraId != nullptr) { - *cameraId = sm[2]; - } - return true; - } - return false; -} - bool parseProviderName(const std::string& serviceDescriptor, std::string* type /*out*/, uint32_t* id /*out*/) { if (!type || !id) { @@ -498,13 +478,11 @@ void CameraAidlTest::allocateGraphicBuffer(uint32_t width, uint32_t height, uint bool CameraAidlTest::matchDeviceName(const std::string& deviceName, const std::string& providerType, std::string* deviceVersion, std::string* cameraId) { - // "device@<version>/legacy/<id>" - std::string pattern; - pattern.append("device@([0-9]+\\.[0-9]+)/"); - pattern.append(providerType); - pattern.append("/(.+)"); + // expected format: device@<major>.<minor>/<type>/<id> + std::stringstream pattern; + pattern << "device@([0-9]+\\.[0-9]+)/" << providerType << "/(.+)"; + std::regex e(pattern.str()); - std::regex e(pattern); std::smatch sm; if (std::regex_match(deviceName, sm, e)) { if (deviceVersion != nullptr) { @@ -1160,7 +1138,7 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata( } std::string version, cameraId; - ASSERT_TRUE(::matchDeviceName(cameraName, mProviderType, &version, &cameraId)); + ASSERT_TRUE(matchDeviceName(cameraName, mProviderType, &version, &cameraId)); std::unordered_set<std::string> physicalIds; rc = getPhysicalCameraIds(metadata, &physicalIds); ASSERT_TRUE(isUltraHighResCamera || Status::OK == rc); @@ -1192,7 +1170,7 @@ void CameraAidlTest::verifyLogicalOrUltraHighResCameraMetadata( SystemCameraKind physSystemCameraKind = SystemCameraKind::PUBLIC; for (auto& deviceName : deviceNames) { std::string publicVersion, publicId; - ASSERT_TRUE(::matchDeviceName(deviceName, mProviderType, &publicVersion, &publicId)); + ASSERT_TRUE(matchDeviceName(deviceName, mProviderType, &publicVersion, &publicId)); if (physicalId == publicId) { isPublicId = true; fullPublicId = deviceName; |