diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2014-12-09 23:09:50 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-12-09 23:09:52 +0000 |
commit | 3ef5033cdacbc44702d0b6ba687e81383348e2fd (patch) | |
tree | 46e84cc4517546391b4d102f7270385234057a25 /core/jni | |
parent | 4a6bafcb56d5fe5e2f30626b8836559e722e89a0 (diff) | |
parent | f4a637d0be2e028d1e78c8bf90ad17ec3f84b5f3 (diff) | |
download | frameworks_base-3ef5033cdacbc44702d0b6ba687e81383348e2fd.zip frameworks_base-3ef5033cdacbc44702d0b6ba687e81383348e2fd.tar.gz frameworks_base-3ef5033cdacbc44702d0b6ba687e81383348e2fd.tar.bz2 |
Merge "Camera2: Allow rendering to arbitrary surface sizes in LEGACY mode." into lmp-mr1-dev
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp index 8440a0e..b44c829 100644 --- a/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp +++ b/core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp @@ -470,6 +470,26 @@ static jint LegacyCameraDevice_nativeDetectSurfaceDimens(JNIEnv* env, jobject th return NO_ERROR; } +static jint LegacyCameraDevice_nativeDetectSurfaceUsageFlags(JNIEnv* env, jobject thiz, + jobject surface) { + ALOGV("nativeDetectSurfaceUsageFlags"); + + sp<ANativeWindow> anw; + if ((anw = getNativeWindow(env, surface)) == NULL) { + jniThrowException(env, "Ljava/lang/UnsupportedOperationException;", + "Could not retrieve native window from surface."); + return BAD_VALUE; + } + int32_t usage = 0; + status_t err = anw->query(anw.get(), NATIVE_WINDOW_CONSUMER_USAGE_BITS, &usage); + if(err != NO_ERROR) { + jniThrowException(env, "Ljava/lang/UnsupportedOperationException;", + "Error while querying surface usage bits"); + return err; + } + return usage; +} + static jint LegacyCameraDevice_nativeDetectTextureDimens(JNIEnv* env, jobject thiz, jobject surfaceTexture, jintArray dimens) { ALOGV("nativeDetectTextureDimens"); @@ -713,6 +733,9 @@ static JNINativeMethod gCameraDeviceMethods[] = { { "nativeGetJpegFooterSize", "()I", (void *)LegacyCameraDevice_nativeGetJpegFooterSize }, + { "nativeDetectSurfaceUsageFlags", + "(Landroid/view/Surface;)I", + (void *)LegacyCameraDevice_nativeDetectSurfaceUsageFlags }, }; // Get all the required offsets in java class and register native functions |