diff options
author | Amith Yamasani <yamasani@google.com> | 2012-08-25 07:47:43 -0700 |
---|---|---|
committer | Amith Yamasani <yamasani@google.com> | 2012-08-25 07:47:43 -0700 |
commit | 92e2b4f4af417b14c8b7774afe09a2f2cb06c8bc (patch) | |
tree | 33250da8821e243ab7bef279cfabd464d6e06e22 /src/com/android/settings/users | |
parent | cf033092732809d1ea0734f1f761617a8c4ccd32 (diff) | |
download | packages_apps_settings-92e2b4f4af417b14c8b7774afe09a2f2cb06c8bc.zip packages_apps_settings-92e2b4f4af417b14c8b7774afe09a2f2cb06c8bc.tar.gz packages_apps_settings-92e2b4f4af417b14c8b7774afe09a2f2cb06c8bc.tar.bz2 |
Avoid re-creating a user when activity is resumed
onCreate() was getting called again, resulting in another user being
created. Keeping the new userid across pause/resume.
Change-Id: Id7930227895e95a60a77efddf361ab9408a8f797
Diffstat (limited to 'src/com/android/settings/users')
-rw-r--r-- | src/com/android/settings/users/UserDetailsSettings.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/android/settings/users/UserDetailsSettings.java b/src/com/android/settings/users/UserDetailsSettings.java index aa7f9b2..518c6b6 100644 --- a/src/com/android/settings/users/UserDetailsSettings.java +++ b/src/com/android/settings/users/UserDetailsSettings.java @@ -90,6 +90,11 @@ public class UserDetailsSettings extends SettingsPreferenceFragment mIPm = IPackageManager.Stub.asInterface(ServiceManager.getService("package")); mUm = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); + if (icicle != null && icicle.containsKey(EXTRA_USER_ID)) { + mUserId = icicle.getInt(EXTRA_USER_ID); + mNewUser = false; + } + if (mUserId == -1) { mUserId = mUm.createUser(getString(R.string.user_new_user_name), 0).id; } @@ -112,6 +117,12 @@ public class UserDetailsSettings extends SettingsPreferenceFragment } @Override + public void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt(EXTRA_USER_ID, mUserId); + } + + @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (mUserId == 0) { return; |