Commit 08ea5c8b authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

[Android WebAPK] Change relaunch logic in H2OTransparentLauncherActivity

This CL changes the behaviour of
H2OTransparentLauncherActivity#onHostBrowserSelected() in the edge
case (not sure if the edge case is possible) that both H2OMainActivity
and SplashActivity are enabled.

When both H2OMainActivity and SplashActivity are enabled, this CL
changes the behaviour of
H2OTransparentLauncherActivity#onHostBrowserSelected() to do
a normal launch instead of relaunching the WebAPK with the goal
of changing the enabled component. This change also brings the code
in line with the code comments.

BUG=817263

Change-Id: Iedfdabce4245eaf0db689ac2d4968b967096eaab
Reviewed-on: https://chromium-review.googlesource.com/c/1314615Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605014}
parent 613d4a07
......@@ -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 = 72
current_shell_apk_version = 73
......@@ -56,15 +56,19 @@ public class H2OTransparentLauncherActivity extends TransparentLauncherActivity
Context appContext = getApplicationContext();
// {@link H2OLauncher#changeEnabledComponentsAndKillShellApk()} enables one
// component, THEN disables the other. Check for the disabled component in order to
// handle the case where both components are enabled.
// component, THEN disables the other. Relaunch if the wrong component is disabled (vs
// if the wrong component is enabled) to handle the case where both components are enabled.
ComponentName relaunchComponent = null;
if (shouldLaunchSplash) {
if (H2OMainActivity.checkComponentEnabled(appContext)) {
// Relaunch if SplashActivity is disabled.
if (!SplashActivity.checkComponentEnabled(appContext)) {
relaunchComponent = new ComponentName(appContext, H2OMainActivity.class);
}
} else if (SplashActivity.checkComponentEnabled(appContext)) {
relaunchComponent = new ComponentName(appContext, SplashActivity.class);
} else {
// Relaunch if H2OMainActivity is disabled.
if (!H2OMainActivity.checkComponentEnabled(appContext)) {
relaunchComponent = new ComponentName(appContext, SplashActivity.class);
}
}
if (relaunchComponent == null) {
......
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