diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2015-06-10 16:44:28 -0700 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2015-06-11 15:15:17 -0700 |
commit | a94c6033452b465a28d6bd76015d4a1de6b1bd29 (patch) | |
tree | 491468e2573b55d392b39efc243826b8740dec89 /core/jni | |
parent | 68c40fafd8bf9186c4ac28dd851949eeab39b68c (diff) | |
download | frameworks_base-a94c6033452b465a28d6bd76015d4a1de6b1bd29.zip frameworks_base-a94c6033452b465a28d6bd76015d4a1de6b1bd29.tar.gz frameworks_base-a94c6033452b465a28d6bd76015d4a1de6b1bd29.tar.bz2 |
Set scaling mode for legacy device surfaces.
Bug: 19371754
Change-Id: I0dd762e7b1485ba2d3bec9604407125c35ad1218
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp index afdfd8f..5bef653 100644 --- a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp +++ b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp @@ -689,6 +689,23 @@ static jint LegacyCameraDevice_nativeSetNextTimestamp(JNIEnv* env, jobject thiz, return NO_ERROR; } +static jint LegacyCameraDevice_nativeSetScalingMode(JNIEnv* env, jobject thiz, jobject surface, + jint mode) { + ALOGV("nativeSetScalingMode"); + sp<ANativeWindow> anw; + if ((anw = getNativeWindow(env, surface)) == NULL) { + ALOGE("%s: Could not retrieve native window from surface.", __FUNCTION__); + return BAD_VALUE; + } + status_t err = NO_ERROR; + if ((err = native_window_set_scaling_mode(anw.get(), static_cast<int>(mode))) != NO_ERROR) { + ALOGE("%s: Unable to set surface scaling mode, error %s (%d)", __FUNCTION__, + strerror(-err), err); + return err; + } + return NO_ERROR; +} + static jint LegacyCameraDevice_nativeGetJpegFooterSize(JNIEnv* env, jobject thiz) { ALOGV("nativeGetJpegFooterSize"); return static_cast<jint>(sizeof(struct camera3_jpeg_blob)); @@ -733,6 +750,9 @@ static JNINativeMethod gCameraDeviceMethods[] = { { "nativeDetectSurfaceUsageFlags", "(Landroid/view/Surface;)I", (void *)LegacyCameraDevice_nativeDetectSurfaceUsageFlags }, + { "nativeSetScalingMode", + "(Landroid/view/Surface;I)I", + (void *)LegacyCameraDevice_nativeSetScalingMode }, }; // Get all the required offsets in java class and register native functions |