Commit a87b527f authored by Mehran Mahmoudi's avatar Mehran Mahmoudi Committed by Commit Bot

[Paint Preview] Fix startup bug with Start Surface enabled

When StartSurface experiment is enabled, it will either:
1. Be shown on startup if a certain condition is met, or
2. Not be shown on startup.

Currently, paint preview is not displayed on startup if StartSurface
is enabled, regardless of whether StartSurface will be actually shown or
not (1 or 2 above).

This CL will display paint preview on startup if StartSurface is enabled
AND it won't be shown on startup (scenario 2 above). This is done by
making sure that ReturnToChromeExperimentsUtil#getTotalTabCount works
correctly when it's called pre-native and PAINT_PREVIEW_SHOW_ON_STARTUP
experiment is enabled.

Bug: 1134752
Change-Id: I4d51396d82bee837184db038198770905a7f972c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472432
Commit-Queue: Mehran Mahmoudi <mahmoudi@chromium.org>
Reviewed-by: default avatarMehran Mahmoudi <mahmoudi@chromium.org>
Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Auto-Submit: Mehran Mahmoudi <mahmoudi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817215}
parent fdd3e520
......@@ -51,7 +51,7 @@ public class PaintPreviewHelper {
/**
* Sets whether a Paint Preview should attempt to be shown on restoration of a tab. If the
* feature is not enabled this is effectively a no-op. This is used to
* feature is not enabled this is effectively a no-op.
*/
public static void setShouldShowOnRestore(boolean shouldShowOnRestore) {
sShouldShowOnRestore = shouldShowOnRestore;
......
......@@ -285,7 +285,9 @@ public final class ReturnToChromeExperimentsUtil {
* @return the total tab count, and works before native initialization.
*/
public static int getTotalTabCount(TabModelSelector tabModelSelector) {
if (CachedFeatureFlags.isEnabled(ChromeFeatureList.INSTANT_START)
if ((CachedFeatureFlags.isEnabled(ChromeFeatureList.INSTANT_START)
|| CachedFeatureFlags.isEnabled(
ChromeFeatureList.PAINT_PREVIEW_SHOW_ON_STARTUP))
&& !tabModelSelector.isTabStateInitialized()) {
List<PseudoTab> allTabs;
try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) {
......
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