Fix multi user crash when Add guest was tapped multiple times
When "Add guest" got tapped multiple times then the first click starts the guest creation process which blocks the UI thread for around 2-3 seconds, then triggers the open guest details intent, and the second tap event starts another guest creation, but it fails (since there can't be more than 1 guest on the device) and returns null, and in the openUserDetails we get NullPointerException. Test: manual test Video: http://shortn/_i4Dce33yhl Bug: 160267016 Change-Id: I9a4f0a91295e336d246abe5f5470682a14cb510f
This commit is contained in:
@@ -1064,6 +1064,7 @@ public class UserSettings extends SettingsPreferenceFragment
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (pref == mAddGuest) {
|
} else if (pref == mAddGuest) {
|
||||||
|
mAddGuest.setEnabled(false); // prevent multiple tap issue
|
||||||
UserInfo guest = mUserManager.createGuest(
|
UserInfo guest = mUserManager.createGuest(
|
||||||
getContext(), getString(com.android.settingslib.R.string.user_guest));
|
getContext(), getString(com.android.settingslib.R.string.user_guest));
|
||||||
openUserDetails(guest, true);
|
openUserDetails(guest, true);
|
||||||
|
Reference in New Issue
Block a user