Watch out for deleted user when exiting async task
Fixes a problem where the async task can take a while to execute and in the meantime the user can be removed. On exiting the async task and updating the UI, make sure the user hasn't been deleted. Bug: 18411181 Change-Id: I1831f3e53084c49e27557cb7aacec78c753a611b
This commit is contained in:
@@ -87,7 +87,7 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
super.onResume();
|
||||
|
||||
// Check if user still exists
|
||||
UserInfo info = getExistingUser(mUser);
|
||||
UserInfo info = Utils.getExistingUser(mUserManager, mUser);
|
||||
if (info == null) {
|
||||
finishFragment();
|
||||
} else {
|
||||
@@ -97,16 +97,6 @@ public class RestrictedProfileSettings extends AppRestrictionsFragment
|
||||
}
|
||||
}
|
||||
|
||||
private UserInfo getExistingUser(UserHandle thisUser) {
|
||||
final List<UserInfo> users = mUserManager.getUsers(true); // Only get non-dying
|
||||
for (UserInfo user : users) {
|
||||
if (user.id == thisUser.getIdentifier()) {
|
||||
return user;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startActivityForResult(Intent intent, int requestCode) {
|
||||
mEditUserInfoController.startingActivityForResult();
|
||||
|
Reference in New Issue
Block a user