Loading core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java +12 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,9 @@ public class LegacyCameraDevice implements AutoCloseable { public static final int MAX_DIMEN_FOR_ROUNDING = 1080; // maximum allowed width for rounding // Keep up to date with values in system/core/include/system/window.h public static final int NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW = 1; private CaptureResultExtras getExtrasFromRequest(RequestHolder holder) { if (holder == null) { return new CaptureResultExtras(ILLEGAL_VALUE, ILLEGAL_VALUE, ILLEGAL_VALUE, Loading Loading @@ -690,6 +693,13 @@ public class LegacyCameraDevice implements AutoCloseable { LegacyExceptionUtils.throwOnError(nativeSetNextTimestamp(surface, timestamp)); } static void setScalingMode(Surface surface, int mode) throws BufferQueueAbandonedException { checkNotNull(surface); LegacyExceptionUtils.throwOnError(nativeSetScalingMode(surface, mode)); } private static native int nativeDetectSurfaceType(Surface surface); private static native int nativeDetectSurfaceDimens(Surface surface, Loading Loading @@ -717,5 +727,7 @@ public class LegacyCameraDevice implements AutoCloseable { private static native int nativeDetectSurfaceUsageFlags(Surface surface); private static native int nativeSetScalingMode(Surface surface, int scalingMode); static native int nativeGetJpegFooterSize(); } core/java/android/hardware/camera2/legacy/RequestThreadManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,8 @@ public class RequestThreadManager { callbackOutputSizes.add(outSize); break; default: LegacyCameraDevice.setScalingMode(s, LegacyCameraDevice. NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); mPreviewOutputs.add(s); previewOutputSizes.add(outSize); break; Loading core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -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)); Loading Loading @@ -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 Loading Loading
core/java/android/hardware/camera2/legacy/LegacyCameraDevice.java +12 −0 Original line number Diff line number Diff line Loading @@ -87,6 +87,9 @@ public class LegacyCameraDevice implements AutoCloseable { public static final int MAX_DIMEN_FOR_ROUNDING = 1080; // maximum allowed width for rounding // Keep up to date with values in system/core/include/system/window.h public static final int NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW = 1; private CaptureResultExtras getExtrasFromRequest(RequestHolder holder) { if (holder == null) { return new CaptureResultExtras(ILLEGAL_VALUE, ILLEGAL_VALUE, ILLEGAL_VALUE, Loading Loading @@ -690,6 +693,13 @@ public class LegacyCameraDevice implements AutoCloseable { LegacyExceptionUtils.throwOnError(nativeSetNextTimestamp(surface, timestamp)); } static void setScalingMode(Surface surface, int mode) throws BufferQueueAbandonedException { checkNotNull(surface); LegacyExceptionUtils.throwOnError(nativeSetScalingMode(surface, mode)); } private static native int nativeDetectSurfaceType(Surface surface); private static native int nativeDetectSurfaceDimens(Surface surface, Loading Loading @@ -717,5 +727,7 @@ public class LegacyCameraDevice implements AutoCloseable { private static native int nativeDetectSurfaceUsageFlags(Surface surface); private static native int nativeSetScalingMode(Surface surface, int scalingMode); static native int nativeGetJpegFooterSize(); }
core/java/android/hardware/camera2/legacy/RequestThreadManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -384,6 +384,8 @@ public class RequestThreadManager { callbackOutputSizes.add(outSize); break; default: LegacyCameraDevice.setScalingMode(s, LegacyCameraDevice. NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); mPreviewOutputs.add(s); previewOutputSizes.add(outSize); break; Loading
core/jni/android_hardware_camera2_legacy_LegacyCameraDevice.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -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)); Loading Loading @@ -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 Loading