camera: ip: Use token to replace mojo channel manager instance

We want to hide the detail of the camera mojo channel manager and camera
hal also doesn't need it. Use a token to decouple it.

BUG=b:173033342
TEST=emerge cros-camera-hal-ip

Change-Id: Id7e91fd2f9d622d285cb51a7fb743a45f96c0b94
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2550969
Tested-by: Hsu Wei-Cheng <mojahsu@chromium.org>
Commit-Queue: Hsu Wei-Cheng <mojahsu@chromium.org>
Reviewed-by: Pablo Ceballos <pceballos@chromium.org>
Reviewed-by: Shik Chen <shik@chromium.org>
diff --git a/camera/hal/ip/camera_device.cc b/camera/hal/ip/camera_device.cc
index f9de300..8d4d98e 100644
--- a/camera/hal/ip/camera_device.cc
+++ b/camera/hal/ip/camera_device.cc
@@ -502,7 +502,7 @@
 
 void CameraDevice::StartJpegProcessor() {
   jda_ = JpegDecodeAccelerator::CreateInstance(
-      CameraHal::GetInstance().GetMojoManagerInstance());
+      CameraHal::GetInstance().GetMojoManagerToken());
   if (!jda_->Start()) {
     LOGF(ERROR) << "Error starting JPEG processor";
   }
diff --git a/camera/hal/ip/camera_hal.cc b/camera/hal/ip/camera_hal.cc
index 47b3eca..403b434 100644
--- a/camera/hal/ip/camera_hal.cc
+++ b/camera/hal/ip/camera_hal.cc
@@ -41,8 +41,8 @@
   return camera_hal;
 }
 
-CameraMojoChannelManager* CameraHal::GetMojoManagerInstance() {
-  return mojo_manager_;
+CameraMojoChannelManagerToken* CameraHal::GetMojoManagerToken() {
+  return mojo_manager_token_;
 }
 
 int CameraHal::OpenDevice(int id,
@@ -109,12 +109,12 @@
   return ret;
 }
 
-void CameraHal::SetUp(CameraMojoChannelManager* mojo_manager) {
-  mojo_manager_ = mojo_manager;
+void CameraHal::SetUp(CameraMojoChannelManagerToken* token) {
+  mojo_manager_token_ = token;
 }
 
 void CameraHal::TearDown() {
-  mojo_manager_ = nullptr;
+  mojo_manager_token_ = nullptr;
 }
 
 void CameraHal::InitOnIpcThread(scoped_refptr<Future<int>> return_val) {
@@ -289,8 +289,8 @@
   return CameraHal::GetInstance().Init();
 }
 
-static void set_up(CameraMojoChannelManager* mojo_manager) {
-  CameraHal::GetInstance().SetUp(mojo_manager);
+static void set_up(CameraMojoChannelManagerToken* token) {
+  CameraHal::GetInstance().SetUp(token);
 }
 
 static void tear_down() {
diff --git a/camera/hal/ip/camera_hal.h b/camera/hal/ip/camera_hal.h
index b4ebc40..4f0e4bd 100644
--- a/camera/hal/ip/camera_hal.h
+++ b/camera/hal/ip/camera_hal.h
@@ -18,7 +18,7 @@
 #include <sys/types.h>
 
 #include "camera/camera_metadata.h"
-#include "cros-camera/camera_mojo_channel_manager.h"
+#include "cros-camera/camera_mojo_channel_manager_token.h"
 #include "cros-camera/future.h"
 #include "hal/ip/camera_device.h"
 #include "mojo/ip/ip_camera.mojom.h"
@@ -35,7 +35,7 @@
 
   static CameraHal& GetInstance();
 
-  CameraMojoChannelManager* GetMojoManagerInstance();
+  CameraMojoChannelManagerToken* GetMojoManagerToken();
 
   // Implementations of camera_module_t
   int OpenDevice(int id, const hw_module_t* module, hw_device_t** hw_device);
@@ -45,7 +45,7 @@
   int Init();
 
   // Implementations for cros_camera_hal_t.
-  void SetUp(CameraMojoChannelManager* mojo_manager);
+  void SetUp(CameraMojoChannelManagerToken* token);
   void TearDown();
 
  private:
@@ -77,8 +77,8 @@
   base::WaitableEvent callbacks_set_;
   const camera_module_callbacks_t* callbacks_;
 
-  // Mojo manager which is used for Mojo communication.
-  CameraMojoChannelManager* mojo_manager_;
+  // Mojo manager token which is used for Mojo communication.
+  CameraMojoChannelManagerToken* mojo_manager_token_;
 };
 
 }  // namespace cros