Add ID argument to enable_test_camera shell cmd

Allows for more flexibility and consistency in test scenarios. The argument is optional. If not provided it falls back to the current camera id generation scheme.

Bug: 322965201
Test: adb shell cmd virtual_camera enable_test_camera 99999

Change-Id: I196406b040322022a8f6f3a43e1fc4709a244dee
diff --git a/services/camera/virtualcamera/VirtualCameraService.h b/services/camera/virtualcamera/VirtualCameraService.h
index d573986..d447fc7 100644
--- a/services/camera/virtualcamera/VirtualCameraService.h
+++ b/services/camera/virtualcamera/VirtualCameraService.h
@@ -45,6 +45,13 @@
           configuration,
       bool* _aidl_return) override EXCLUDES(mLock);
 
+  // Register camera corresponding to the binder token.
+  ndk::ScopedAStatus registerCamera(
+      const ::ndk::SpAIBinder& token,
+      const ::aidl::android::companion::virtualcamera::VirtualCameraConfiguration&
+          configuration,
+      int cameraId, bool* _aidl_return) EXCLUDES(mLock);
+
   // Unregisters camera corresponding to the binder token.
   ndk::ScopedAStatus unregisterCamera(const ::ndk::SpAIBinder& token) override
       EXCLUDES(mLock);
@@ -64,7 +71,7 @@
 
  private:
   // Create and enable test camera instance if there's none.
-  void enableTestCameraCmd(int out, int err);
+  void enableTestCameraCmd(int out, int err, int cameraId);
   // Disable and destroy test camera instance if there's one.
   void disableTestCameraCmd(int out);
 
@@ -84,6 +91,9 @@
 
   // Local binder token for test camera instance, or nullptr if there's none.
   ::ndk::SpAIBinder mTestCameraToken;
+
+  // Numerical id to assign to next created camera.
+  static std::atomic_int sNextId;
 };
 
 }  // namespace virtualcamera