Add back a SYNC_SETTINGS screen
Revive the old Accounts&Sync screen as a dialog with the auto-sync
checkbox and a list of accounts. This will be launched when Apps
request a SYNC_SETTINGS page for controlling account and master sync.
Auto-sync data checkbox will also continue to exist in Data Usage.
Minor fixes to account list and account update monitoring.
Bug: 6614013
Bug: 6622995
Bug: 6610247
Change-Id: I35c0919a29c6bc7e5edf64f2734a3ef4f5ae5e7a
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index 353bc3a..50019a3 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -112,6 +112,7 @@
private AuthenticatorHelper mAuthenticatorHelper;
private Header mLastHeader;
+ private boolean mListeningToAccountUpdates;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -187,7 +188,6 @@
ListAdapter listAdapter = getListAdapter();
if (listAdapter instanceof HeaderAdapter) {
((HeaderAdapter) listAdapter).resume();
- AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true);
}
}
@@ -198,6 +198,13 @@
ListAdapter listAdapter = getListAdapter();
if (listAdapter instanceof HeaderAdapter) {
((HeaderAdapter) listAdapter).pause();
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ if (mListeningToAccountUpdates) {
AccountManager.get(this).removeOnAccountsUpdatedListener(this);
}
}
@@ -462,6 +469,10 @@
for (Header header : accountHeaders) {
target.add(headerIndex++, header);
}
+ if (!mListeningToAccountUpdates) {
+ AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true);
+ mListeningToAccountUpdates = true;
+ }
return headerIndex;
}