Commit 087125fb authored by Dominick Ng's avatar Dominick Ng Committed by Commit Bot

Apply a separate version check for WebAPKs on Chrome OS.

The intent helper is versioned differently to Chrome. Explicitly check
its version separately if the incoming WebAPK launch intent specifies
the intent helper as its default browser. Fail out and launch as a tab
always if the provided default browser isn't supported.

BUG=893927

Change-Id: I2eb551042003eb6ca59062b86992428282ecad91
Reviewed-on: https://chromium-review.googlesource.com/c/1282143Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Commit-Queue: Dominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600162}
parent ce10c2e2
......@@ -12,4 +12,4 @@
# //chrome/android/webapk/shell_apk:webapk is changed. This includes
# Java files, Android resource files and AndroidManifest.xml. Does not affect
# Chrome.apk
current_shell_apk_version = 64
current_shell_apk_version = 65
......@@ -35,7 +35,8 @@ public class HostBrowserLauncher {
public static void launch(Context context, HostBrowserLauncherParams params) {
Log.v(TAG, "WebAPK Launch URL: " + params.getStartUrl());
if (HostBrowserUtils.shouldLaunchInTab(params.getHostBrowserMajorChromiumVersion())) {
if (HostBrowserUtils.shouldLaunchInTab(params.getHostBrowserPackageName(),
params.getHostBrowserMajorChromiumVersion())) {
launchInTab(context, params);
return;
}
......
......@@ -29,6 +29,8 @@ public class HostBrowserUtils {
private static final int MINIMUM_REQUIRED_CHROME_VERSION = 57;
private static final int MINIMUM_REQUIRED_INTENT_HELPER_VERSION = 2;
private static final String TAG = "cr_HostBrowserUtils";
/**
......@@ -212,7 +214,16 @@ public class HostBrowserUtils {
}
/** Returns whether a WebAPK should be launched as a tab. See crbug.com/772398. */
public static boolean shouldLaunchInTab(int hostBrowserChromiumMajorVersion) {
public static boolean shouldLaunchInTab(
String hostBrowserPackageName, int hostBrowserChromiumMajorVersion) {
if (!sBrowsersSupportingWebApk.contains(hostBrowserPackageName)) {
return true;
}
if (TextUtils.equals(hostBrowserPackageName, "org.chromium.arc.intent_helper")) {
return hostBrowserChromiumMajorVersion < MINIMUM_REQUIRED_INTENT_HELPER_VERSION;
}
return hostBrowserChromiumMajorVersion < MINIMUM_REQUIRED_CHROME_VERSION;
}
}
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