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

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: Move DEPS to android 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..4715015877fce3d5812d4b542375b32ad13a6d05
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrCoreVersionCheckerImpl.java
@@ -0,0 +1,44 @@
+// 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 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.ContextUtils;
+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";
+
+ @UsedByReflection("VrShellDelegate.java")
+ public VrCoreVersionCheckerImpl() {
+ }
+
+ @Override
+ public boolean isVrCoreCompatible() {
+ try {
+ String vrCoreSdkLibraryVersionString = VrCoreUtils.getVrCoreSdkLibraryVersion(
+ ContextUtils.getApplicationContext());
+ 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