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
This commit is contained in:
Amith Yamasani
2012-06-06 20:23:08 -07:00
parent 6a5e0252ce
commit 86708a8a6d
8 changed files with 287 additions and 23 deletions

View File

@@ -112,6 +112,7 @@ public class Settings extends PreferenceActivity
private AuthenticatorHelper mAuthenticatorHelper;
private Header mLastHeader;
private boolean mListeningToAccountUpdates;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -187,7 +188,6 @@ public class Settings extends PreferenceActivity
ListAdapter listAdapter = getListAdapter();
if (listAdapter instanceof HeaderAdapter) {
((HeaderAdapter) listAdapter).resume();
AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true);
}
}
@@ -198,6 +198,13 @@ public class Settings extends PreferenceActivity
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 @@ public class Settings extends PreferenceActivity
for (Header header : accountHeaders) {
target.add(headerIndex++, header);
}
if (!mListeningToAccountUpdates) {
AccountManager.get(this).addOnAccountsUpdatedListener(this, null, true);
mListeningToAccountUpdates = true;
}
return headerIndex;
}