Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(627)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java

Issue 2467873004: Linking arm and arm64 gvr static shim library (Closed)
Patch Set: Final cleanup before review Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index 8f10219090afd7f7b84d877a0a906923ca86e72e..ebbe2440ef609f77c7ec2bbcdc8ef031b3796710 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -43,9 +43,11 @@ public class VrShellDelegate {
private Class<? extends VrShell> mVrShellClass;
private Class<? extends NonPresentingGvrContext> mNonPresentingGvrContextClass;
private Class<? extends VrDaydreamApi> mVrDaydreamApiClass;
+ private Class<? extends VrCoreVersionChecker> mVrCoreVersionCheckerClass;
private VrShell mVrShell;
private NonPresentingGvrContext mNonPresentingGvrContext;
private VrDaydreamApi mVrDaydreamApi;
+ private VrCoreVersionChecker mVrCoreVersionChecker;
private boolean mInVr;
private int mRestoreSystemUiVisibilityFlag = -1;
private int mRestoreOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
@@ -59,8 +61,7 @@ public class VrShellDelegate {
public VrShellDelegate(ChromeTabbedActivity activity) {
mActivity = activity;
-
- mVrAvailable = maybeFindVrClasses();
+ mVrAvailable = maybeFindVrClasses() && isVrCoreCompatible();
createVrDaydreamApi();
}
@@ -84,6 +85,8 @@ public class VrShellDelegate {
"org.chromium.chrome.browser.vr_shell.NonPresentingGvrContextImpl");
mVrDaydreamApiClass = (Class<? extends VrDaydreamApi>) Class.forName(
"org.chromium.chrome.browser.vr_shell.VrDaydreamApiImpl");
+ mVrCoreVersionCheckerClass = (Class<? extends VrCoreVersionChecker>) Class.forName(
agrieve 2016/11/10 19:16:29 Lot of reflection here... How about changing this
bshe 2016/11/10 20:59:25 Agree that we shouldn't have so many reflections.
agrieve 2016/11/10 21:47:04 SG - this should be removed then when you remove t
bshe 2016/11/11 17:43:02 hum. Probably needs to be after x86 and x64 suppor
+ "org.chromium.chrome.browser.vr_shell.VrCoreVersionCheckerImpl");
return true;
} catch (ClassNotFoundException e) {
mVrShellClass = null;
@@ -285,6 +288,24 @@ public class VrShellDelegate {
}
}
+ private boolean isVrCoreCompatible() {
+ if (mVrCoreVersionChecker != null) {
+ return mVrCoreVersionChecker.isVrCoreCompatible();
+ }
+
+ try {
+ Constructor<?> mVrCoreVersionCheckerConstructor =
+ mVrCoreVersionCheckerClass.getConstructor(Context.class);
+ mVrCoreVersionChecker =
+ (VrCoreVersionChecker) mVrCoreVersionCheckerConstructor.newInstance(mActivity);
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException
+ | InvocationTargetException | NoSuchMethodException e) {
+ Log.e(TAG, "Unable to instantiate VrCoreVersionChecker", e);
+ return false;
+ }
+ return mVrCoreVersionChecker.isVrCoreCompatible();
+ }
+
private boolean createVrDaydreamApi() {
if (!mVrAvailable) return false;

Powered by Google App Engine
This is Rietveld 408576698