summaryrefslogtreecommitdiffstats
path: root/test/115-native-bridge
diff options
context:
space:
mode:
authorjgu21 <jinghui.gu@intel.com>2014-09-10 06:57:17 -0400
committerAndreas Gampe <agampe@google.com>2014-09-23 20:11:31 -0700
commita6da74e941d7cee498ac3880018a1d8dc953c6eb (patch)
treebb36d90e914f8a842abd7dd854ba168f9441e8db /test/115-native-bridge
parenta20b7b3ecf90bb761d7085403782721f2fb474c5 (diff)
downloadart-a6da74e941d7cee498ac3880018a1d8dc953c6eb.zip
art-a6da74e941d7cee498ac3880018a1d8dc953c6eb.tar.gz
art-a6da74e941d7cee498ac3880018a1d8dc953c6eb.tar.bz2
ART: Update for split native bridge initialization
Change-Id: I0b93da93251c6b4638de786bf98cf99df07c3fc2
Diffstat (limited to 'test/115-native-bridge')
-rw-r--r--test/115-native-bridge/expected.txt1
-rw-r--r--test/115-native-bridge/nativebridge.cc43
2 files changed, 42 insertions, 2 deletions
diff --git a/test/115-native-bridge/expected.txt b/test/115-native-bridge/expected.txt
index 808d968..a5eedc6 100644
--- a/test/115-native-bridge/expected.txt
+++ b/test/115-native-bridge/expected.txt
@@ -1,4 +1,5 @@
Native bridge initialized.
+Checking for getEnvValues.
Ready for native bridge tests.
Checking for support.
Getting trampoline for JNI_OnLoad with shorty (null).
diff --git a/test/115-native-bridge/nativebridge.cc b/test/115-native-bridge/nativebridge.cc
index 3acc643..442f99c 100644
--- a/test/115-native-bridge/nativebridge.cc
+++ b/test/115-native-bridge/nativebridge.cc
@@ -207,7 +207,8 @@ static NativeBridgeMethod* find_native_bridge_method(const char *name) {
}
// NativeBridgeCallbacks implementations
-extern "C" bool native_bridge_initialize(const android::NativeBridgeRuntimeCallbacks* art_cbs) {
+extern "C" bool native_bridge_initialize(const android::NativeBridgeRuntimeCallbacks* art_cbs,
+ const char* private_dir, const char* isa) {
if (art_cbs != nullptr) {
gNativeBridgeArtCallbacks = art_cbs;
printf("Native bridge initialized.\n");
@@ -263,11 +264,49 @@ extern "C" bool native_bridge_isSupported(const char* libpath) {
return strcmp(libpath, "libjavacore.so") != 0;
}
+namespace android {
+
+// Environment values required by the apps running with native bridge.
+struct NativeBridgeRuntimeValues {
+ const char* os_arch;
+ const char* cpu_abi;
+ const char* cpu_abi2;
+ const char* *supported_abis;
+ int32_t abi_count;
+};
+
+} // namespace android
+
+const char* supported_abis[] = {
+ "supported1", "supported2", "supported3"
+};
+
+const struct android::NativeBridgeRuntimeValues nb_env {
+ .os_arch = "os.arch",
+ .cpu_abi = "cpu_abi",
+ .cpu_abi2 = "cpu_abi2",
+ .supported_abis = supported_abis,
+ .abi_count = 3
+};
+
+extern "C" const struct android::NativeBridgeRuntimeValues* native_bridge_getAppEnv(
+ const char* abi) {
+ printf("Checking for getEnvValues.\n");
+
+ if (abi == nullptr) {
+ return nullptr;
+ }
+
+ return &nb_env;
+}
+
// "NativeBridgeItf" is effectively an API (it is the name of the symbol that will be loaded
// by the native bridge library).
android::NativeBridgeCallbacks NativeBridgeItf {
+ .version = 1,
.initialize = &native_bridge_initialize,
.loadLibrary = &native_bridge_loadLibrary,
.getTrampoline = &native_bridge_getTrampoline,
- .isSupported = &native_bridge_isSupported
+ .isSupported = &native_bridge_isSupported,
+ .getAppEnv = &native_bridge_getAppEnv
};