Implement CameraIdRemapping for API1

- For API1, there's already two Ids:
  API1CameraId and a HAL camera Id,
  and they might be different. We
  only remap the HAL Camera Id, and leave
  the API1 camera ID untouched (since
  that is what the app sees). In that sense,
  there was already a "remapping" from
  app_camera_id to hal_camera_id in API_1, we just
  remap that hal_camera_id to different
  hal_camera_id_2.

In addition:
- Prevent remapping cameras for system/vendor
  uids, with the immediate intent of preventing
  remapping for FaceAuth clients.
- Properly implement disconnect() for API1 &
  API2 clients. This includes:
  - Clearing binder identity before we call
    disconnect(), so that the PID checks in
    disconnect() impl pass.
  - Not holding the mCameraIdRemappingLock
    while calling disconnect(), since it can
    leads to a deadlock, given a call path of
    disconnect -> finishCameraOps -> updateStatus,
    which also requires mCameraIdRemappingLock.
- Previously, disconnect() for API_2 clients was
  likely being triggered through a side channel,
  (e.g. impl in CameraDeviceClient after being
   sent an ERROR_CAMERA_DEVICE), which didn't
  happen for API_1 clients

Bug: 286287541
Test: Manually tested E2E for API1 and API2 apps.
Change-Id: I1e166e59e9441d8c7fe030320127abcfb373e428
2 files changed