Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1841)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/signin/AccountManagementFragment.java

Issue 1988133005: [Sync] Ensure the user has a chance to change their settings on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698