Commit 78a36aa4 authored by Alex Leung's avatar Alex Leung Committed by Commit Bot

Revert "Android: Switch cast_shell to use implicit JNI registration"

This reverts commit f1854090.

Reason for revert: Causes internal b/120143260.

Change-Id: I83286ee7cb9d5e96e63be66bc47efda802421232
Reviewed-on: https://chromium-review.googlesource.com/c/1354326
Commit-Queue: Alex Leung <alexleung@google.com>
Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612333}
parent 7e3227fb
...@@ -594,6 +594,11 @@ buildflag_header("chromecast_buildflags") { ...@@ -594,6 +594,11 @@ buildflag_header("chromecast_buildflags") {
} }
if (is_android) { if (is_android) {
generate_jni_registration("cast_shell_jni_registration") {
target = ":cast_shell_apk"
header_output = "$root_gen_dir/chromecast/android/${target_name}.h"
}
android_assets("cast_shell_apk_assets") { android_assets("cast_shell_apk_assets") {
assert(v8_use_external_startup_data) assert(v8_use_external_startup_data)
......
...@@ -15,6 +15,7 @@ cast_shared_library("libcast_shell_android") { ...@@ -15,6 +15,7 @@ cast_shared_library("libcast_shell_android") {
deps = [ deps = [
"//base", "//base",
"//chromecast:cast_shell_jni_registration",
"//chromecast:cast_shell_lib", "//chromecast:cast_shell_lib",
"//chromecast:chromecast_buildflags", "//chromecast:chromecast_buildflags",
"//chromecast/app", "//chromecast/app",
...@@ -24,11 +25,25 @@ cast_shared_library("libcast_shell_android") { ...@@ -24,11 +25,25 @@ cast_shared_library("libcast_shell_android") {
"//chromecast/base:jni_headers", "//chromecast/base:jni_headers",
"//chromecast/base/metrics", "//chromecast/base/metrics",
"//chromecast/browser", "//chromecast/browser",
"//components/crash/android:crash_android",
"//content/public/app:both", "//content/public/app:both",
"//content/public/browser", "//content/public/browser",
"//skia", "//skia",
] ]
# Explicit dependencies required for JNI registration to be able to find the
# native side functions.
if (is_component_build) {
deps += [
"//device/bluetooth",
"//device/gamepad",
"//media/midi",
"//ui/android",
"//ui/events/devices",
"//ui/shell_dialogs",
]
}
if (is_cast_using_cma_backend) { if (is_cast_using_cma_backend) {
deps += [ "//chromecast/media/cma/backend/android:cast_media_android" ] deps += [ "//chromecast/media/cma/backend/android:cast_media_android" ]
} }
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/android/jni_android.h" #include "base/android/jni_android.h"
#include "base/android/library_loader/library_loader_hooks.h"
#include "base/bind.h"
#include "chromecast/android/cast_shell_jni_registration.h"
#include "chromecast/app/cast_main_delegate.h" #include "chromecast/app/cast_main_delegate.h"
#include "content/public/app/content_jni_onload.h" #include "content/public/app/content_jni_onload.h"
#include "content/public/app/content_main.h" #include "content/public/app/content_main.h"
...@@ -11,6 +14,10 @@ ...@@ -11,6 +14,10 @@
// This is called by the VM when the shared library is first loaded. // This is called by the VM when the shared library is first loaded.
JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
base::android::InitVM(vm); base::android::InitVM(vm);
JNIEnv* env = base::android::AttachCurrentThread();
if (!RegisterMainDexNatives(env) || !RegisterNonMainDexNatives(env)) {
return -1;
}
if (!content::android::OnJNIOnLoadInit()) if (!content::android::OnJNIOnLoadInit())
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment