Camera: Update camera service to use new HIDL HALs, part 1

- Add CameraProviderManager
  - Enumerates individual camera provider HAL instances, as well
    as the devices they provide
  - Handles dynamic provider and device appearance/disappearance
  - Maps device names to public API namespace
  - Add unit tests for CameraProviderManager
- Add logic to enable new HIDL path
- Switch various bits of service internals to use string camera IDs,
  though leaving most camera1-facing bits using int IDs, since that's
  what the old API uses.
- Update CameraService to use CameraProviderManager instead of
  the legacy camera HAL
- Update clients to pass through provider manager to devices instead
  of just camera module
- Still TODO:
  - Update Camera3Device to use new HIDL interface
  - Update CameraHardwareInterface to use new HIDL interface
  - Update dump()
  - Update vendor tag handling

Test: New unit tests pass, camera CTS passes with Treble disabled
Bug: 30985004
Bug: 32991422
Change-Id: I7ac41f13b9501d5e53256e28c0465ec70aa3980e
diff --git a/services/camera/libcameraservice/api1/CameraClient.h b/services/camera/libcameraservice/api1/CameraClient.h
index 4f46fc4..91f00e3 100644
--- a/services/camera/libcameraservice/api1/CameraClient.h
+++ b/services/camera/libcameraservice/api1/CameraClient.h
@@ -70,7 +70,8 @@
             bool legacyMode = false);
     ~CameraClient();
 
-    status_t initialize(CameraModule *module);
+    virtual status_t initialize(CameraModule *module) override;
+    virtual status_t initialize(sp<CameraProviderManager> manager) override;
 
     virtual status_t dump(int fd, const Vector<String16>& args);
 
@@ -78,6 +79,9 @@
 
 private:
 
+    template<typename TProviderPtr>
+    status_t initializeImpl(TProviderPtr providerPtr);
+
     // check whether the calling process matches mClientPid.
     status_t                checkPid() const;
     status_t                checkPidAndHardware() const;  // also check mHardware != 0
@@ -98,6 +102,8 @@
     // internal function used by sendCommand to enable/disable shutter sound.
     status_t                enableShutterSound(bool enable);
 
+    static sp<CameraClient>        getClientFromCookie(void* user);
+
     // these are static callback functions
     static void             notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2, void* user);
     static void             dataCallback(int32_t msgType, const sp<IMemory>& dataPtr,