Replace _FX_PLATFORM_ANDROID_ with defined(OS_ANDROID).

Use build/build_config.h to standarize on Chromium's platform defines.
Also remove _FX_OS_ANDROID_ and an unnecessary #pragma pack.

Change-Id: I8fd2faae6f115313b80c13b990478d2e68db871e
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/38491
Auto-Submit: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp
index 8d5a637..286e634 100644
--- a/core/fxcrt/cfx_datetime.cpp
+++ b/core/fxcrt/cfx_datetime.cpp
@@ -6,9 +6,10 @@
 
 #include "core/fxcrt/cfx_datetime.h"
 
+#include "build/build_config.h"
 #include "core/fxcrt/fx_system.h"
 
-#if _FX_OS_ == _FX_OS_LINUX_ || _FX_OS_ == _FX_OS_ANDROID_ || \
+#if _FX_OS_ == _FX_OS_LINUX_ || defined(OS_ANDROID) || \
     _FX_OS_ == _FX_OS_MACOSX_ || _FX_OS_ == _FX_OS_WASM_
 #include <sys/time.h>
 #include <time.h>
diff --git a/core/fxcrt/cfx_datetime.h b/core/fxcrt/cfx_datetime.h
index 910a847..a965df7 100644
--- a/core/fxcrt/cfx_datetime.h
+++ b/core/fxcrt/cfx_datetime.h
@@ -91,15 +91,9 @@
   uint16_t millisecond_;
 };
 
-#if _FX_OS_ != _FX_OS_ANDROID_
-#pragma pack(push, 1)
-#endif
 struct FX_TIMEZONE {
   int8_t tzHour;
   uint8_t tzMinute;
 };
-#if _FX_OS_ != _FX_OS_ANDROID_
-#pragma pack(pop)
-#endif
 
 #endif  // CORE_FXCRT_CFX_DATETIME_H_
diff --git a/core/fxcrt/cfx_fileaccess_posix.h b/core/fxcrt/cfx_fileaccess_posix.h
index 9222c46..6d52024 100644
--- a/core/fxcrt/cfx_fileaccess_posix.h
+++ b/core/fxcrt/cfx_fileaccess_posix.h
@@ -7,12 +7,12 @@
 #ifndef CORE_FXCRT_CFX_FILEACCESS_POSIX_H_
 #define CORE_FXCRT_CFX_FILEACCESS_POSIX_H_
 
+#include "build/build_config.h"
 #include "core/fxcrt/fileaccess_iface.h"
 #include "core/fxcrt/fx_system.h"
 
 #if _FX_PLATFORM_ != _FX_PLATFORM_LINUX_ && \
-    _FX_PLATFORM_ != _FX_PLATFORM_APPLE_ && \
-    _FX_PLATFORM_ != _FX_PLATFORM_ANDROID_
+    _FX_PLATFORM_ != _FX_PLATFORM_APPLE_ && !defined(OS_ANDROID)
 #error "Included on the wrong platform"
 #endif
 
diff --git a/core/fxcrt/fx_system.h b/core/fxcrt/fx_system.h
index b6faa99..f07246d 100644
--- a/core/fxcrt/fx_system.h
+++ b/core/fxcrt/fx_system.h
@@ -22,20 +22,15 @@
 #define _FX_OS_WIN64_ 2
 #define _FX_OS_LINUX_ 4
 #define _FX_OS_MACOSX_ 7
-#define _FX_OS_ANDROID_ 12
 #define _FX_OS_WASM_ 13
 
 // _FX_PLATFORM_ values;
 #define _FX_PLATFORM_WINDOWS_ 1  // _FX_OS_WIN32_ or _FX_OS_WIN64_.
 #define _FX_PLATFORM_LINUX_ 2    // _FX_OS_LINUX_ or _FX_OS_WASM_.
 #define _FX_PLATFORM_APPLE_ 3    // _FX_OS_MACOSX_ always.
-#define _FX_PLATFORM_ANDROID_ 4  // _FX_OS_ANDROID_ always.
 
 #ifndef _FX_OS_
-#if defined(__ANDROID__)
-#define _FX_OS_ _FX_OS_ANDROID_
-#define _FX_PLATFORM_ _FX_PLATFORM_ANDROID_
-#elif defined(_WIN32)
+#if defined(_WIN32)
 #define _FX_OS_ _FX_OS_WIN32_
 #define _FX_PLATFORM_ _FX_PLATFORM_WINDOWS_
 #elif defined(_WIN64)
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 33bef51..c4a7237 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -13,6 +13,7 @@
 #include <utility>
 #include <vector>
 
+#include "build/build_config.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxge/cfx_fontmgr.h"
 #include "core/fxge/cfx_substfont.h"
@@ -151,7 +152,7 @@
 
 #if _FX_PLATFORM_ == _FX_PLATFORM_LINUX_
 const char kNarrowFamily[] = "LiberationSansNarrow";
-#elif _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
+#elif defined(OS_ANDROID)
 const char kNarrowFamily[] = "RobotoCondensed";
 #else
 const char kNarrowFamily[] = "ArialNarrow";
@@ -597,8 +598,7 @@
       }
     } else {
       if (Charset == FX_CHARSET_Symbol) {
-#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || \
-    _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
+#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ || defined(OS_ANDROID)
         if (SubstName == "Symbol") {
           pSubstFont->m_Family = "Chrome Symbol";
           pSubstFont->m_Charset = FX_CHARSET_Symbol;
diff --git a/core/fxge/fx_ge_fontmap.cpp b/core/fxge/fx_ge_fontmap.cpp
index f60416c..74eee2f 100644
--- a/core/fxge/fx_ge_fontmap.cpp
+++ b/core/fxge/fx_ge_fontmap.cpp
@@ -6,6 +6,7 @@
 
 #include <memory>
 
+#include "build/build_config.h"
 #include "core/fxge/systemfontinfo_iface.h"
 
 #ifdef PDF_ENABLE_XFA
@@ -21,7 +22,7 @@
   return 0;
 }
 
-#if _FX_OS_ == _FX_OS_ANDROID_
+#if defined(OS_ANDROID)
 std::unique_ptr<SystemFontInfoIface> SystemFontInfoIface::CreateDefault(
     const char** pUnused) {
   return nullptr;
diff --git a/fpdfsdk/fpdf_save.cpp b/fpdfsdk/fpdf_save.cpp
index 6c9184a..76a434d 100644
--- a/fpdfsdk/fpdf_save.cpp
+++ b/fpdfsdk/fpdf_save.cpp
@@ -10,6 +10,7 @@
 #include <utility>
 #include <vector>
 
+#include "build/build_config.h"
 #include "core/fpdfapi/edit/cpdf_creator.h"
 #include "core/fpdfapi/parser/cpdf_array.h"
 #include "core/fpdfapi/parser/cpdf_dictionary.h"
@@ -37,7 +38,7 @@
 #include "xfa/fxfa/parser/cxfa_object.h"
 #endif
 
-#if _FX_OS_ == _FX_OS_ANDROID_
+#if defined(OS_ANDROID)
 #include <time.h>
 #else
 #include <ctime>
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 11edff0..9cc2bbc 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -17,6 +17,7 @@
 #include <utility>
 #include <vector>
 
+#include "build/build_config.h"
 #include "core/fpdfdoc/cpdf_formcontrol.h"
 #include "core/fpdfdoc/cpdf_interactiveform.h"
 #include "core/fxcrt/fx_extension.h"
@@ -63,7 +64,7 @@
 
 namespace {
 
-#if _FX_OS_ != _FX_OS_ANDROID_
+#if !defined(OS_ANDROID)
 constexpr double kDoubleCorrect = 0.000000000000001;
 #endif
 
@@ -99,7 +100,7 @@
                               JSPLATFORM_ALERT_ICON_STATUS);
 }
 
-#if _FX_OS_ != _FX_OS_ANDROID_
+#if !defined(OS_ANDROID)
 ByteString CalculateString(double dValue,
                            int iDec,
                            int* iDec2,
@@ -170,7 +171,7 @@
   return c == '.' || c == ',';
 }
 
-#if _FX_OS_ != _FX_OS_ANDROID_
+#if !defined(OS_ANDROID)
 bool IsStyleWithDigitSeparator(int style) {
   return style == 0 || style == 2;
 }
@@ -193,7 +194,7 @@
   return IsStyleWithCommaDecimalMark(style) ? ',' : '.';
 }
 
-#if _FX_OS_ != _FX_OS_ANDROID_
+#if !defined(OS_ANDROID)
 void NormalizeDecimalMark(ByteString* str) {
   str->Replace(",", ".");
 }
@@ -582,7 +583,7 @@
 CJS_Result CJS_PublicMethods::AFNumber_Format(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-#if _FX_OS_ != _FX_OS_ANDROID_
+#if !defined(OS_ANDROID)
   if (params.size() != 6)
     return CJS_Result::Failure(JSMessage::kParamError);
 
@@ -778,7 +779,7 @@
 CJS_Result CJS_PublicMethods::AFPercent_Format(
     CJS_Runtime* pRuntime,
     const std::vector<v8::Local<v8::Value>>& params) {
-#if _FX_OS_ != _FX_OS_ANDROID_
+#if !defined(OS_ANDROID)
   if (params.size() < 2)
     return CJS_Result::Failure(JSMessage::kParamError);
 
diff --git a/fxjs/cjs_util.cpp b/fxjs/cjs_util.cpp
index ce8dd77..4f83ea6 100644
--- a/fxjs/cjs_util.cpp
+++ b/fxjs/cjs_util.cpp
@@ -14,6 +14,7 @@
 #include <string>
 #include <vector>
 
+#include "build/build_config.h"
 #include "core/fxcrt/fx_extension.h"
 #include "fxjs/cjs_event_context.h"
 #include "fxjs/cjs_eventhandler.h"
@@ -24,7 +25,7 @@
 #include "fxjs/js_define.h"
 #include "fxjs/js_resources.h"
 
-#if _FX_OS_ == _FX_OS_ANDROID_
+#if defined(OS_ANDROID)
 #include <ctype.h>
 #endif
 
diff --git a/xfa/fgas/font/cfx_fontsourceenum_file.cpp b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
index f14d09b..386dc59 100644
--- a/xfa/fgas/font/cfx_fontsourceenum_file.cpp
+++ b/xfa/fgas/font/cfx_fontsourceenum_file.cpp
@@ -8,6 +8,8 @@
 
 #include <iterator>
 
+#include "build/build_config.h"
+
 namespace {
 
 constexpr char kFolderSeparator = '/';
@@ -18,7 +20,7 @@
     "/usr/share/X11/fonts/TTF", "/usr/local/share/fonts",
 #elif _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
     "~/Library/Fonts", "/Library/Fonts", "/System/Library/Fonts",
-#elif _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
+#elif defined(OS_ANDROID)
     "/system/fonts",
 #endif
 };
diff --git a/xfa/fgas/font/fgas_fontutils.cpp b/xfa/fgas/font/fgas_fontutils.cpp
index 3087309..f95a5ad 100644
--- a/xfa/fgas/font/fgas_fontutils.cpp
+++ b/xfa/fgas/font/fgas_fontutils.cpp
@@ -6,6 +6,7 @@
 
 #include "xfa/fgas/font/fgas_fontutils.h"
 
+#include "build/build_config.h"
 #include "core/fxcrt/fx_codepage.h"
 #include "core/fxcrt/fx_extension.h"
 #include "xfa/fgas/font/cfgas_fontmgr.h"
@@ -1406,7 +1407,7 @@
      "Kokonor,Damascus,STIXNonUnicode,STHeiti,Arial Black", 0, 1252},
     {0xfef135f8, "AdobeHeitiStd-Regular", "Heiti TC,STHeiti", 0, 936},
 };
-#elif _FX_PLATFORM_ == _FX_PLATFORM_ANDROID_
+#elif defined(OS_ANDROID)
 const FGAS_FontInfo g_XFAFontsMap[] = {
     {0x01d5d33e, "SimSun", "Droid Sans Fallback", 0, 936},
     {0x01e4f102, "YouYuan", "Droid Sans Fallback", 1, 936},