CameraService: Implement SCALER_ROTATE_AND_CROP_AUTO, part 1
When an app sets SCALER_ROTATE_AND_CROP to AUTO, the camera service
needs to select the right ROTATE_AND_CROP mode given the application
UI state at the moment, received from the window manager.
In addition, some of the metadata in the active array coordinate
system needs to be converted to/from the cropped+rotated coordinate
system to ensure roundtripping UI information works as before.
Also ensure that the available rotate and crop metadata field is
always available, with a value of NONE if nothing else.
This commit adds support for doing the coordinate transforms and
overriding AUTO to a concrete value; it does not wire up a connection
to another system service to receive the correct override value, but
does add a command to set the override value for all current camera
clients.
Test: New CTS tests pass, unit tests for RotateAndCropMapper pass
Bug: 134631897
Change-Id: Icc45530e2cfbaf838a1e4d04e4fd2aef8122e8e1
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 34b970d..8d73183 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -280,6 +280,10 @@
virtual int32_t getAudioRestriction() const;
static bool isValidAudioRestriction(int32_t mode);
+
+ // Override rotate-and-crop AUTO behavior
+ virtual status_t setRotateAndCropOverride(uint8_t rotateAndCrop) = 0;
+
protected:
BasicClient(const sp<CameraService>& cameraService,
const sp<IBinder>& remoteCallback,
@@ -1014,6 +1018,12 @@
// Gets the UID state
status_t handleGetUidState(const Vector<String16>& args, int out, int err);
+ // Set the rotate-and-crop AUTO override behavior
+ status_t handleSetRotateAndCrop(const Vector<String16>& args);
+
+ // Get the rotate-and-crop AUTO override behavior
+ status_t handleGetRotateAndCrop(int out);
+
// Prints the shell command help
status_t printHelp(int out);
@@ -1059,6 +1069,9 @@
// Aggreated audio restriction mode for all camera clients
int32_t mAudioRestriction;
+
+ // Current override rotate-and-crop mode
+ uint8_t mOverrideRotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_AUTO;
};
} // namespace android