/* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "Enumerator.h" #include "HalDisplay.h" #include "IPermissionsChecker.h" #include "emul/EvsEmulatedCamera.h" #include "stats/StatsCollector.h" #include #include #include #include #include #include #include #include #include // NOLINT #include namespace { using ::android::automotive::evs::V1_1::implementation::IPermissionsChecker; using ::android::base::EqualsIgnoreCase; using ::android::base::Error; using ::android::base::StringAppendF; using ::android::base::StringPrintf; using ::android::base::WriteStringToFd; using ::android::hardware::hidl_handle; using ::android::hardware::IPCThreadState; using ::android::hardware::Void; using ::android::hardware::automotive::evs::V1_0::DisplayState; using IEvsCamera_1_0 = ::android::hardware::automotive::evs::V1_0::IEvsCamera; using CameraDesc_1_0 = ::android::hardware::automotive::evs::V1_0::CameraDesc; using CameraDesc_1_1 = ::android::hardware::automotive::evs::V1_1::CameraDesc; using ::android::hardware::camera::device::V3_2::Stream; const char* kSingleIndent = "\t"; const char* kDumpOptionAll = "all"; const char* kDumpDeviceCamera = "camera"; const char* kDumpDeviceDisplay = "display"; const char* kDumpCameraCommandCurrent = "--current"; const char* kDumpCameraCommandCollected = "--collected"; const char* kDumpCameraCommandCustom = "--custom"; const char* kDumpCameraCommandCustomStart = "start"; const char* kDumpCameraCommandCustomStop = "stop"; const int kDumpCameraMinNumArgs = 4; const int kOptionDumpDeviceTypeIndex = 1; const int kOptionDumpCameraTypeIndex = 2; const int kOptionDumpCameraCommandIndex = 3; const int kOptionDumpCameraArgsStartIndex = 4; const std::regex kEmulatedCameraNamePattern("emulated/[0-9]+", std::regex_constants::icase); // Display ID 255 is reserved for the special purpose. constexpr int kExclusiveMainDisplayId = 255; // This surprisingly is not included in STL until C++20. template