Merge "Avoid re-creating a user when activity is resumed" into jb-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
44120d19f3
@@ -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;
|
||||
}
|
||||
@@ -111,6 +116,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) {
|
||||
|
Reference in New Issue
Block a user