Commit 695c1d4a authored by Patrick Noland's avatar Patrick Noland Committed by Commit Bot

Initialize mStatusView in LocationBarPhone if SEL is enabled

When launching into an incognito tab initially, the status view wouldn't
be initialized, and absent a search engine change, would never
be initialized ever again. This caused populateFadeAnimations to hide
everything in the location bar by accident, since the first visible
focused view was null.

We should always initialize mStatusView if the search engine logo
feature is enabled, and it is safe to do so; there guards against using
its padding etc. when not actually showing the logo.

Bug: 1060503
Change-Id: Id43b667082b3016b11105d7fcfb4594c24a63ede
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2098266
Commit-Queue: Patrick Noland <pnoland@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#749324}
parent 1f33ca78
......@@ -68,6 +68,8 @@ public class LocationBarPhone extends LocationBarLayout {
getToolbarDataProvider().isIncognito());
// This branch will be hit if the search engine logo experiment is enabled.
// This value can never revert back to false, so it's safe to initialize mStatusView here
// without a corresponding else that nulls it out.
if (SearchEngineLogoUtils.isSearchEngineLogoEnabled()) {
// Setup the padding once we're loaded, the focused padding changes will happen with
// post-layout positioning via setTranslation. This is a byproduct of the way we do the
......@@ -80,12 +82,12 @@ public class LocationBarPhone extends LocationBarLayout {
R.dimen.sei_location_bar_lateral_padding);
setPaddingRelative(lateralPadding, getPaddingTop(), lateralPadding, getPaddingBottom());
updateUrlBarPaddingForSearchEngineIcon();
mStatusView = findViewById(R.id.location_bar_status);
}
// This branch will be hit if the search engine logo experiment is enabled and we should
// show the logo.
if (shouldShowSearchEngineLogo) {
mStatusView = findViewById(R.id.location_bar_status);
mStatusView.updateSearchEngineStatusIcon(
shouldShowSearchEngineLogo, isSearchEngineGoogle, searchEngineUrl);
mFirstVisibleFocusedView = mStatusView;
......
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