Commit a8ce1489 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Handle NoTouchActivity/WebappActivity being recreated without a URL.

This can happen when the Activity is recreated early during
initialization, so we handle it be ignoring the saved instance state
and loading as usual.

Bug: 906172
Change-Id: I010803be39d698425bd1e38b2d34c95f2c658a34
Reviewed-on: https://chromium-review.googlesource.com/c/1340901Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608968}
parent 5cb3a6cd
......@@ -104,7 +104,10 @@ public class NoTouchActivity extends SingleTabActivity {
@Override
public void initializeState() {
super.initializeState();
if (getSavedInstanceState() == null) {
// By this point if we were going to restore a URL from savedInstanceState we would already
// have done so.
if (getActivityTab().getUrl().isEmpty()) {
boolean intentWithEffect = false;
Intent intent = getIntent();
mIntentHandlingTimeMs = SystemClock.uptimeMillis();
......
......@@ -219,8 +219,10 @@ public class WebappActivity extends SingleTabActivity {
// Make display mode available before page load.
tab.getTabWebContentsDelegateAndroid().setDisplayMode(mWebappInfo.displayMode());
// We do not load URL when restoring from saved instance states.
if (savedInstanceState == null) {
// We do not load URL when restoring from saved instance states. However, it's possible that
// we saved instance state before loading a URL, so even after restoring from
// SavedInstanceState we might not have a URL and should initialize from the intent.
if (tab.getUrl().isEmpty()) {
LoadUrlParams params = createLoadUrlParams(mWebappInfo, getIntent());
tab.loadUrl(params);
} else {
......
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