Skip to content

Commit

Permalink
Revert of Revert of Ignore account management actions after onSaveIns…
Browse files Browse the repository at this point in the history
…tanceState (patchset #1 id:1 of https://codereview.chromium.org/1143933005/)

Reason for revert:
Red herring; the actual reason for "non-working" "sign-out" and "go incognito" buttons was incorrect (absent) initialization of upstream-split parts of AccountManagementFragment.

Original issue's description:
> Revert of Ignore account management actions after onSaveInstanceState (patchset #1 id:1 of https://codereview.chromium.org/1144113005/)
>
> Reason for revert:
> Nopes, didn't help, but made things worse: running another activity renders the dialog fragment unusable.
>
> Original issue's description:
> > Ignore account management actions after onSaveInstanceState
> >
> > BUG=490629
> >
> > Committed: https://crrev.com/01ef47a29ff30d2edf7e46fe70000cf5a54a4f2b
> > Cr-Commit-Position: refs/heads/master@{#331909}
>
> [email protected]
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=490629
>
> Committed: https://crrev.com/c6f70ebd508e0245eae4ecc026ef5316a617493e
> Cr-Commit-Position: refs/heads/master@{#332067}

[email protected]
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=490629

Review URL: https://codereview.chromium.org/1171763002

Cr-Commit-Position: refs/heads/master@{#333344}
(cherry picked from commit 4e82fd7)

Review URL: https://codereview.chromium.org/1173473002.

Cr-Commit-Position: refs/branch-heads/2403@{crosswalk-project#251}
Cr-Branched-From: f54b809-refs/heads/master@{#330231}
  • Loading branch information
Ruslan Abdikeev committed Jun 9, 2015
1 parent 774debe commit 98c5967
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public class AccountManagementFragment extends PreferenceFragment
private ArrayList<Preference> mAccountsListPreferences = new ArrayList<Preference>();
private Preference mPrimaryAccountPreference;

private boolean mSaveInstanceStateWasCalled;

private AccountManagementFragmentDelegate getDelegate() {
return AccountManagementScreenHelper.getDelegate();
}
Expand Down Expand Up @@ -157,6 +159,12 @@ public void onPause() {
ProfileSyncService.get(getActivity()).removeSyncStateChangedListener(this);
}

@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mSaveInstanceStateWasCalled = true;
}

/**
* Initiate fetching the user accounts data (images and the full name).
* Fetched data will be sent to observers of ProfileDownloader.
Expand Down Expand Up @@ -219,6 +227,7 @@ private void configureSignOutSwitch() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if ((boolean) newValue) return true;
if (mSaveInstanceStateWasCalled) return false;

if (ChromeSigninController.get(getActivity()).isSignedIn()
&& getSignOutAllowedPreferenceValue(getActivity())) {
Expand Down Expand Up @@ -252,6 +261,8 @@ private void configureAddAccountPreference(String fullName) {
addAccount.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (mSaveInstanceStateWasCalled) return false;

AccountManagementScreenHelper.logEvent(
ProfileAccountManagementMetrics.ADD_ACCOUNT,
mGaiaServiceType);
Expand Down Expand Up @@ -284,6 +295,7 @@ private void configureGoIncognitoPreferences(String fullName) {
goIncognito.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (mSaveInstanceStateWasCalled) return false;
if (!PrefServiceBridge.getInstance().isIncognitoModeEnabled()) return false;

AccountManagementFragmentDelegate delegate = getDelegate();
Expand Down Expand Up @@ -389,6 +401,8 @@ private void updateAccountsList() {
pref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
if (mSaveInstanceStateWasCalled) return false;

AccountManagementScreenHelper.logEvent(
ProfileAccountManagementMetrics.CLICK_PRIMARY_ACCOUNT,
mGaiaServiceType);
Expand Down

0 comments on commit 98c5967

Please sign in to comment.