diff options
author | Alexandra Gherghina <alexgherghina@google.com> | 2014-10-21 22:39:03 +0100 |
---|---|---|
committer | Alexandra Gherghina <alexgherghina@google.com> | 2014-10-24 17:00:38 +0100 |
commit | 14819b0d3de450334db6785ad4db1fcdab537045 (patch) | |
tree | c730e91f7211036ed79b2abf238c2e20d210016e /src/com/android/settings/accounts | |
parent | 52e57d2d252e585c034161173f605d773821c588 (diff) | |
download | packages_apps_Settings-14819b0d3de450334db6785ad4db1fcdab537045.zip packages_apps_Settings-14819b0d3de450334db6785ad4db1fcdab537045.tar.gz packages_apps_Settings-14819b0d3de450334db6785ad4db1fcdab537045.tar.bz2 |
Close account settings if there's no account to show
This makes sure we don't keep the Settings screen on when there are no
accounts left to show.
Bug: 17713957
Change-Id: I6e1d6819477f051e3a521360aa3138b18fdd3fe2
Diffstat (limited to 'src/com/android/settings/accounts')
-rw-r--r-- | src/com/android/settings/accounts/ManageAccountsSettings.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/com/android/settings/accounts/ManageAccountsSettings.java b/src/com/android/settings/accounts/ManageAccountsSettings.java index 074176b..2d8b70e 100644 --- a/src/com/android/settings/accounts/ManageAccountsSettings.java +++ b/src/com/android/settings/accounts/ManageAccountsSettings.java @@ -99,8 +99,8 @@ public class ManageAccountsSettings extends AccountPreferenceBase } @Override - public void onStart() { - super.onStart(); + public void onResume() { + super.onResume(); mAuthenticatorHelper.listenToAccountUpdates(); updateAuthDescriptions(); showAccountsIfNeeded(); @@ -134,10 +134,15 @@ public class ManageAccountsSettings extends AccountPreferenceBase } @Override + public void onPause() { + super.onPause(); + mAuthenticatorHelper.stopListeningToAccountUpdates(); + } + + @Override public void onStop() { super.onStop(); final Activity activity = getActivity(); - mAuthenticatorHelper.stopListeningToAccountUpdates(); activity.getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_CUSTOM); activity.getActionBar().setCustomView(null); } @@ -231,7 +236,7 @@ public class ManageAccountsSettings extends AccountPreferenceBase private void showSyncState() { // Catch any delayed delivery of update messages - if (getActivity() == null) return; + if (getActivity() == null || getActivity().isFinishing()) return; final int userId = mUserHandle.getIdentifier(); @@ -377,10 +382,8 @@ public class ManageAccountsSettings extends AccountPreferenceBase if (mAccountType != null && mFirstAccount != null) { addAuthenticatorSettings(); } else { - // There's no account, reset to top-level of settings - Intent settingsTop = new Intent(android.provider.Settings.ACTION_SETTINGS); - settingsTop.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - getActivity().startActivity(settingsTop); + // There's no account, close activity + finish(); } } |