From 03bd07aa0d73d3c3d0431cf4ba8a19ca36b43da7 Mon Sep 17 00:00:00 2001 From: John Reck Date: Fri, 12 Jul 2019 13:53:04 -0700 Subject: [PATCH] Fix exception message buffer->flexFormat is only used if usingRGBAToJpegOverride is true, which appears to be the uncommon case. As such the unsupported format exception should be using the writerFormat instead, which is what's actually being looked up typically. Bug: 137323248 Test: snippet in bug & compare what format is actually switched on with what the exception message claims is unsupported. Change-Id: I54dda0088fd722126e80e38eebe5da2f26378e1d --- media/jni/android_media_ImageWriter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp index 08d2947b795f9..6d8b966f35d56 100644 --- a/media/jni/android_media_ImageWriter.cpp +++ b/media/jni/android_media_ImageWriter.cpp @@ -881,7 +881,7 @@ static bool Image_getLockedImageInfo(JNIEnv* env, LockedImage* buffer, int idx, pixelStride, rowStride); if (res != OK) { jniThrowExceptionFmt(env, "java/lang/UnsupportedOperationException", - "Pixel format: 0x%x is unsupported", buffer->flexFormat); + "Pixel format: 0x%x is unsupported", writerFormat); return false; } return true;