Enable ImageDecoder_nCreateFd for host Linux and host Mac
ImageDecoder_nCreateFd works as-is on host Linux and host Mac, as both
of these OS's support F_DUPFD_CLOEXEC.
Test: ShadowNativeImageDecoderTest in Google3
Flag: EXEMPT host-only change
Bug: 352587758
Change-Id: I4a62ef0156af78d2b59c0e9e39f5a8b8f8152164
diff --git a/libs/hwui/jni/ImageDecoder.cpp b/libs/hwui/jni/ImageDecoder.cpp
index 6744c6c..aebc4db 100644
--- a/libs/hwui/jni/ImageDecoder.cpp
+++ b/libs/hwui/jni/ImageDecoder.cpp
@@ -162,8 +162,8 @@
static jobject ImageDecoder_nCreateFd(JNIEnv* env, jobject /*clazz*/,
jobject fileDescriptor, jlong length, jboolean preferAnimation, jobject source) {
-#ifndef __ANDROID__ // LayoutLib for Windows does not support F_DUPFD_CLOEXEC
- return throw_exception(env, kSourceException, "Only supported on Android", nullptr, source);
+#ifdef _WIN32 // LayoutLib for Windows does not support F_DUPFD_CLOEXEC
+ return throw_exception(env, kSourceException, "Not supported on Windows", nullptr, source);
#else
int descriptor = jniGetFDFromFileDescriptor(env, fileDescriptor);