Commit cfef5d51 authored by Theresa Wellington's avatar Theresa Wellington Committed by Commit Bot

[Home] Move early return for iph inside tracker initialization callback

Check if the sheet is open, layout manager is null, or overview is
visible inside the tracker initialization callback in case state has
changed during tracker intialization.

BUG=786251

Change-Id: I5cbfa00a98f06a02e9145f569c096595243f35cd
Reviewed-on: https://chromium-review.googlesource.com/777119Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Theresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517479}
parent 733b148a
...@@ -1708,19 +1708,20 @@ public class BottomSheet ...@@ -1708,19 +1708,20 @@ public class BottomSheet
*/ */
public void showHelpBubbleIfNecessary() { public void showHelpBubbleIfNecessary() {
// If FRE is not complete, the FRE screen is likely covering ChromeTabbedActivity so the // If FRE is not complete, the FRE screen is likely covering ChromeTabbedActivity so the
// help bubble should not be shown. Also skip showing if the bottom sheet is already open, // help bubble should not be shown.
// the UI has not been initialized (indicated by mLayoutManager == null), or the tab if (!FirstRunStatus.getFirstRunFlowComplete()) return;
// switcher is showing.
if (isSheetOpen() || mLayoutManager == null || mLayoutManager.overviewVisible()
|| !FirstRunStatus.getFirstRunFlowComplete()) {
return;
}
final Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile()); final Tracker tracker = TrackerFactory.getTrackerForProfile(Profile.getLastUsedProfile());
tracker.addOnInitializedCallback(new Callback<Boolean>() { tracker.addOnInitializedCallback(new Callback<Boolean>() {
@Override @Override
public void onResult(Boolean success) { public void onResult(Boolean success) {
if (!success) return; // Skip showing if the tracker failed to initialize, the bottom sheet is already
// open, the UI has not been initialized (indicated by mLayoutManager == null),
// or the tab switcher is showing.
if (!success || isSheetOpen() || mLayoutManager == null
|| mLayoutManager.overviewVisible()) {
return;
}
showHelpBubble(false); showHelpBubble(false);
} }
......
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