Commit 065fe237 authored by Clark DuVall's avatar Clark DuVall Committed by Chromium LUCI CQ

Bring back vr module with isolated splits enabled

Now that bundletool has been updated and isolated splits support JNI in
DFMs, we can bring back the vr module. This requires telling the native
code which split to load the vr module from. See crbug.com/1145287 for
more context.

Bug: 1145287
Change-Id: I594d98b1cff002e5966700487fd906f25de109cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2569783
Commit-Queue: Clark DuVall <cduvall@chromium.org>
Reviewed-by: default avatarAlexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833297}
parent 2e0c74cf
......@@ -118,4 +118,5 @@ generate_jni("jni_headers") {
"java/src/org/chromium/chrome/browser/vr/keyboard/GvrKeyboardLoaderClient.java",
"java/src/org/chromium/chrome/browser/vr/keyboard/TextEditAction.java",
]
split_name = "vr"
}
......@@ -160,13 +160,13 @@ public abstract class VrDelegate implements VrHandler {
}
}
/* package */ void setSystemUiVisibilityForVr(Activity activity) {
public void setSystemUiVisibilityForVr(Activity activity) {
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
int flags = activity.getWindow().getDecorView().getSystemUiVisibility();
activity.getWindow().getDecorView().setSystemUiVisibility(flags | VR_SYSTEM_UI_FLAGS);
}
/* package */ void addBlackOverlayViewForActivity(ChromeActivity activity) {
public void addBlackOverlayViewForActivity(ChromeActivity activity) {
View overlay = activity.getWindow().findViewById(R.id.vr_overlay_view);
if (overlay != null) return;
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
......@@ -178,7 +178,7 @@ public abstract class VrDelegate implements VrHandler {
decor.addView(v, params);
}
/* package */ void removeBlackOverlayView(Activity activity, boolean animate) {
public void removeBlackOverlayView(Activity activity, boolean animate) {
View overlay = activity.getWindow().findViewById(R.id.vr_overlay_view);
if (overlay == null) return;
FrameLayout decor = (FrameLayout) activity.getWindow().getDecorView();
......@@ -207,7 +207,7 @@ public abstract class VrDelegate implements VrHandler {
}
}
/* package */ boolean activitySupportsVrBrowsing(Activity activity) {
public boolean activitySupportsVrBrowsing(Activity activity) {
if (activity instanceof ChromeTabbedActivity) return true;
return false;
}
......
......@@ -8,7 +8,7 @@ import org.chromium.components.module_installer.builder.ModuleInterface;
/** Provides delegate interfaces that can be used to call into VR. */
@ModuleInterface(module = "vr", impl = "org.chromium.chrome.browser.vr.VrDelegateProviderImpl")
/* package */ interface VrDelegateProvider {
public interface VrDelegateProvider {
VrDelegate getDelegate();
VrIntentDelegate getIntentDelegate();
}
......@@ -103,7 +103,7 @@ public class VrModuleProvider implements ModuleInstallUi.FailureUiListener {
// TODO(crbug.com/870055): JNI should be registered in the shared VR library's JNI_OnLoad
// function. Do this once we have a shared VR library.
/* package */ static void registerJni() {
public static void registerJni() {
VrModuleProviderJni.get().registerJni();
}
......
......@@ -18,8 +18,5 @@ vr_module_desc = {
# by native library load). Therefore disable auto-load on Module.getImpl();
# the VR DFM manages its own loading on start-up and on install.
load_native_on_get_impl = false
# TODO(crbug.com/1145287): Need to support @CalledByNative in isolated splits
# before this can be enabled.
# uses_split = "chrome"
uses_split = "chrome"
}
......@@ -358,6 +358,7 @@ if (enable_gvr_services) {
generate_jni("jni_headers") {
sources = java_sources_needing_jni
split_name = "vr"
}
android_library("java") {
......
......@@ -12,6 +12,7 @@
// 2. Use absolute path instead of relative path.
// 3. Removed all helper functions such as: Create.
// 4. Added function RegisterDisplaySynchronizerNatives at the end of this file.
// 5. Added "vr" as an argument to base::android::LazyGetClass.
#ifndef com_google_vr_cardboard_DisplaySynchronizer_JNI
#define com_google_vr_cardboard_DisplaySynchronizer_JNI
......@@ -35,8 +36,8 @@ const char kDisplaySynchronizerClassPath[] =
// Leaking this jclass as we cannot use LazyInstance from some threads.
std::atomic<jclass> g_DisplaySynchronizer_clazz __attribute__((unused))
(nullptr);
#define DisplaySynchronizer_clazz(env) \
base::android::LazyGetClass(env, kDisplaySynchronizerClassPath, \
#define DisplaySynchronizer_clazz(env) \
base::android::LazyGetClass(env, kDisplaySynchronizerClassPath, "vr", \
&g_DisplaySynchronizer_clazz)
} // namespace
......
......@@ -14,6 +14,7 @@
// 4. Removed external functions that don't have implementation in shim file.
// 5. Changed RectF, Point, and PoseTracker to correct package name.
// 6. Added function RegisterGvrApiNatives at the end of this file.
// 7. Added "vr" as an argument to base::android::LazyGetClass.
#ifndef com_google_vr_ndk_base_GvrApi_JNI
#define com_google_vr_ndk_base_GvrApi_JNI
......@@ -35,7 +36,7 @@ const char kGvrApiClassPath[] = "com/google/vr/ndk/base/GvrApi";
// Leaking this jclass as we cannot use LazyInstance from some threads.
std::atomic<jclass> g_GvrApi_clazz __attribute__((unused)) (nullptr);
#define GvrApi_clazz(env) \
base::android::LazyGetClass(env, kGvrApiClassPath, &g_GvrApi_clazz)
base::android::LazyGetClass(env, kGvrApiClassPath, "vr", &g_GvrApi_clazz)
} // namespace
......
......@@ -17,6 +17,7 @@
// generate the file. But the real jni functions in the static library
// doesn't have the prefix.
// 6. Added function RegisterNativeCallbacksNatives at the end of this file.
// 7. Added "vr" as an argument to base::android::LazyGetClass.
#ifndef com_google_vr_internal_controller_NativeCallbacks_JNI
#define com_google_vr_internal_controller_NativeCallbacks_JNI
......@@ -38,8 +39,8 @@ const char kNativeCallbacksClassPath[] =
"com/google/vr/internal/controller/NativeCallbacks";
// Leaking this jclass as we cannot use LazyInstance from some threads.
std::atomic<jclass> g_NativeCallbacks_clazz __attribute__((unused)) (nullptr);
#define NativeCallbacks_clazz(env) \
base::android::LazyGetClass(env, kNativeCallbacksClassPath, \
#define NativeCallbacks_clazz(env) \
base::android::LazyGetClass(env, kNativeCallbacksClassPath, "vr", \
&g_NativeCallbacks_clazz)
} // namespace
......
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