Merge changes Icc5b8563,I4298502e,If8b715f4,If46d741e,I702d547d, ...
* changes:
Build native EventLog and XmlBlock for host linux.
Build native AssetManager and friends for host linux.
Build and potentially register Trace for host.
Build and register native MessageQueue for host.
Build native Log for host.
Build and register SystemProperties for host
Compile SystemClock.cpp for host.
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 640b8f9..b21221f 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -33,12 +33,19 @@
srcs: [
"android_animation_PropertyValuesHolder.cpp",
+ "android_content_res_ApkAssets.cpp",
"android_graphics_Canvas.cpp",
"android_graphics_ColorSpace.cpp",
"android_graphics_drawable_AnimatedVectorDrawable.cpp",
"android_graphics_drawable_VectorDrawable.cpp",
"android_graphics_Picture.cpp",
"android_nio_utils.cpp",
+ "android_os_MessageQueue.cpp",
+ "android_os_SystemClock.cpp",
+ "android_os_SystemProperties.cpp",
+ "android_os_Trace.cpp",
+ "android_util_EventLog.cpp",
+ "android_util_Log.cpp",
"android_util_PathParser.cpp",
"android_view_DisplayListCanvas.cpp",
"android_view_RenderNode.cpp",
@@ -69,6 +76,9 @@
"android/graphics/fonts/FontFamily.cpp",
"android/graphics/text/LineBreaker.cpp",
"android/graphics/text/MeasuredText.cpp",
+ "android_util_AssetManager.cpp",
+ "android_util_StringBlock.cpp",
+ "android_util_XmlBlock.cpp",
"com_android_internal_util_VirtualRefBasePtr.cpp",
"com_android_internal_view_animation_NativeInterpolatorFactoryHelper.cpp",
],
@@ -166,27 +176,18 @@
"android_os_HwRemoteBinder.cpp",
"android_os_NativeHandle.cpp",
"android_os_MemoryFile.cpp",
- "android_os_MessageQueue.cpp",
"android_os_Parcel.cpp",
"android_os_SELinux.cpp",
"android_os_SharedMemory.cpp",
- "android_os_SystemClock.cpp",
- "android_os_SystemProperties.cpp",
- "android_os_Trace.cpp",
"android_os_UEventObserver.cpp",
"android_os_VintfObject.cpp",
"android_os_VintfRuntimeInfo.cpp",
"android_net_LocalSocketImpl.cpp",
"android_net_NetUtils.cpp",
- "android_util_AssetManager.cpp",
"android_util_Binder.cpp",
- "android_util_EventLog.cpp",
- "android_util_Log.cpp",
"android_util_StatsLog.cpp",
"android_util_MemoryIntArray.cpp",
"android_util_Process.cpp",
- "android_util_StringBlock.cpp",
- "android_util_XmlBlock.cpp",
"android_util_jar_StrictJarFile.cpp",
"android/graphics/AnimatedImageDrawable.cpp",
"android/graphics/Camera.cpp",
@@ -242,7 +243,6 @@
"android_backup_FileBackupHelperBase.cpp",
"android_backup_BackupHelperDispatcher.cpp",
"android_app_backup_FullBackup.cpp",
- "android_content_res_ApkAssets.cpp",
"android_content_res_ObbScanner.cpp",
"android_content_res_Configuration.cpp",
"android_security_Scrypt.cpp",
diff --git a/core/jni/LayoutlibLoader.cpp b/core/jni/LayoutlibLoader.cpp
index dd5113c..eb70035 100644
--- a/core/jni/LayoutlibLoader.cpp
+++ b/core/jni/LayoutlibLoader.cpp
@@ -49,6 +49,10 @@
namespace android {
extern int register_android_animation_PropertyValuesHolder(JNIEnv *env);
+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_graphics_Canvas(JNIEnv* env);
extern int register_android_graphics_ColorFilter(JNIEnv* env);
extern int register_android_graphics_ColorSpace(JNIEnv* env);
@@ -66,6 +70,12 @@
extern int register_android_graphics_fonts_FontFamily(JNIEnv* env);
extern int register_android_graphics_text_LineBreaker(JNIEnv* env);
extern int register_android_graphics_text_MeasuredText(JNIEnv* env);
+extern int register_android_os_MessageQueue(JNIEnv* env);
+extern int register_android_os_SystemClock(JNIEnv* env);
+extern int register_android_os_SystemProperties(JNIEnv* env);
+extern int register_android_os_Trace(JNIEnv* env);
+extern int register_android_util_EventLog(JNIEnv* env);
+extern int register_android_util_Log(JNIEnv* env);
extern int register_android_util_PathParser(JNIEnv* env);
extern int register_android_view_RenderNode(JNIEnv* env);
extern int register_android_view_DisplayListCanvas(JNIEnv* env);
@@ -78,9 +88,13 @@
};
// Map of all possible class names to register to their corresponding JNI registration function pointer
-// The actual list of registered classes will be determined at runtime via the com.android.tools.layoutlib.create.NativeConfig class
+// The actual list of registered classes will be determined at runtime via the 'native_classes' System property
static const std::unordered_map<std::string, RegJNIRec> gRegJNIMap = {
{"android.animation.PropertyValuesHolder", REG_JNI(register_android_animation_PropertyValuesHolder)},
+ {"android.content.AssetManager", REG_JNI(register_android_content_AssetManager)},
+ {"android.content.StringBlock", REG_JNI(register_android_content_StringBlock)},
+ {"android.content.XmlBlock", REG_JNI(register_android_content_XmlBlock)},
+ {"android.content.res.ApkAssets", REG_JNI(register_android_content_res_ApkAssets)},
{"android.graphics.Bitmap", REG_JNI(register_android_graphics_Bitmap)},
{"android.graphics.BitmapFactory", REG_JNI(register_android_graphics_BitmapFactory)},
{"android.graphics.ByteBufferStreamAdaptor", REG_JNI(register_android_graphics_ByteBufferStreamAdaptor)},
@@ -111,11 +125,16 @@
{"android.graphics.fonts.FontFamily", REG_JNI(register_android_graphics_fonts_FontFamily)},
{"android.graphics.text.LineBreaker", REG_JNI(register_android_graphics_text_LineBreaker)},
{"android.graphics.text.MeasuredText", REG_JNI(register_android_graphics_text_MeasuredText)},
+ {"android.os.MessageQueue", REG_JNI(register_android_os_MessageQueue)},
+ {"android.os.SystemClock", REG_JNI(register_android_os_SystemClock)},
+ {"android.os.SystemProperties", REG_JNI(register_android_os_SystemProperties)},
+ {"android.os.Trace", REG_JNI(register_android_os_Trace)},
+ {"android.util.EventLog", REG_JNI(register_android_util_EventLog)},
+ {"android.util.Log", REG_JNI(register_android_util_Log)},
{"android.util.PathParser", REG_JNI(register_android_util_PathParser)},
{"com.android.internal.util.VirtualRefBasePtr", REG_JNI(register_com_android_internal_util_VirtualRefBasePtr)},
{"com.android.internal.view.animation.NativeInterpolatorFactoryHelper", REG_JNI(register_com_android_internal_view_animation_NativeInterpolatorFactoryHelper)},
};
-
// Vector to store the names of classes that need delegates of their native methods
static vector<string> classesToDelegate;
@@ -232,6 +251,8 @@
const char* path = env->GetStringUTFChars(stringPath, 0);
u_setDataDirectory(path);
env->ReleaseStringUTFChars(stringPath, path);
+
+
return JNI_VERSION_1_6;
}
diff --git a/core/jni/android_os_SystemProperties.cpp b/core/jni/android_os_SystemProperties.cpp
index 9ec7517..ab52314 100644
--- a/core/jni/android_os_SystemProperties.cpp
+++ b/core/jni/android_os_SystemProperties.cpp
@@ -19,7 +19,6 @@
#include "android-base/logging.h"
#include "android-base/properties.h"
-#include "cutils/properties.h"
#include "utils/misc.h"
#include <utils/Log.h>
#include "jni.h"
diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp
index 2b471fe..d6d9391 100644
--- a/core/jni/android_util_AssetManager.cpp
+++ b/core/jni/android_util_AssetManager.cpp
@@ -18,10 +18,8 @@
#define LOG_TAG "asset"
#include <inttypes.h>
-#include <linux/capability.h>
#include <stdio.h>
#include <sys/stat.h>
-#include <sys/system_properties.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -399,6 +397,7 @@
return array_map;
}
+#ifdef __ANDROID__ // Layoutlib does not support parcel
static jobject ReturnParcelFileDescriptor(JNIEnv* env, std::unique_ptr<Asset> asset,
jlongArray out_offsets) {
off64_t start_offset, length;
@@ -430,6 +429,15 @@
}
return newParcelFileDescriptor(env, file_desc);
}
+#else
+static jobject ReturnParcelFileDescriptor(JNIEnv* env, std::unique_ptr<Asset> asset,
+ jlongArray out_offsets) {
+ jniThrowException(env, "java/lang/UnsupportedOperationException",
+ "Implement me");
+ // never reached
+ return nullptr;
+}
+#endif
static jint NativeGetGlobalAssetCount(JNIEnv* /*env*/, jobject /*clazz*/) {
return Asset::getGlobalCount();
diff --git a/core/jni/android_util_Log.cpp b/core/jni/android_util_Log.cpp
index a6adc88..ad35b7d 100644
--- a/core/jni/android_util_Log.cpp
+++ b/core/jni/android_util_Log.cpp
@@ -20,7 +20,6 @@
#include <android-base/macros.h>
#include <assert.h>
-#include <cutils/properties.h>
#include <log/log.h> // For LOGGER_ENTRY_MAX_PAYLOAD.
#include <utils/Log.h>
#include <utils/String8.h>
diff --git a/core/res/Android.bp b/core/res/Android.bp
index 3402033..3dc74f8 100644
--- a/core/res/Android.bp
+++ b/core/res/Android.bp
@@ -38,6 +38,12 @@
// Create package-export.apk, which other packages can use to get
// PRODUCT-agnostic resource data like IDs and type definitions.
export_package_resources: true,
+
+ dist: {
+ targets: [
+ "simulated_device_launcher",
+ ],
+ },
}
// This logic can be removed once robolectric's transition to binary resources is complete