Commit 7364a248 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

weblayer: Fix visibility change on config change

If fragment is stopped due to config change, then there is no need check
whether views are attached for visibility since we want to maintain that
the active tab is visible in that case.

And remove the call to destroy attachment in detach, which is not needed
anymore to maintain visibility. And it's probably the source of some
crashes caused by destroying attachment too early before all views are
detached and the activity destroyed.

Bug: 1127246
Change-Id: I863ae612d1015dee433fbabd16dc7c81d82e60c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414668
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807642}
parent e1eca8d7
......@@ -491,9 +491,6 @@ public class BrowserImpl extends IBrowser.Stub implements View.OnAttachStateChan
public void onFragmentStop(boolean forConfigurationChange) {
mFragmentStoppedForConfigurationChange = forConfigurationChange;
mFragmentStarted = false;
if (mFragmentStoppedForConfigurationChange) {
destroyAttachmentState();
}
updateAllTabs();
}
......
......@@ -436,8 +436,8 @@ public final class TabImpl extends ITab.Stub implements LoginPrompt.Observer {
*/
public boolean isVisible() {
return mBrowser.getActiveTab() == this
&& (mBrowser.isStarted() || mBrowser.isFragmentStoppedForConfigurationChange())
&& mBrowser.isViewAttachedToWindow();
&& ((mBrowser.isStarted() && mBrowser.isViewAttachedToWindow())
|| mBrowser.isFragmentStoppedForConfigurationChange());
}
private void updateWebContentsVisibility() {
......
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