Commit 4f48bf58 authored by Alice Wang's avatar Alice Wang Committed by Chromium LUCI CQ

[Signin][Android] Adjust AccountManagementFragment after removing sign-out pref

This CL adjusts the if branch in AccountManagementFragment after
removing sign-out allowed pref value.

Bug: 1162231
Change-Id: I463913e92c45de052c0272a478282fb3c2ad1932
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2624647Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Commit-Queue: Alice Wang <aliceywang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842923}
parent b0f448b5
......@@ -204,30 +204,27 @@ public class AccountManagementFragment extends PreferenceFragmentCompat
}
signOutPreference.setTitle(getSignOutPreferenceText());
signOutPreference.setOnPreferenceClickListener(preference -> {
if (!isVisible() || !isResumed()) return false;
if (mSignedInAccountName != null) {
SigninMetricsUtils.logProfileAccountManagementMenu(
ProfileAccountManagementMetrics.TOGGLE_SIGNOUT, mGaiaServiceType);
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;
if (!isVisible() || !isResumed() || mSignedInAccountName == null) {
return false;
}
return false;
SigninMetricsUtils.logProfileAccountManagementMenu(
ProfileAccountManagementMetrics.TOGGLE_SIGNOUT, mGaiaServiceType);
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