Incorrect webapp behavior on Kitkat when reusing old WebappActivity |
|||
Issue descriptionRepro steps: 1) Add 11 PWA shortcuts to the homescreen (not WebAPKs). I added shortcuts for everything in https://pwa.rocks 2) Open all 11 PWA shortcuts Expected: 11th shortcut uses one of the already existing activities and navigates it to the webapp's start URL Actual: WebappActivity's WebappInfo is replaced. However, the WebappActivity is not navigated to the new URL
,
Mar 20 2017
Sure, will take a look.
,
Mar 29 2017
In WebappActivity#initilizeUI(), it only loads URL when the tab doesn't load a URL yet. See https://cs.chromium.org/chromium/src/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java?rcl=9312812efaf6c85af28e79ce156af00e754d4b0e&l=128. I removed the "if (TextUtils.isEmpty(getActivityTab().getUrl()))" check, the new URL will be loaded, but since loading takes some time, users will see the previous Web apps brought to foreground first, and then the screen changes to the new URL without splash screen. Is this the designed behavior? I guess it depends on how much we want to change the behavior. When ActivityAssigner assign an WebApkAcitivity{i} to the 11th Web app, do we want to check the Chrome's activity list and close the previous one first? The transition might looks natural than refocusing the activity via onNewIntent? +dfalcantara.
,
Mar 29 2017
Yeah I'm guessing that onNewIntent has been broken since data was added to the WebappInfo, but Android has never been able to keep 11 of our tabs open so we didn't notice (whoops). Your proposal sounds fine... it's worth killing the old one before reassigning it so that the old web app contents doesn't show up at all. That might allow the new web app's splash screen to show up, too. I'm confused about how this is specifically being hit though. initializeUI should have already been called by that point, so it shouldn't go through there again. Looks like a race condition where you smack all the launcher icons at once before the WebappActivity can finish loading. You'd likely have to account for the other case where the WebappActivity is already initialized and the WebappInfo IDs don't match (so a combination of conditions two and three in WebappActivity#onNewIntent.
,
Mar 29 2017
Dan, this is how the scenario gets hit: You open 10 webapps. WebappActivity#initializeUI() is called for all 10 webapps. Tab#getUrl() is non empty for all 10 webapps You open an 11th webapp. WebappActivity#onNewIntent() calls WebappActivity#initializeUI(). WebappActivity#initializeUI() does nothing because Tab#getUrl() is non-empty
,
Mar 29 2017
That's what I'm confused about: onNewIntent shouldn't be able to call initializeUI again. mIsInitialized should have been set by finishInitialization, unless that gets called because the WebappActivity died and finishNativeInitialization() hadn't been called when it restarted.
,
Mar 29 2017
Dan: onNewIntent() calls initializeUI() only if mIsInitialized is true
,
Mar 29 2017
Ah, I'm great at reading. Rest of the comment still stands, though. That conditional should probably be revisited.
,
Apr 5 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/50b74d197d3c435b1b3d1dd590239b7f40ba90ee commit 50b74d197d3c435b1b3d1dd590239b7f40ba90ee Author: hanxi <hanxi@chromium.org> Date: Wed Apr 05 16:50:31 2017 Fix Incorrect webapp behavior on Kitkat when reusing old WebappActivity. If we creates 11 PWA shortcuts and open them all, the last one uses one of the already existing activities but isn't navigated to the new URL. To fix this, we finish the existing activity if it is still running, and therefore, a new WebappActivity will be created and splash screen will show up too. BUG= 702998 Review-Url: https://codereview.chromium.org/2791383002 Cr-Commit-Position: refs/heads/master@{#462115} [modify] https://crrev.com/50b74d197d3c435b1b3d1dd590239b7f40ba90ee/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappActivity.java [modify] https://crrev.com/50b74d197d3c435b1b3d1dd590239b7f40ba90ee/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappLauncherActivity.java
,
Apr 5 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by pkotw...@chromium.org
, Mar 19 2017Components: Content>WebApps Mobile>WebAPKs
Labels: OS-Android
Owner: hanxi@chromium.org
Status: Assigned (was: Untriaged)