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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrCoreVersionCheckerImpl.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/VrCoreVersionCheckerImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrCoreVersionCheckerImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrCoreVersionCheckerImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..9528b124535dc2b7609055ec49b7a7ba5e25f767
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrCoreVersionCheckerImpl.java
@@ -0,0 +1,46 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.vr_shell;
+
+import android.content.Context;
+
+import com.google.vr.ndk.base.Version;
+import com.google.vr.vrcore.base.api.VrCoreNotAvailableException;
+import com.google.vr.vrcore.base.api.VrCoreUtils;
+import com.google.vr.vrcore.base.api.VrCoreUtils.ConnectionResult;
+
+import org.chromium.base.Log;
+import org.chromium.base.annotations.UsedByReflection;
+
+/**
+ * Helper class to check if VrCore version is compatible with Chromium.
+ */
+@UsedByReflection("VrShellDelegate.java")
+public class VrCoreVersionCheckerImpl implements VrCoreVersionChecker {
+ private static final String TAG = "VrCoreVersionChecker";
+ private Context mContext;
+
+ @UsedByReflection("VrShellDelegate.java")
+ public VrCoreVersionCheckerImpl(Context context) {
agrieve 2016/11/10 19:16:29 Rather than pass in the context, I'd guess this co
bshe 2016/11/10 20:59:25 Done.
+ mContext = context;
+ }
+
+ @Override
+ public boolean isVrCoreCompatible() {
+ try {
+ String vrCoreSdkLibraryVersionString = VrCoreUtils.getVrCoreSdkLibraryVersion(mContext);
+ Version vrCoreSdkLibraryVersion = Version.parse(vrCoreSdkLibraryVersionString);
+ Version targetSdkLibraryVersion =
+ Version.parse(com.google.vr.ndk.base.BuildConstants.VERSION);
+ if (!vrCoreSdkLibraryVersion.isAtLeast(targetSdkLibraryVersion)) {
+ throw new VrCoreNotAvailableException(ConnectionResult.SERVICE_OBSOLETE);
+ }
+ return true;
+ } catch (VrCoreNotAvailableException e) {
+ Log.e(TAG, "Unable to find a compatible VrCore", e);
+ return false;
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698