Camera: Connect activity resizing state to camera service
Wire up WM activity AR mismatch query to camera clients
Test: CTS continues to pass
Bug: 134631897
Change-Id: Idad6dd4536a42f0ffec37a2689a3cd8690b90e90
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index 706197e..c91750e 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -744,7 +744,7 @@
return Status::ok();
}
-int CameraService::getDeviceVersion(const String8& cameraId, int* facing) {
+int CameraService::getDeviceVersion(const String8& cameraId, int* facing, int* orientation) {
ATRACE_CALL();
int deviceVersion = 0;
@@ -761,6 +761,9 @@
res = mCameraProviderManager->getCameraInfo(cameraId.string(), &info);
if (res != OK) return -1;
*facing = info.facing;
+ if (orientation) {
+ *orientation = info.orientation;
+ }
}
return deviceVersion;
@@ -1556,6 +1559,7 @@
sp<CLIENT> client = nullptr;
int facing = -1;
+ int orientation = 0;
bool isNdk = (clientPackageName.size() == 0);
{
// Acquire mServiceLock and prevent other clients from connecting
@@ -1621,7 +1625,7 @@
// give flashlight a chance to close devices if necessary.
mFlashlight->prepareDeviceOpen(cameraId);
- int deviceVersion = getDeviceVersion(cameraId, /*out*/&facing);
+ int deviceVersion = getDeviceVersion(cameraId, /*out*/&facing, /*out*/&orientation);
if (facing == -1) {
ALOGE("%s: Unable to get camera device \"%s\" facing", __FUNCTION__, cameraId.string());
return STATUS_ERROR_FMT(ERROR_INVALID_OPERATION,
@@ -1689,6 +1693,9 @@
// Set rotate-and-crop override behavior
if (mOverrideRotateAndCropMode != ANDROID_SCALER_ROTATE_AND_CROP_AUTO) {
client->setRotateAndCropOverride(mOverrideRotateAndCropMode);
+ } else if (CameraServiceProxyWrapper::isRotateAndCropOverrideNeeded(clientPackageName,
+ orientation, facing)) {
+ client->setRotateAndCropOverride(ANDROID_SCALER_ROTATE_AND_CROP_90);
}
// Set camera muting behavior