Commit c1ca653d authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Commit Bot

[Android] Fix SigninPromo not dismissed after unsetting 'Allow Chrome Sign-in' toggle

Unsetting the 'Allow Chrome Sign-in' toggle should not show the promo
on the main settings page. This bug was created when moving all the
promos to a single class and is due to not registering the class for
SigninAllowedState changes. This cl fixes that issue.

Bug: 1151229
Change-Id: If79c09193bb9e40cbca63770074ea77f5bae22d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2554567Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Commit-Queue: Tanmoy Mollik <triploblastic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830172}
parent b10a75c2
...@@ -77,7 +77,11 @@ public class SyncPromoPreference ...@@ -77,7 +77,11 @@ public class SyncPromoPreference
@Override @Override
public void onAttached() { public void onAttached() {
super.onAttached(); super.onAttached();
mAccountManagerFacade.addObserver(this); mAccountManagerFacade.addObserver(this);
IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile())
.addSignInAllowedObserver(this);
mProfileDataCache.addObserver(this); mProfileDataCache.addObserver(this);
FirstRunSignInProcessor.updateSigninManagerFirstRunCheckDone(); FirstRunSignInProcessor.updateSigninManagerFirstRunCheckDone();
AndroidSyncSettings.get().registerObserver(this); AndroidSyncSettings.get().registerObserver(this);
...@@ -92,7 +96,11 @@ public class SyncPromoPreference ...@@ -92,7 +96,11 @@ public class SyncPromoPreference
@Override @Override
public void onDetached() { public void onDetached() {
super.onDetached(); super.onDetached();
mAccountManagerFacade.removeObserver(this); mAccountManagerFacade.removeObserver(this);
IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile())
.removeSignInAllowedObserver(this);
mProfileDataCache.removeObserver(this); mProfileDataCache.removeObserver(this);
AndroidSyncSettings.get().unregisterObserver(this); AndroidSyncSettings.get().unregisterObserver(this);
ProfileSyncService syncService = ProfileSyncService.get(); ProfileSyncService syncService = ProfileSyncService.get();
......
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