Skip to content
Snippets Groups Projects
Commit 66f0d93c authored by Narayan Kamath's avatar Narayan Kamath
Browse files

Don't allow SUPPORTED_ABIs to be set by the native bridge.

SUPPORTED_ABIs is a prioritized list of all ABIs a device
support, and must not vary depending on whether or not an app
is emulated.

bug: 18061712
Change-Id: I3ec3897d23e37c645b4d9d9e6e32aae9afff952c
parent a1ac84cd
No related branches found
No related tags found
No related merge requests found
...@@ -289,46 +289,6 @@ static void SetCpuAbi(JNIEnv* env, jclass build_class, const char* field, const ...@@ -289,46 +289,6 @@ static void SetCpuAbi(JNIEnv* env, jclass build_class, const char* field, const
} }
} }
static void SetSupportedAbis(JNIEnv* env, jclass build_class, const char* field,
const char* *values, int32_t value_count) {
if (value_count < 0) {
return;
}
if (values == nullptr && value_count > 0) {
ALOGW("More than zero values expected: %d.", value_count);
return;
}
jfieldID field_id = env->GetStaticFieldID(build_class, field, "[Ljava/lang/String;");
if (field_id != nullptr) {
// Create the array.
jobjectArray array = env->NewObjectArray(value_count, env->FindClass("java/lang/String"),
nullptr);
if (array == nullptr) {
env->ExceptionClear();
ALOGW("Could not create array.");
return;
}
// Fill the array.
for (int32_t i = 0; i < value_count; i++) {
jstring str = env->NewStringUTF(values[i]);
if (str == nullptr) {
env->ExceptionClear();
ALOGW("Could not create string %s.", values[i]);
return;
}
env->SetObjectArrayElement(array, i, str);
}
env->SetStaticObjectField(build_class, field_id, array);
} else {
env->ExceptionClear();
ALOGW("Could not find %s field.", field);
}
}
// Set up the environment for the bridged app. // Set up the environment for the bridged app.
static void SetupEnvironment(NativeBridgeCallbacks* callbacks, JNIEnv* env, const char* isa) { static void SetupEnvironment(NativeBridgeCallbacks* callbacks, JNIEnv* env, const char* isa) {
// Need a JNIEnv* to do anything. // Need a JNIEnv* to do anything.
...@@ -359,9 +319,6 @@ static void SetupEnvironment(NativeBridgeCallbacks* callbacks, JNIEnv* env, cons ...@@ -359,9 +319,6 @@ static void SetupEnvironment(NativeBridgeCallbacks* callbacks, JNIEnv* env, cons
if (bclass_id != nullptr) { if (bclass_id != nullptr) {
SetCpuAbi(env, bclass_id, "CPU_ABI", env_values->cpu_abi); SetCpuAbi(env, bclass_id, "CPU_ABI", env_values->cpu_abi);
SetCpuAbi(env, bclass_id, "CPU_ABI2", env_values->cpu_abi2); SetCpuAbi(env, bclass_id, "CPU_ABI2", env_values->cpu_abi2);
SetSupportedAbis(env, bclass_id, "SUPPORTED_ABIS", env_values->supported_abis,
env_values->abi_count);
} else { } else {
// For example in a host test environment. // For example in a host test environment.
env->ExceptionClear(); env->ExceptionClear();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment