release-request-68cc9b2a-98ae-4fbf-8b56-3e535855f399-for-git_oc-mr1-release-4269864 snap-temp-L25700000092502312

Change-Id: I0488d59dcbc8c2d2b8b85cccebac51c0b7ee26b0
diff --git a/android/Android.bp b/android/Android.bp
index bbe6fed..d5a1312 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -2,6 +2,7 @@
     name: "libsqlite3_android",
     vendor_available: true,
     host_supported: true,
+    cflags: ["-DSQLITE_ENABLE_ICU"],
     srcs: [
         "PhoneNumberUtils.cpp",
         "OldPhoneNumberUtils.cpp",
@@ -15,6 +16,7 @@
     ],
     target: {
         vendor: {
+            cflags: ["-USQLITE_ENABLE_ICU"],
             exclude_shared_libs: ["libicuuc", "libicui18n"],
         },
     },
diff --git a/android/sqlite3_android.cpp b/android/sqlite3_android.cpp
index da40647..659ee6c 100644
--- a/android/sqlite3_android.cpp
+++ b/android/sqlite3_android.cpp
@@ -21,13 +21,6 @@
 #include <string.h>
 #include <unistd.h>
 
-// ICU is turned off when sqlite is built for VNDK
-#ifndef __ANDROID_VNDK__
-#define SQLITE_ENABLE_ICU
-#else
-#undef SQLITE_ENABLE_ICU
-#endif
-
 #ifdef SQLITE_ENABLE_ICU
 #include <unicode/ucol.h>
 #include <unicode/uiter.h>
diff --git a/dist/Android.bp b/dist/Android.bp
index 75d03ab..95cd1ae 100644
--- a/dist/Android.bp
+++ b/dist/Android.bp
@@ -54,7 +54,6 @@
     target: {
         android: {
             cflags: [
-                "-DSQLITE_ENABLE_ICU",
                 "-DUSE_PREAD64",
                 "-Dfdatasync=fdatasync",
                 "-DHAVE_MALLOC_H=1",
@@ -83,6 +82,7 @@
                 "libicuuc",
                 "libicui18n",
             ],
+            cflags: ["-DSQLITE_ENABLE_ICU"],
 
             // include android specific methods
             whole_static_libs: ["libsqlite3_android"],
@@ -106,6 +106,7 @@
             enabled: true,
         },
         vendor: {
+            cflags: ["-USQLITE_ENABLE_ICU"],
             exclude_shared_libs: ["libicuuc", "libicui18n"],
         },
     },
diff --git a/dist/Android.patch b/dist/Android.patch
index 8132ee2..95cde52 100644
--- a/dist/Android.patch
+++ b/dist/Android.patch
@@ -39,24 +39,8 @@
  
 diff -r -u -d orig/sqlite3.c ./sqlite3.c
 --- orig/sqlite3.c	2017-08-04 10:42:31.294648222 +0900
-+++ ./sqlite3.c	2017-08-10 00:35:18.935880997 +0900
-@@ -84,6 +84,15 @@
- #endif
- 
- /*
-+** When sqlite is built for the VNDK, ICU is disabled because
-+** libicuuc.so and libicui18n.so aren't available then.
-+** TODO(b/64514237): move this to Android.bp
-+*/
-+#ifdef __ANDROID_VNDK__
-+#undef SQLITE_ENABLE_ICU
-+#endif
-+
-+/*
- ** Include the header file used to customize the compiler options for MSVC.
- ** This should be done first so that it can successfully prevent spurious
- ** compiler warnings due to subsequent content in this file and other files
-@@ -33618,7 +33627,7 @@
++++ ./sqlite3.c	2017-08-10 13:27:29.784569745 +0900
+@@ -33618,7 +33618,7 @@
    SimulateIOError( rc=1 );
    if( rc!=0 ){
      storeLastErrno((unixFile*)id, errno);
@@ -65,7 +49,7 @@
    }
    *pSize = buf.st_size;
  
-@@ -33654,7 +33663,7 @@
+@@ -33654,7 +33654,7 @@
      struct stat buf;              /* Used to hold return values of fstat() */
     
      if( osFstat(pFile->h, &buf) ){
@@ -74,7 +58,7 @@
      }
  
      nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk;
-@@ -34262,7 +34271,7 @@
+@@ -34262,7 +34262,7 @@
      ** with the same permissions.
      */
      if( osFstat(pDbFd->h, &sStat) ){
@@ -83,7 +67,7 @@
        goto shm_open_err;
      }
  
-@@ -116120,7 +116129,7 @@
+@@ -116120,7 +116120,7 @@
    }
    if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
      sqlite3SetString(pzErrMsg, db, "unsupported file format");
@@ -92,7 +76,7 @@
      goto initone_error_out;
    }
  
-@@ -149914,13 +149923,25 @@
+@@ -149914,13 +149914,25 @@
    ** module with sqlite.
    */
    if( SQLITE_OK==rc 
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
index 3eaac07..59bba65 100644
--- a/dist/sqlite3.c
+++ b/dist/sqlite3.c
@@ -84,15 +84,6 @@
 #endif
 
 /*
-** When sqlite is built for the VNDK, ICU is disabled because
-** libicuuc.so and libicui18n.so aren't available then.
-** TODO(b/64514237): move this to Android.bp
-*/
-#ifdef __ANDROID_VNDK__
-#undef SQLITE_ENABLE_ICU
-#endif
-
-/*
 ** Include the header file used to customize the compiler options for MSVC.
 ** This should be done first so that it can successfully prevent spurious
 ** compiler warnings due to subsequent content in this file and other files