Commit fde7d200 authored by Tibor Goldschwendt's avatar Tibor Goldschwendt Committed by Commit Bot

[ar] Fix reflection initializing AR

The reflection was failing because proguard changes the package of the
ArDelegate.

Bug: 900897
Change-Id: I303c8f97f9eaa89f64edce8cab6e912a2bbefe4a
Reviewed-on: https://chromium-review.googlesource.com/c/1318437Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Tibor Goldschwendt <tiborg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605458}
parent 6d12f07b
...@@ -66,7 +66,7 @@ public class ArCoreJavaUtils { ...@@ -66,7 +66,7 @@ public class ArCoreJavaUtils {
private int mAppMinArCoreApkVersionCode = ARCORE_NOT_INSTALLED_VERSION_CODE; private int mAppMinArCoreApkVersionCode = ARCORE_NOT_INSTALLED_VERSION_CODE;
@UsedByReflection("ArDelegate.java") @UsedByReflection("ArDelegate.java")
/* package */ static void installArCoreDeviceProviderFactory() { public static void installArCoreDeviceProviderFactory() {
nativeInstallArCoreDeviceProviderFactory(); nativeInstallArCoreDeviceProviderFactory();
} }
......
...@@ -18,9 +18,16 @@ public class ArDelegate { ...@@ -18,9 +18,16 @@ public class ArDelegate {
Class.forName("org.chromium.chrome.browser.vr.ArCoreJavaUtils") Class.forName("org.chromium.chrome.browser.vr.ArCoreJavaUtils")
.getDeclaredMethod("installArCoreDeviceProviderFactory") .getDeclaredMethod("installArCoreDeviceProviderFactory")
.invoke(null); .invoke(null);
} catch (ClassNotFoundException | IllegalAccessException | IllegalArgumentException } catch (ClassNotFoundException e) {
| NoSuchMethodException | InvocationTargetException e) {
// AR not available. No initialization required. // AR not available. No initialization required.
} catch (NoSuchMethodException e) {
// This and the exceptions below should not happen. Multiple catch statements to work
// around ReflectiveOperationException in API level 19.
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
} }
} }
......
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