Commit 661d737a authored by Xi Han's avatar Xi Han Committed by Commit Bot

[Instant Start] Shows identity disc button on Start Surface.

When Instant Start is enabled, the calculateButtonData() is called
pre-native and early exits without calling the
IdentityDiscController#ensureProfileDataCache(). As a result, the
IdentityDiscController misses the event of the onProfileDataUpdated()
and thus doesn't notify its observer StartSurfaceToolbarMediator to
update the visibility of the identity disc button.

To fix the issue, we cache the call of calculateButtonData() from the
Start surface if it is called pre-native. When a new Profile is set, we
check if a cached request exists, and call the calculateButtonData() if
yes. Thus, it guarantees to update the button data if Profile has
updated, as well as to notify Start Surface to update the visibility of
the button.

Bug: 1137535
Change-Id: I3aca4434ecc74850ee226affd3c3425931cf02a6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533522Reviewed-by: default avatarPavel Yatsuk <pavely@chromium.org>
Commit-Queue: Xi Han <hanxi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828362}
parent 0d9315d5
......@@ -324,6 +324,14 @@ public class IdentityDiscController implements NativeInitObserver, ProfileDataCa
} else {
mIdentityManager = IdentityServicesProvider.get().getIdentityManager(profile);
mIdentityManager.addObserver(this);
/**
* This isn't the correct solution, but we have to call {@link notifyObservers(false)}.
* This is because if we call {@link notifyObservers(true)} here, the
* ObservableSupplierImpl doesn't propagate the call when
* {@link onProfileDataUpdated()} calls {@link notifyObservers(true)} again.
* See https://cubug.com/1137535.
*/
notifyObservers(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