Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java |
| index 62deb41a6c885e3b68ab02f5e6d64c4eb929258d..915deb2f536eb8592e5c089bbb7f886075894fc7 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java |
| @@ -119,6 +119,13 @@ public class AccountManagementFragment extends PreferenceFragment |
| public void onCreate(Bundle savedState) { |
| super.onCreate(savedState); |
| + // Prevent sync from starting if it hasn't already to give the user a chance to change |
| + // their sync settings. |
| + ProfileSyncService syncService = ProfileSyncService.get(); |
| + if (syncService != null) { |
| + syncService.setSetupInProgress(true); |
| + } |
| + |
| mGaiaServiceType = AccountManagementScreenHelper.GAIA_SERVICE_TYPE_NONE; |
| if (getArguments() != null) { |
| mGaiaServiceType = |
| @@ -156,6 +163,17 @@ public class AccountManagementFragment extends PreferenceFragment |
| } |
| } |
| + @Override |
| + public void onDestroy() { |
| + super.onDestroy(); |
| + |
| + // Allow sync to begin syncing if it hasn't yet. |
| + ProfileSyncService syncService = ProfileSyncService.get(); |
| + if (syncService != null) { |
| + syncService.setSetupInProgress(false); |
| + } |
| + } |
| + |
| /** |
| * Initiate fetching the user accounts data (images and the full name). |
| * Fetched data will be sent to observers of ProfileDownloader. |
| @@ -489,7 +507,9 @@ public class AccountManagementFragment extends PreferenceFragment |
| @Override |
| public void syncStateChanged() { |
| SyncPreference pref = (SyncPreference) findPreference(PREF_SYNC_SETTINGS); |
| - pref.updateSyncSummaryAndIcon(); |
| + if (pref != null) { |
|
gogerald1
2016/05/20 13:10:19
Curious, under what circumstance this could be nul
maxbogue
2016/05/20 15:53:00
It's always null before the addPreferencesFromReso
|
| + pref.updateSyncSummaryAndIcon(); |
| + } |
| // TODO(crbug/557784): Show notification for sync error |
| } |