From 1044702c35a226f33341f6bdeb47644f71f6c45f Mon Sep 17 00:00:00 2001 From: Jerome Gaillard Date: Mon, 2 Nov 2020 16:16:17 +0000 Subject: [PATCH] Add SQLite to libandroid_runtime for linux host This allows the possibility to use it with Layoutlib/Helium. Test: lunch sdk && m libandroid_runtime Change-Id: I93b1ebec968566aeb9209da607ce8a80489ed060 --- core/jni/Android.bp | 6 ++++++ core/jni/LayoutlibLoader.cpp | 9 +++++++++ libs/androidfw/Android.bp | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/core/jni/Android.bp b/core/jni/Android.bp index 1123f20c3e7e8..2acfebbf17406 100644 --- a/core/jni/Android.bp +++ b/core/jni/Android.bp @@ -303,6 +303,11 @@ cc_library_shared { linux_glibc: { srcs: [ "android_content_res_ApkAssets.cpp", + "android_database_CursorWindow.cpp", + "android_database_SQLiteCommon.cpp", + "android_database_SQLiteConnection.cpp", + "android_database_SQLiteGlobal.cpp", + "android_database_SQLiteDebug.cpp", "android_hardware_input_InputApplicationHandle.cpp", "android_os_MessageQueue.cpp", "android_os_Parcel.cpp", @@ -326,6 +331,7 @@ cc_library_shared { static_libs: [ "libinput", "libbinderthreadstateutils", + "libsqlite", ], shared_libs: [ // libbinder needs to be shared since it has global state diff --git a/core/jni/LayoutlibLoader.cpp b/core/jni/LayoutlibLoader.cpp index 4e50f87c086bf..3e513df98f143 100644 --- a/core/jni/LayoutlibLoader.cpp +++ b/core/jni/LayoutlibLoader.cpp @@ -41,6 +41,10 @@ extern int register_android_content_AssetManager(JNIEnv* env); extern int register_android_content_StringBlock(JNIEnv* env); extern int register_android_content_XmlBlock(JNIEnv* env); extern int register_android_content_res_ApkAssets(JNIEnv* env); +extern int register_android_database_CursorWindow(JNIEnv* env); +extern int register_android_database_SQLiteConnection(JNIEnv* env); +extern int register_android_database_SQLiteGlobal(JNIEnv* env); +extern int register_android_database_SQLiteDebug(JNIEnv* env); extern int register_android_os_FileObserver(JNIEnv* env); extern int register_android_os_MessageQueue(JNIEnv* env); extern int register_android_os_SystemClock(JNIEnv* env); @@ -65,6 +69,11 @@ static const std::unordered_map gRegJNIMap = { #ifdef __linux__ {"android.content.res.ApkAssets", REG_JNI(register_android_content_res_ApkAssets)}, {"android.content.res.AssetManager", REG_JNI(register_android_content_AssetManager)}, + {"android.database.CursorWindow", REG_JNI(register_android_database_CursorWindow)}, + {"android.database.sqlite.SQLiteConnection", + REG_JNI(register_android_database_SQLiteConnection)}, + {"android.database.sqlite.SQLiteGlobal", REG_JNI(register_android_database_SQLiteGlobal)}, + {"android.database.sqlite.SQLiteDebug", REG_JNI(register_android_database_SQLiteDebug)}, #endif {"android.content.res.StringBlock", REG_JNI(register_android_content_StringBlock)}, {"android.content.res.XmlBlock", REG_JNI(register_android_content_XmlBlock)}, diff --git a/libs/androidfw/Android.bp b/libs/androidfw/Android.bp index 903ca2aa07836..97ec59edb73d6 100644 --- a/libs/androidfw/Android.bp +++ b/libs/androidfw/Android.bp @@ -96,6 +96,11 @@ cc_library { "libz", ], }, + linux_glibc: { + srcs: [ + "CursorWindow.cpp", + ], + }, windows: { enabled: true, },