Add AUTOFRAMING_AUTO mode
When an app sets CONTROL_AUTOFRAMING to AUTO, the app needs to fetch the
system default for the autoframing state.
Test: CTS tests continue to pass
Bug: 234004829
Change-Id: I2ef2c10dbe2889e18c28218cea68f3779afdad5f
diff --git a/camera/aidl/android/hardware/ICameraServiceProxy.aidl b/camera/aidl/android/hardware/ICameraServiceProxy.aidl
index fefea13..be8a00f 100644
--- a/camera/aidl/android/hardware/ICameraServiceProxy.aidl
+++ b/camera/aidl/android/hardware/ICameraServiceProxy.aidl
@@ -46,6 +46,13 @@
int getRotateAndCropOverride(String packageName, int lensFacing, int userId);
/**
+ * Returns the necessary autoframing override for the top activity which
+ * will be one of ({@link android.hardware.camera2.CameraMetadata#AUTOFRAMING_FALSE},
+ * {@link android.hardware.camera2.CameraMetadata#AUTOFRAMING_TRUE}).
+ */
+ int getAutoframingOverride(String packageName);
+
+ /**
* Checks if the camera has been disabled via device policy.
*/
boolean isCameraDisabled(int userId);
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp
index f87e241..8237073 100644
--- a/services/camera/libcameraservice/CameraService.cpp
+++ b/services/camera/libcameraservice/CameraService.cpp
@@ -1984,9 +1984,18 @@
if (mOverrideRotateAndCropMode != ANDROID_SCALER_ROTATE_AND_CROP_AUTO) {
client->setRotateAndCropOverride(mOverrideRotateAndCropMode);
} else {
- client->setRotateAndCropOverride(
- mCameraServiceProxyWrapper->getRotateAndCropOverride(
- clientPackageName, facing, multiuser_get_user_id(clientUid)));
+ client->setRotateAndCropOverride(
+ mCameraServiceProxyWrapper->getRotateAndCropOverride(
+ clientPackageName, facing, multiuser_get_user_id(clientUid)));
+ }
+
+ // Set autoframing override behaviour
+ if (mOverrideAutoframingMode != ANDROID_CONTROL_AUTOFRAMING_AUTO) {
+ client->setAutoframingOverride(mOverrideAutoframingMode);
+ } else {
+ client->setAutoframingOverride(
+ mCameraServiceProxyWrapper->getAutoframingOverride(
+ clientPackageName));
}
// Set camera muting behavior
@@ -4892,6 +4901,10 @@
return handleSetRotateAndCrop(args);
} else if (args.size() >= 1 && args[0] == String16("get-rotate-and-crop")) {
return handleGetRotateAndCrop(out);
+ } else if (args.size() >= 2 && args[0] == String16("set-autoframing")) {
+ return handleSetAutoframing(args);
+ } else if (args.size() >= 1 && args[0] == String16("get-autoframing")) {
+ return handleGetAutoframing(out);
} else if (args.size() >= 2 && args[0] == String16("set-image-dump-mask")) {
return handleSetImageDumpMask(args);
} else if (args.size() >= 1 && args[0] == String16("get-image-dump-mask")) {
@@ -4995,6 +5008,34 @@
return OK;
}
+status_t CameraService::handleSetAutoframing(const Vector<String16>& args) {
+ char* end;
+ int autoframingValue = (int) strtol(String8(args[1]), &end, /*base=*/10);
+ if ((*end != '\0') ||
+ (autoframingValue != ANDROID_CONTROL_AUTOFRAMING_OFF &&
+ autoframingValue != ANDROID_CONTROL_AUTOFRAMING_ON &&
+ autoframingValue != ANDROID_CONTROL_AUTOFRAMING_AUTO)) {
+ return BAD_VALUE;
+ }
+
+ Mutex::Autolock lock(mServiceLock);
+ mOverrideAutoframingMode = autoframingValue;
+
+ if (autoframingValue == ANDROID_CONTROL_AUTOFRAMING_AUTO) return OK;
+
+ const auto clients = mActiveClientManager.getAll();
+ for (auto& current : clients) {
+ if (current != nullptr) {
+ const auto basicClient = current->getValue();
+ if (basicClient.get() != nullptr) {
+ basicClient->setAutoframingOverride(autoframingValue);
+ }
+ }
+ }
+
+ return OK;
+}
+
status_t CameraService::handleSetCameraServiceWatchdog(const Vector<String16>& args) {
int enableWatchdog = atoi(String8(args[1]));
@@ -5023,6 +5064,12 @@
return dprintf(out, "rotateAndCrop override: %d\n", mOverrideRotateAndCropMode);
}
+status_t CameraService::handleGetAutoframing(int out) {
+ Mutex::Autolock lock(mServiceLock);
+
+ return dprintf(out, "autoframing override: %d\n", mOverrideAutoframingMode);
+}
+
status_t CameraService::handleSetImageDumpMask(const Vector<String16>& args) {
char *endPtr;
errno = 0;
@@ -5420,6 +5467,9 @@
" set-rotate-and-crop <ROTATION> overrides the rotate-and-crop value for AUTO backcompat\n"
" Valid values 0=0 deg, 1=90 deg, 2=180 deg, 3=270 deg, 4=No override\n"
" get-rotate-and-crop returns the current override rotate-and-crop value\n"
+ " set-autoframing <VALUE> overrides the autoframing value for AUTO\n"
+ " Valid values 0=false, 1=true, 2=auto\n"
+ " get-autoframing returns the current override autoframing value\n"
" set-image-dump-mask <MASK> specifies the formats to be saved to disk\n"
" Valid values 0=OFF, 1=ON for JPEG\n"
" get-image-dump-mask returns the current image-dump-mask value\n"
diff --git a/services/camera/libcameraservice/CameraService.h b/services/camera/libcameraservice/CameraService.h
index 6e2300a..bc31760 100644
--- a/services/camera/libcameraservice/CameraService.h
+++ b/services/camera/libcameraservice/CameraService.h
@@ -337,6 +337,9 @@
// Override rotate-and-crop AUTO behavior
virtual status_t setRotateAndCropOverride(uint8_t rotateAndCrop) = 0;
+ // Override autoframing AUTO behaviour
+ virtual status_t setAutoframingOverride(uint8_t autoframingValue) = 0;
+
// Whether the client supports camera muting (black only output)
virtual bool supportsCameraMute() = 0;
@@ -1230,6 +1233,12 @@
// Get the rotate-and-crop AUTO override behavior
status_t handleGetRotateAndCrop(int out);
+ // Set the autoframing AUTO override behaviour.
+ status_t handleSetAutoframing(const Vector<String16>& args);
+
+ // Get the autoframing AUTO override behaviour
+ status_t handleGetAutoframing(int out);
+
// Set the mask for image dump to disk
status_t handleSetImageDumpMask(const Vector<String16>& args);
@@ -1325,6 +1334,9 @@
// Current override cmd rotate-and-crop mode; AUTO means no override
uint8_t mOverrideRotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_AUTO;
+ // Current autoframing mode
+ uint8_t mOverrideAutoframingMode = ANDROID_CONTROL_AUTOFRAMING_AUTO;
+
// Current image dump mask
uint8_t mImageDumpMask = 0;
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp
index 88f27de..4a1a045 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.cpp
+++ b/services/camera/libcameraservice/api1/Camera2Client.cpp
@@ -2363,6 +2363,13 @@
static_cast<camera_metadata_enum_android_scaler_rotate_and_crop_t>(rotateAndCrop));
}
+status_t Camera2Client::setAutoframingOverride(uint8_t autoframingValue) {
+ if (autoframingValue > ANDROID_CONTROL_AUTOFRAMING_AUTO) return BAD_VALUE;
+
+ return mDevice->setAutoframingAutoBehavior(
+ static_cast<camera_metadata_enum_android_control_autoframing_t>(autoframingValue));
+}
+
bool Camera2Client::supportsCameraMute() {
return mDevice->supportsCameraMute();
}
diff --git a/services/camera/libcameraservice/api1/Camera2Client.h b/services/camera/libcameraservice/api1/Camera2Client.h
index fe91cba..6e64490 100644
--- a/services/camera/libcameraservice/api1/Camera2Client.h
+++ b/services/camera/libcameraservice/api1/Camera2Client.h
@@ -86,6 +86,7 @@
virtual status_t setAudioRestriction(int mode);
virtual int32_t getGlobalAudioRestriction();
virtual status_t setRotateAndCropOverride(uint8_t rotateAndCrop);
+ virtual status_t setAutoframingOverride(uint8_t autoframingMode);
virtual bool supportsCameraMute();
virtual status_t setCameraMute(bool enabled);
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
index c49ecb2..60daf2d 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp
@@ -1752,6 +1752,13 @@
static_cast<camera_metadata_enum_android_scaler_rotate_and_crop_t>(rotateAndCrop));
}
+status_t CameraDeviceClient::setAutoframingOverride(uint8_t autoframingValue) {
+ if (autoframingValue > ANDROID_CONTROL_AUTOFRAMING_AUTO) return BAD_VALUE;
+
+ return mDevice->setAutoframingAutoBehavior(
+ static_cast<camera_metadata_enum_android_control_autoframing_t>(autoframingValue));
+}
+
bool CameraDeviceClient::supportsCameraMute() {
return mDevice->supportsCameraMute();
}
diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.h b/services/camera/libcameraservice/api2/CameraDeviceClient.h
index 06844c6..d9193c2 100644
--- a/services/camera/libcameraservice/api2/CameraDeviceClient.h
+++ b/services/camera/libcameraservice/api2/CameraDeviceClient.h
@@ -197,6 +197,8 @@
virtual status_t setRotateAndCropOverride(uint8_t rotateAndCrop) override;
+ virtual status_t setAutoframingOverride(uint8_t autoframingValue) override;
+
virtual bool supportsCameraMute();
virtual status_t setCameraMute(bool enabled);
diff --git a/services/camera/libcameraservice/api2/CameraOfflineSessionClient.cpp b/services/camera/libcameraservice/api2/CameraOfflineSessionClient.cpp
index 4d4d481..ea90987 100644
--- a/services/camera/libcameraservice/api2/CameraOfflineSessionClient.cpp
+++ b/services/camera/libcameraservice/api2/CameraOfflineSessionClient.cpp
@@ -81,6 +81,10 @@
return OK;
}
+status_t CameraOfflineSessionClient::setAutoframingOverride(uint8_t) {
+ return OK;
+}
+
bool CameraOfflineSessionClient::supportsCameraMute() {
// Offline mode doesn't support muting
return false;
diff --git a/services/camera/libcameraservice/api2/CameraOfflineSessionClient.h b/services/camera/libcameraservice/api2/CameraOfflineSessionClient.h
index 9ea1093..7a3c901 100644
--- a/services/camera/libcameraservice/api2/CameraOfflineSessionClient.h
+++ b/services/camera/libcameraservice/api2/CameraOfflineSessionClient.h
@@ -81,6 +81,8 @@
status_t setRotateAndCropOverride(uint8_t rotateAndCrop) override;
+ status_t setAutoframingOverride(uint8_t autoframingValue) override;
+
bool supportsCameraMute() override;
status_t setCameraMute(bool enabled) override;
diff --git a/services/camera/libcameraservice/common/CameraDeviceBase.h b/services/camera/libcameraservice/common/CameraDeviceBase.h
index 89a2af8..977ab7c 100644
--- a/services/camera/libcameraservice/common/CameraDeviceBase.h
+++ b/services/camera/libcameraservice/common/CameraDeviceBase.h
@@ -440,6 +440,14 @@
camera_metadata_enum_android_scaler_rotate_and_crop_t rotateAndCropValue) = 0;
/**
+ * Set the current behavior for the AUTOFRAMING control when in AUTO.
+ *
+ * The value must be one of the AUTOFRAMING_* values besides AUTO.
+ */
+ virtual status_t setAutoframingAutoBehavior(
+ camera_metadata_enum_android_control_autoframing_t autoframingValue) = 0;
+
+ /**
* Whether camera muting (producing black-only output) is supported.
*
* Calling setCameraMute(true) when this returns false will return an
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp
index d189de2..54cb8f2 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.cpp
+++ b/services/camera/libcameraservice/device3/Camera3Device.cpp
@@ -2140,6 +2140,15 @@
newRequest->mRotateAndCropAuto = false;
}
+ auto autoframingEntry =
+ newRequest->mSettingsList.begin()->metadata.find(ANDROID_CONTROL_AUTOFRAMING);
+ if (autoframingEntry.count > 0 &&
+ autoframingEntry.data.u8[0] == ANDROID_CONTROL_AUTOFRAMING_AUTO) {
+ newRequest->mAutoframingAuto = true;
+ } else {
+ newRequest->mAutoframingAuto = false;
+ }
+
auto zoomRatioEntry =
newRequest->mSettingsList.begin()->metadata.find(ANDROID_CONTROL_ZOOM_RATIO);
if (zoomRatioEntry.count > 0 &&
@@ -2691,7 +2700,7 @@
int32_t numBuffers, CaptureResultExtras resultExtras, bool hasInput,
bool hasAppCallback, nsecs_t minExpectedDuration, nsecs_t maxExpectedDuration,
bool isFixedFps, const std::set<std::set<String8>>& physicalCameraIds,
- bool isStillCapture, bool isZslCapture, bool rotateAndCropAuto,
+ bool isStillCapture, bool isZslCapture, bool rotateAndCropAuto, bool autoframingAuto,
const std::set<std::string>& cameraIdsWithZoom,
const SurfaceMap& outputSurfaces, nsecs_t requestTimeNs) {
ATRACE_CALL();
@@ -2700,8 +2709,8 @@
ssize_t res;
res = mInFlightMap.add(frameNumber, InFlightRequest(numBuffers, resultExtras, hasInput,
hasAppCallback, minExpectedDuration, maxExpectedDuration, isFixedFps, physicalCameraIds,
- isStillCapture, isZslCapture, rotateAndCropAuto, cameraIdsWithZoom, requestTimeNs,
- outputSurfaces));
+ isStillCapture, isZslCapture, rotateAndCropAuto, autoframingAuto, cameraIdsWithZoom,
+ requestTimeNs, outputSurfaces));
if (res < 0) return res;
if (mInFlightMap.size() == 1) {
@@ -2908,6 +2917,7 @@
mCurrentAfTriggerId(0),
mCurrentPreCaptureTriggerId(0),
mRotateAndCropOverride(ANDROID_SCALER_ROTATE_AND_CROP_NONE),
+ mAutoframingOverride(ANDROID_CONTROL_AUTOFRAMING_ON),
mComposerOutput(false),
mCameraMute(ANDROID_SENSOR_TEST_PATTERN_MODE_OFF),
mCameraMuteChanged(false),
@@ -3592,13 +3602,14 @@
// compensated by NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY
bool rotateAndCropChanged = mComposerOutput ? false :
overrideAutoRotateAndCrop(captureRequest);
+ bool autoframingChanged = overrideAutoframing(captureRequest);
bool testPatternChanged = overrideTestPattern(captureRequest);
// If the request is the same as last, or we had triggers now or last time or
// changing overrides this time
bool newRequest =
- (mPrevRequest != captureRequest || triggersMixedIn ||
- rotateAndCropChanged || testPatternChanged) &&
+ (mPrevRequest != captureRequest || triggersMixedIn || rotateAndCropChanged ||
+ autoframingChanged || testPatternChanged) &&
// Request settings are all the same within one batch, so only treat the first
// request in a batch as new
!(batchedRequest && i > 0);
@@ -3927,7 +3938,8 @@
expectedDurationInfo.maxDuration,
expectedDurationInfo.isFixedFps,
requestedPhysicalCameras, isStillCapture, isZslCapture,
- captureRequest->mRotateAndCropAuto, mPrevCameraIdsWithZoom,
+ captureRequest->mRotateAndCropAuto, captureRequest->mAutoframingAuto,
+ mPrevCameraIdsWithZoom,
(mUseHalBufManager) ? uniqueSurfaceIdMap :
SurfaceMap{}, captureRequest->mRequestTimeNs);
ALOGVV("%s: registered in flight requestId = %" PRId32 ", frameNumber = %" PRId64
@@ -4068,6 +4080,17 @@
return OK;
}
+status_t Camera3Device::RequestThread::setAutoframingAutoBehaviour(
+ camera_metadata_enum_android_control_autoframing_t autoframingValue) {
+ ATRACE_CALL();
+ Mutex::Autolock l(mTriggerMutex);
+ if (autoframingValue == ANDROID_CONTROL_AUTOFRAMING_AUTO) {
+ return BAD_VALUE;
+ }
+ mAutoframingOverride = autoframingValue;
+ return OK;
+}
+
status_t Camera3Device::RequestThread::setComposerSurface(bool composerSurfacePresent) {
ATRACE_CALL();
Mutex::Autolock l(mTriggerMutex);
@@ -4658,6 +4681,31 @@
return false;
}
+bool Camera3Device::RequestThread::overrideAutoframing(const sp<CaptureRequest> &request) {
+ ATRACE_CALL();
+
+ if (request->mAutoframingAuto) {
+ Mutex::Autolock l(mTriggerMutex);
+ CameraMetadata &metadata = request->mSettingsList.begin()->metadata;
+
+ auto autoframingEntry = metadata.find(ANDROID_CONTROL_AUTOFRAMING);
+ if (autoframingEntry.count > 0) {
+ if (autoframingEntry.data.u8[0] == mAutoframingOverride) {
+ return false;
+ } else {
+ autoframingEntry.data.u8[0] = mAutoframingOverride;
+ return true;
+ }
+ } else {
+ uint8_t autoframing_u8 = mAutoframingOverride;
+ metadata.update(ANDROID_CONTROL_AUTOFRAMING,
+ &autoframing_u8, 1);
+ return true;
+ }
+ }
+ return false;
+}
+
bool Camera3Device::RequestThread::overrideTestPattern(
const sp<CaptureRequest> &request) {
ATRACE_CALL();
@@ -5143,6 +5191,17 @@
return mRequestThread->setRotateAndCropAutoBehavior(rotateAndCropValue);
}
+status_t Camera3Device::setAutoframingAutoBehavior(
+ camera_metadata_enum_android_control_autoframing_t autoframingValue) {
+ ATRACE_CALL();
+ Mutex::Autolock il(mInterfaceLock);
+ Mutex::Autolock l(mLock);
+ if (mRequestThread == nullptr) {
+ return INVALID_OPERATION;
+ }
+ return mRequestThread->setAutoframingAutoBehaviour(autoframingValue);
+}
+
bool Camera3Device::supportsCameraMute() {
Mutex::Autolock il(mInterfaceLock);
Mutex::Autolock l(mLock);
diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h
index e2b4386..d521c4b 100644
--- a/services/camera/libcameraservice/device3/Camera3Device.h
+++ b/services/camera/libcameraservice/device3/Camera3Device.h
@@ -273,6 +273,14 @@
camera_metadata_enum_android_scaler_rotate_and_crop_t rotateAndCropValue);
/**
+ * Set the current behavior for the AUTOFRAMING control when in AUTO.
+ *
+ * The value must be one of the AUTOFRAMING_* values besides AUTO.
+ */
+ status_t setAutoframingAutoBehavior(
+ camera_metadata_enum_android_control_autoframing_t autoframingValue);
+
+ /**
* Whether camera muting (producing black-only output) is supported.
*
* Calling setCameraMute(true) when this returns false will return an
@@ -603,6 +611,9 @@
// overriding of ROTATE_AND_CROP value and adjustment of coordinates
// in several other controls in both the request and the result
bool mRotateAndCropAuto;
+ // Whether this request has AUTOFRAMING_AUTO set, so need to override the AUTOFRAMING value
+ // in the capture request.
+ bool mAutoframingAuto;
// Whether this capture request has its zoom ratio set to 1.0x before
// the framework overrides it for camera HAL consumption.
@@ -616,6 +627,8 @@
// Whether this capture request's rotation and crop update has been
// done.
bool mRotationAndCropUpdated = false;
+ // Whether this capture request's autoframing has been done.
+ bool mAutoframingUpdated = false;
// Whether this capture request's zoom ratio update has been done.
bool mZoomRatioUpdated = false;
// Whether this max resolution capture request's crop / metering region update has been
@@ -917,6 +930,10 @@
status_t setRotateAndCropAutoBehavior(
camera_metadata_enum_android_scaler_rotate_and_crop_t rotateAndCropValue);
+
+ status_t setAutoframingAutoBehaviour(
+ camera_metadata_enum_android_control_autoframing_t autoframingValue);
+
status_t setComposerSurface(bool composerSurfacePresent);
status_t setCameraMute(int32_t muteMode);
@@ -943,6 +960,9 @@
// Override rotate_and_crop control if needed; returns true if the current value was changed
bool overrideAutoRotateAndCrop(const sp<CaptureRequest> &request);
+ // Override autoframing control if needed; returns true if the current value was changed
+ bool overrideAutoframing(const sp<CaptureRequest> &request);
+
// Override test_pattern control if needed for camera mute; returns true
// if the current value was changed
bool overrideTestPattern(const sp<CaptureRequest> &request);
@@ -1077,6 +1097,7 @@
uint32_t mCurrentAfTriggerId;
uint32_t mCurrentPreCaptureTriggerId;
camera_metadata_enum_android_scaler_rotate_and_crop_t mRotateAndCropOverride;
+ camera_metadata_enum_android_control_autoframing_t mAutoframingOverride;
bool mComposerOutput;
int32_t mCameraMute; // 0 = no mute, otherwise the TEST_PATTERN_MODE to use
bool mCameraMuteChanged;
@@ -1126,7 +1147,7 @@
int32_t numBuffers, CaptureResultExtras resultExtras, bool hasInput,
bool callback, nsecs_t minExpectedDuration, nsecs_t maxExpectedDuration,
bool isFixedFps, const std::set<std::set<String8>>& physicalCameraIds,
- bool isStillCapture, bool isZslCapture, bool rotateAndCropAuto,
+ bool isStillCapture, bool isZslCapture, bool rotateAndCropAuto, bool autoframingAuto,
const std::set<std::string>& cameraIdsWithZoom, const SurfaceMap& outputSurfaces,
nsecs_t requestTimeNs);
diff --git a/services/camera/libcameraservice/device3/InFlightRequest.h b/services/camera/libcameraservice/device3/InFlightRequest.h
index 444445b..870825a 100644
--- a/services/camera/libcameraservice/device3/InFlightRequest.h
+++ b/services/camera/libcameraservice/device3/InFlightRequest.h
@@ -182,6 +182,9 @@
// Indicates that ROTATE_AND_CROP was set to AUTO
bool rotateAndCropAuto;
+ // Indicates that AUTOFRAMING was set to AUTO
+ bool autoframingAuto;
+
// Requested camera ids (both logical and physical) with zoomRatio != 1.0f
std::set<std::string> cameraIdsWithZoom;
@@ -214,6 +217,7 @@
stillCapture(false),
zslCapture(false),
rotateAndCropAuto(false),
+ autoframingAuto(false),
requestTimeNs(0),
transform(-1) {
}
@@ -221,8 +225,9 @@
InFlightRequest(int numBuffers, CaptureResultExtras extras, bool hasInput,
bool hasAppCallback, nsecs_t minDuration, nsecs_t maxDuration, bool fixedFps,
const std::set<std::set<String8>>& physicalCameraIdSet, bool isStillCapture,
- bool isZslCapture, bool rotateAndCropAuto, const std::set<std::string>& idsWithZoom,
- nsecs_t requestNs, const SurfaceMap& outSurfaces = SurfaceMap{}) :
+ bool isZslCapture, bool rotateAndCropAuto, bool autoframingAuto,
+ const std::set<std::string>& idsWithZoom, nsecs_t requestNs,
+ const SurfaceMap& outSurfaces = SurfaceMap{}) :
shutterTimestamp(0),
sensorTimestamp(0),
requestStatus(OK),
@@ -240,6 +245,7 @@
stillCapture(isStillCapture),
zslCapture(isZslCapture),
rotateAndCropAuto(rotateAndCropAuto),
+ autoframingAuto(autoframingAuto),
cameraIdsWithZoom(idsWithZoom),
requestTimeNs(requestNs),
outputSurfaces(outSurfaces),
diff --git a/services/camera/libcameraservice/tests/CameraPermissionsTest.cpp b/services/camera/libcameraservice/tests/CameraPermissionsTest.cpp
index 42d99e8..1bd11aa 100644
--- a/services/camera/libcameraservice/tests/CameraPermissionsTest.cpp
+++ b/services/camera/libcameraservice/tests/CameraPermissionsTest.cpp
@@ -129,6 +129,10 @@
userId, ret);
}
+ virtual binder::Status getAutoframingOverride(const String16& packageName, int *ret) override {
+ return mCameraServiceProxy->getAutoframingOverride(packageName, ret);
+ }
+
virtual binder::Status pingForUserUpdate() override {
return mCameraServiceProxy->pingForUserUpdate();
}
diff --git a/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp b/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp
index 885c6aa..bed576f 100644
--- a/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp
+++ b/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.cpp
@@ -147,6 +147,21 @@
return ret;
}
+int CameraServiceProxyWrapper::getAutoframingOverride(const String16& packageName) {
+ sp<ICameraServiceProxy> proxyBinder = getCameraServiceProxy();
+ if (proxyBinder == nullptr) {
+ return ANDROID_CONTROL_AUTOFRAMING_OFF;
+ }
+ int ret = 0;
+ auto status = proxyBinder->getAutoframingOverride(packageName, &ret);
+ if (!status.isOk()) {
+ ALOGE("%s: Failed during autoframing override query: %s", __FUNCTION__,
+ status.exceptionMessage().c_str());
+ }
+
+ return ret;
+}
+
void CameraServiceProxyWrapper::logStreamConfigured(const String8& id,
int operatingMode, bool internalConfig, int32_t latencyMs) {
std::shared_ptr<CameraSessionStatsWrapper> sessionStats;
diff --git a/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.h b/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.h
index c00c691..0f77fc9 100644
--- a/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.h
+++ b/services/camera/libcameraservice/utils/CameraServiceProxyWrapper.h
@@ -104,6 +104,9 @@
// Return the current top activity rotate and crop override.
int getRotateAndCropOverride(String16 packageName, int lensFacing, int userId);
+ // Return the current top activity autoframing.
+ int getAutoframingOverride(const String16& packageName);
+
// Detect if the camera is disabled by device policy.
bool isCameraDisabled(int userId);
};