cameraservice: Copy camera characteristics from session characteristics
The getSessionCharacteristics call is meant to replace the output of
getCameraCharacteristics. The current implementation however passed
the output of HAL directly to the application, which could be missing
quite a few keys.
This CL uses the camera device's characteristics as the base
and copies over any updated values from the HAL instead. This will
ensure the output of getSessionCharacteristics matches the constraints
of getCameraCharacteristics.
Similarly, this CL also filters out any sensitive keys if
getSessionCharactersitics is called from a process that does not have
camera permission granted.
Bug: 303645857
Test: atest android.hardware.camera2.cts.CameraDeviceSetupTest passes
Test: atest android.hardware.camera2.cts.StaticMetadataTest passes
Change-Id: I589c80fc6152ae3cb14c72963953feb94a7f745a
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index b4c2edd..e1bc726 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -1529,6 +1529,12 @@
// responsibility to acquire mLogLock before calling this functions.
bool isClientWatchedLocked(const BasicClient *client);
+ // Filters out fingerprintable keys if the calling process does not have CAMERA permission.
+ // Note: function caller should ensure that shouldRejectSystemCameraConnection is checked
+ // for the calling process before calling this function.
+ binder::Status filterSensitiveMetadataIfNeeded(const std::string& cameraId,
+ CameraMetadata* metadata);
+
/**
* Get the current system time as a formatted string.
*/