blob: b5b07f04b62012d325a0da4024e589fb93b92b69 [file] [log] [blame]
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +01001/*
Biswarup Pal6152a302023-12-19 12:44:09 +00002 * Copyright 2023 The Android Open Source Project
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +01003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17// #define LOG_NDEBUG 0
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010018#define LOG_TAG "VirtualCameraService"
19#include "VirtualCameraService.h"
20
Jan Sebechlebsky773c0142024-03-25 12:17:05 +010021#include <algorithm>
Jan Sebechlebskyb36090e2024-04-11 09:19:33 +020022#include <array>
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010023#include <cinttypes>
24#include <cstdint>
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010025#include <memory>
26#include <mutex>
Jan Sebechlebsky773c0142024-03-25 12:17:05 +010027#include <optional>
28#include <regex>
29#include <variant>
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010030
31#include "VirtualCameraDevice.h"
32#include "VirtualCameraProvider.h"
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +010033#include "aidl/android/companion/virtualcamera/Format.h"
Jan Sebechlebsky773c0142024-03-25 12:17:05 +010034#include "aidl/android/companion/virtualcamera/LensFacing.h"
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +010035#include "aidl/android/companion/virtualcamera/VirtualCameraConfiguration.h"
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010036#include "android/binder_auto_utils.h"
37#include "android/binder_libbinder.h"
Jan Sebechlebsky773c0142024-03-25 12:17:05 +010038#include "android/binder_status.h"
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010039#include "binder/Status.h"
Jan Sebechlebskyb36090e2024-04-11 09:19:33 +020040#include "fmt/format.h"
41#include "util/EglDisplayContext.h"
42#include "util/EglUtil.h"
Jan Sebechlebskyde6f16f2023-11-29 09:27:36 +010043#include "util/Permissions.h"
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +010044#include "util/Util.h"
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010045
46using ::android::binder::Status;
47
48namespace android {
49namespace companion {
50namespace virtualcamera {
51
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +010052using ::aidl::android::companion::virtualcamera::Format;
Biswarup Pal112458f2023-12-28 19:50:17 +000053using ::aidl::android::companion::virtualcamera::LensFacing;
Biswarup Pal6152a302023-12-19 12:44:09 +000054using ::aidl::android::companion::virtualcamera::SensorOrientation;
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +010055using ::aidl::android::companion::virtualcamera::SupportedStreamConfiguration;
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010056using ::aidl::android::companion::virtualcamera::VirtualCameraConfiguration;
57
Marvin Ramina8196132024-03-15 15:55:22 +000058// TODO(b/301023410) Make camera id range configurable / dynamic
59// based on already registered devices.
60std::atomic_int VirtualCameraService::sNextId{1000};
61
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010062namespace {
63
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +010064constexpr int kVgaWidth = 640;
65constexpr int kVgaHeight = 480;
Biswarup Pal6152a302023-12-19 12:44:09 +000066constexpr int kMaxFps = 60;
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010067constexpr char kEnableTestCameraCmd[] = "enable_test_camera";
68constexpr char kDisableTestCameraCmd[] = "disable_test_camera";
Jan Sebechlebsky773c0142024-03-25 12:17:05 +010069constexpr char kHelp[] = "help";
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010070constexpr char kShellCmdHelp[] = R"(
Jan Sebechlebsky773c0142024-03-25 12:17:05 +010071Usage:
72 cmd virtual_camera command [--option=value]
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010073Available commands:
74 * enable_test_camera
Jan Sebechlebsky773c0142024-03-25 12:17:05 +010075 Options:
76 --camera_id=(ID) - override numerical ID for test camera instance
77 --lens_facing=(front|back|external) - specifies lens facing for test camera instance
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010078 * disable_test_camera
79)";
Jan Sebechlebskyde6f16f2023-11-29 09:27:36 +010080constexpr char kCreateVirtualDevicePermission[] =
81 "android.permission.CREATE_VIRTUAL_DEVICE";
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +010082
Jan Sebechlebskyb36090e2024-04-11 09:19:33 +020083constexpr std::array<const char*, 3> kRequiredEglExtensions = {
84 "GL_OES_EGL_image_external",
85 "GL_OES_EGL_image_external_essl3",
86 "GL_EXT_YUV_target",
87};
88
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +010089ndk::ScopedAStatus validateConfiguration(
90 const VirtualCameraConfiguration& configuration) {
91 if (configuration.supportedStreamConfigs.empty()) {
92 ALOGE("%s: No supported input configuration specified", __func__);
93 return ndk::ScopedAStatus::fromServiceSpecificError(
94 Status::EX_ILLEGAL_ARGUMENT);
95 }
96
97 for (const SupportedStreamConfiguration& config :
98 configuration.supportedStreamConfigs) {
99 if (!isFormatSupportedForInput(config.width, config.height,
Biswarup Pal6152a302023-12-19 12:44:09 +0000100 config.pixelFormat, config.maxFps)) {
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +0100101 ALOGE("%s: Requested unsupported input format: %d x %d (%d)", __func__,
102 config.width, config.height, static_cast<int>(config.pixelFormat));
103 return ndk::ScopedAStatus::fromServiceSpecificError(
104 Status::EX_ILLEGAL_ARGUMENT);
105 }
106 }
Biswarup Pal6152a302023-12-19 12:44:09 +0000107
108 if (configuration.sensorOrientation != SensorOrientation::ORIENTATION_0 &&
109 configuration.sensorOrientation != SensorOrientation::ORIENTATION_90 &&
110 configuration.sensorOrientation != SensorOrientation::ORIENTATION_180 &&
111 configuration.sensorOrientation != SensorOrientation::ORIENTATION_270) {
112 return ndk::ScopedAStatus::fromServiceSpecificError(
113 Status::EX_ILLEGAL_ARGUMENT);
114 }
115
Biswarup Pal112458f2023-12-28 19:50:17 +0000116 if (configuration.lensFacing != LensFacing::FRONT &&
117 configuration.lensFacing != LensFacing::BACK &&
118 configuration.lensFacing != LensFacing::EXTERNAL) {
119 return ndk::ScopedAStatus::fromServiceSpecificError(
120 Status::EX_ILLEGAL_ARGUMENT);
121 }
122
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +0100123 return ndk::ScopedAStatus::ok();
124}
125
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100126enum class Command {
127 ENABLE_TEST_CAMERA,
128 DISABLE_TEST_CAMERA,
129 HELP,
130};
131
132struct CommandWithOptions {
133 Command command;
134 std::map<std::string, std::string> optionToValueMap;
135};
136
137std::optional<int> parseInt(const std::string& s) {
138 if (!std::all_of(s.begin(), s.end(), [](char c) { return std::isdigit(c); })) {
139 return std::nullopt;
140 }
141 int ret = atoi(s.c_str());
142 return ret > 0 ? std::optional(ret) : std::nullopt;
143}
144
145std::optional<LensFacing> parseLensFacing(const std::string& s) {
146 static const std::map<std::string, LensFacing> strToLensFacing{
147 {"front", LensFacing::FRONT},
148 {"back", LensFacing::BACK},
149 {"external", LensFacing::EXTERNAL}};
150 auto it = strToLensFacing.find(s);
151 return it == strToLensFacing.end() ? std::nullopt : std::optional(it->second);
152}
153
154std::variant<CommandWithOptions, std::string> parseCommand(
155 const char** args, const uint32_t numArgs) {
156 static const std::regex optionRegex("^--(\\w+)(?:=(.+))?$");
157 static const std::map<std::string, Command> strToCommand{
158 {kHelp, Command::HELP},
159 {kEnableTestCameraCmd, Command::ENABLE_TEST_CAMERA},
160 {kDisableTestCameraCmd, Command::DISABLE_TEST_CAMERA}};
161
162 if (numArgs < 1) {
163 return CommandWithOptions{.command = Command::HELP};
164 }
165
166 // We interpret the first argument as command;
167 auto it = strToCommand.find(args[0]);
168 if (it == strToCommand.end()) {
169 return "Unknown command: " + std::string(args[0]);
170 }
171
172 CommandWithOptions cmd{.command = it->second};
173
174 for (int i = 1; i < numArgs; i++) {
175 std::cmatch cm;
176 if (!std::regex_match(args[i], cm, optionRegex)) {
177 return "Not an option: " + std::string(args[i]);
178 }
179
180 cmd.optionToValueMap[cm[1]] = cm[2];
181 }
182
183 return cmd;
184};
185
Jan Sebechlebskyb36090e2024-04-11 09:19:33 +0200186ndk::ScopedAStatus verifyRequiredEglExtensions() {
187 EglDisplayContext context;
188 for (const char* eglExtension : kRequiredEglExtensions) {
189 if (!isGlExtensionSupported(eglExtension)) {
190 ALOGE("%s not supported", eglExtension);
191 return ndk::ScopedAStatus::fromExceptionCodeWithMessage(
192 EX_UNSUPPORTED_OPERATION,
193 fmt::format(
194 "Cannot create virtual camera, because required EGL extension {} "
195 "is not supported on this system",
196 eglExtension)
197 .c_str());
198 }
199 }
200 return ndk::ScopedAStatus::ok();
201}
202
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100203} // namespace
204
205VirtualCameraService::VirtualCameraService(
Jan Sebechlebskyde6f16f2023-11-29 09:27:36 +0100206 std::shared_ptr<VirtualCameraProvider> virtualCameraProvider,
207 const PermissionsProxy& permissionProxy)
208 : mVirtualCameraProvider(virtualCameraProvider),
209 mPermissionProxy(permissionProxy) {
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100210}
211
212ndk::ScopedAStatus VirtualCameraService::registerCamera(
213 const ::ndk::SpAIBinder& token,
Biswarup Pal37a75182024-01-16 15:53:35 +0000214 const VirtualCameraConfiguration& configuration, const int32_t deviceId,
215 bool* _aidl_return) {
216 return registerCamera(token, configuration, sNextId++, deviceId, _aidl_return);
Marvin Ramina8196132024-03-15 15:55:22 +0000217}
218
219ndk::ScopedAStatus VirtualCameraService::registerCamera(
220 const ::ndk::SpAIBinder& token,
221 const VirtualCameraConfiguration& configuration, const int cameraId,
Biswarup Pal37a75182024-01-16 15:53:35 +0000222 const int32_t deviceId, bool* _aidl_return) {
Jan Sebechlebskyde6f16f2023-11-29 09:27:36 +0100223 if (!mPermissionProxy.checkCallingPermission(kCreateVirtualDevicePermission)) {
224 ALOGE("%s: caller (pid %d, uid %d) doesn't hold %s permission", __func__,
225 getpid(), getuid(), kCreateVirtualDevicePermission);
226 return ndk::ScopedAStatus::fromExceptionCode(EX_SECURITY);
227 }
228
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100229 if (_aidl_return == nullptr) {
230 return ndk::ScopedAStatus::fromServiceSpecificError(
231 Status::EX_ILLEGAL_ARGUMENT);
232 }
Jan Sebechlebskyde6f16f2023-11-29 09:27:36 +0100233
Jan Sebechlebskyb36090e2024-04-11 09:19:33 +0200234 if (mVerifyEglExtensions) {
235 auto status = verifyRequiredEglExtensions();
236 if (!status.isOk()) {
237 *_aidl_return = false;
238 return status;
239 }
240 }
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100241
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +0100242 auto status = validateConfiguration(configuration);
243 if (!status.isOk()) {
244 *_aidl_return = false;
245 return status;
246 }
247
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100248 std::lock_guard lock(mLock);
249 if (mTokenToCameraName.find(token) != mTokenToCameraName.end()) {
250 ALOGE(
251 "Attempt to register camera corresponding to already registered binder "
252 "token: "
253 "0x%" PRIxPTR,
254 reinterpret_cast<uintptr_t>(token.get()));
255 *_aidl_return = false;
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +0100256 return ndk::ScopedAStatus::ok();
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100257 }
258
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100259 std::shared_ptr<VirtualCameraDevice> camera =
Biswarup Pal37a75182024-01-16 15:53:35 +0000260 mVirtualCameraProvider->createCamera(configuration, cameraId, deviceId);
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100261 if (camera == nullptr) {
262 ALOGE("Failed to create camera for binder token 0x%" PRIxPTR,
263 reinterpret_cast<uintptr_t>(token.get()));
264 *_aidl_return = false;
265 return ndk::ScopedAStatus::fromServiceSpecificError(
266 Status::EX_SERVICE_SPECIFIC);
267 }
268
269 mTokenToCameraName[token] = camera->getCameraName();
Jan Sebechlebskyb36090e2024-04-11 09:19:33 +0200270 *_aidl_return = true;
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100271 return ndk::ScopedAStatus::ok();
272}
273
274ndk::ScopedAStatus VirtualCameraService::unregisterCamera(
275 const ::ndk::SpAIBinder& token) {
Jan Sebechlebskyde6f16f2023-11-29 09:27:36 +0100276 if (!mPermissionProxy.checkCallingPermission(kCreateVirtualDevicePermission)) {
277 ALOGE("%s: caller (pid %d, uid %d) doesn't hold %s permission", __func__,
278 getpid(), getuid(), kCreateVirtualDevicePermission);
279 return ndk::ScopedAStatus::fromExceptionCode(EX_SECURITY);
280 }
281
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100282 std::lock_guard lock(mLock);
283
284 auto it = mTokenToCameraName.find(token);
285 if (it == mTokenToCameraName.end()) {
286 ALOGE(
287 "Attempt to unregister camera corresponding to unknown binder token: "
288 "0x%" PRIxPTR,
289 reinterpret_cast<uintptr_t>(token.get()));
290 return ndk::ScopedAStatus::ok();
291 }
292
293 mVirtualCameraProvider->removeCamera(it->second);
294
Tony Guo6cbe11b2024-03-17 02:34:23 +0000295 mTokenToCameraName.erase(it);
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100296 return ndk::ScopedAStatus::ok();
297}
298
Biswarup Pal68137fc2023-11-24 18:06:54 +0000299ndk::ScopedAStatus VirtualCameraService::getCameraId(
Marvin Ramina8196132024-03-15 15:55:22 +0000300 const ::ndk::SpAIBinder& token, int32_t* _aidl_return) {
Jan Sebechlebskyde6f16f2023-11-29 09:27:36 +0100301 if (!mPermissionProxy.checkCallingPermission(kCreateVirtualDevicePermission)) {
302 ALOGE("%s: caller (pid %d, uid %d) doesn't hold %s permission", __func__,
303 getpid(), getuid(), kCreateVirtualDevicePermission);
304 return ndk::ScopedAStatus::fromExceptionCode(EX_SECURITY);
305 }
306
Biswarup Pal68137fc2023-11-24 18:06:54 +0000307 if (_aidl_return == nullptr) {
308 return ndk::ScopedAStatus::fromServiceSpecificError(
Marvin Ramina8196132024-03-15 15:55:22 +0000309 Status::EX_ILLEGAL_ARGUMENT);
Biswarup Pal68137fc2023-11-24 18:06:54 +0000310 }
311
312 auto camera = getCamera(token);
313 if (camera == nullptr) {
314 ALOGE(
315 "Attempt to get camera id corresponding to unknown binder token: "
316 "0x%" PRIxPTR,
317 reinterpret_cast<uintptr_t>(token.get()));
318 return ndk::ScopedAStatus::ok();
319 }
320
321 *_aidl_return = camera->getCameraId();
322
323 return ndk::ScopedAStatus::ok();
324}
325
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100326std::shared_ptr<VirtualCameraDevice> VirtualCameraService::getCamera(
327 const ::ndk::SpAIBinder& token) {
328 if (token == nullptr) {
329 return nullptr;
330 }
331
332 std::lock_guard lock(mLock);
333 auto it = mTokenToCameraName.find(token);
334 if (it == mTokenToCameraName.end()) {
335 return nullptr;
336 }
337
338 return mVirtualCameraProvider->getCamera(it->second);
339}
340
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100341binder_status_t VirtualCameraService::handleShellCommand(int, int out, int err,
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100342 const char** args,
343 uint32_t numArgs) {
344 if (numArgs <= 0) {
345 dprintf(out, kShellCmdHelp);
Jan Sebechlebsky76d7e212023-11-28 14:10:25 +0100346 fsync(out);
347 return STATUS_OK;
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100348 }
349
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100350 auto isNullptr = [](const char* ptr) { return ptr == nullptr; };
351 if (args == nullptr || std::any_of(args, args + numArgs, isNullptr)) {
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100352 return STATUS_BAD_VALUE;
353 }
Marvin Ramina8196132024-03-15 15:55:22 +0000354
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100355 std::variant<CommandWithOptions, std::string> cmdOrErrorMessage =
356 parseCommand(args, numArgs);
357 if (std::holds_alternative<std::string>(cmdOrErrorMessage)) {
358 dprintf(err, "Error: %s\n",
359 std::get<std::string>(cmdOrErrorMessage).c_str());
360 return STATUS_BAD_VALUE;
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100361 }
362
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100363 const CommandWithOptions& cmd =
364 std::get<CommandWithOptions>(cmdOrErrorMessage);
365 binder_status_t status = STATUS_OK;
366 switch (cmd.command) {
367 case Command::HELP:
368 dprintf(out, kShellCmdHelp);
369 break;
370 case Command::ENABLE_TEST_CAMERA:
371 status = enableTestCameraCmd(out, err, cmd.optionToValueMap);
372 break;
373 case Command::DISABLE_TEST_CAMERA:
374 disableTestCameraCmd(out);
375 break;
376 }
377
378 fsync(err);
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100379 fsync(out);
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100380 return status;
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100381}
382
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100383binder_status_t VirtualCameraService::enableTestCameraCmd(
384 const int out, const int err,
385 const std::map<std::string, std::string>& options) {
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100386 if (mTestCameraToken != nullptr) {
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100387 dprintf(out, "Test camera is already enabled (%s).\n",
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100388 getCamera(mTestCameraToken)->getCameraName().c_str());
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100389 return STATUS_OK;
390 }
391
392 std::optional<int> cameraId;
393 auto it = options.find("camera_id");
394 if (it != options.end()) {
395 cameraId = parseInt(it->second);
396 if (!cameraId.has_value()) {
397 dprintf(err, "Invalid camera_id: %s\n, must be number > 0",
398 it->second.c_str());
399 return STATUS_BAD_VALUE;
400 }
401 }
402
403 std::optional<LensFacing> lensFacing;
404 it = options.find("lens_facing");
405 if (it != options.end()) {
406 lensFacing = parseLensFacing(it->second);
407 if (!lensFacing.has_value()) {
408 dprintf(err, "Invalid lens_facing: %s\n, must be front|back|external",
409 it->second.c_str());
410 return STATUS_BAD_VALUE;
411 }
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100412 }
413
414 sp<BBinder> token = sp<BBinder>::make();
415 mTestCameraToken.set(AIBinder_fromPlatformBinder(token));
416
417 bool ret;
Jan Sebechlebsky3b478c42023-11-23 13:15:56 +0100418 VirtualCameraConfiguration configuration;
Biswarup Pal6152a302023-12-19 12:44:09 +0000419 configuration.supportedStreamConfigs.push_back({.width = kVgaWidth,
420 .height = kVgaHeight,
421 Format::YUV_420_888,
422 .maxFps = kMaxFps});
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100423 configuration.lensFacing = lensFacing.value_or(LensFacing::EXTERNAL);
424 registerCamera(mTestCameraToken, configuration, cameraId.value_or(sNextId++),
Biswarup Pal37a75182024-01-16 15:53:35 +0000425 kDefaultDeviceId, &ret);
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100426 if (ret) {
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100427 dprintf(out, "Successfully registered test camera %s\n",
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100428 getCamera(mTestCameraToken)->getCameraName().c_str());
429 } else {
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100430 dprintf(err, "Failed to create test camera\n");
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100431 }
Jan Sebechlebsky773c0142024-03-25 12:17:05 +0100432 return STATUS_OK;
Jan Sebechlebsky5cb39962023-11-22 17:33:07 +0100433}
434
435void VirtualCameraService::disableTestCameraCmd(const int out) {
436 if (mTestCameraToken == nullptr) {
437 dprintf(out, "Test camera is not registered.");
438 }
439 unregisterCamera(mTestCameraToken);
440 mTestCameraToken.set(nullptr);
441}
442
443} // namespace virtualcamera
444} // namespace companion
445} // namespace android