Commit 6a618033 authored by Tanmoy Mollik's avatar Tanmoy Mollik Committed by Commit Bot

[Android] Don't show sign out dialog in AccountManagement page

If the user has only signed in without giving sync consent then the
sign out button in account management page should not show the sign out
dialog. Instead it will sign the user out directly without deleting
data saved on device.

Bug: 1136075
Change-Id: Ie2485e2896518113d62cec4a1c9fd57bfbaef2b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2460817
Commit-Queue: Tanmoy Mollik <triploblastic@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816150}
parent 094d9ade
......@@ -211,11 +211,20 @@ public class AccountManagementFragment extends PreferenceFragmentCompat
SigninUtils.logEvent(
ProfileAccountManagementMetrics.TOGGLE_SIGNOUT, mGaiaServiceType);
SignOutDialogFragment signOutFragment =
SignOutDialogFragment.create(mGaiaServiceType);
signOutFragment.setTargetFragment(AccountManagementFragment.this, 0);
signOutFragment.show(getFragmentManager(), SIGN_OUT_DIALOG_TAG);
if (IdentityServicesProvider.get()
.getIdentityManager(Profile.getLastUsedRegularProfile())
.getPrimaryAccountInfo(ConsentLevel.SYNC)
!= null) {
// Only show the sign-out dialog if the user has given sync consent.
SignOutDialogFragment signOutFragment =
SignOutDialogFragment.create(mGaiaServiceType);
signOutFragment.setTargetFragment(AccountManagementFragment.this, 0);
signOutFragment.show(getFragmentManager(), SIGN_OUT_DIALOG_TAG);
} else {
IdentityServicesProvider.get()
.getSigninManager(Profile.getLastUsedRegularProfile())
.signOut(SignoutReason.USER_CLICKED_SIGNOUT_SETTINGS, null, false);
}
return true;
}
......
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