Camera: Remove GPS_LOCATION if set is called with null

Per CaptureRequest documentation, if CaptureRequest.set(GPS_LOCATION)
is called with null, the corresponding entries in the CameraMetata
should be cleared.

Make the logic so.

Test: Camera CTS
Bug: 268581420
Change-Id: Ib7801e14237e4500a7a9d5c00b2f15c35d482798
This commit is contained in:
Shuzhen Wang
2023-03-07 13:26:37 -08:00
parent e7020d59bd
commit b0551beb8d

View File

@@ -1132,6 +1132,12 @@ public class CameraMetadataNative implements Parcelable {
private boolean setGpsLocation(Location l) {
if (l == null) {
// If Location value being set is null, remove corresponding keys.
// This is safe because api1/client2/CameraParameters.cpp already erases
// the keys for JPEG_GPS_LOCATION for certain cases.
setBase(CaptureRequest.JPEG_GPS_TIMESTAMP, null);
setBase(CaptureRequest.JPEG_GPS_COORDINATES, null);
setBase(CaptureRequest.JPEG_GPS_PROCESSING_METHOD, null);
return false;
}