Merge "Fix NPE in UserManager.getUserName(). Unlike all other calls to getUserInfo(), getUserName() was the only one that did not check for null. This has led to NPEs like in b/37589362. Test: none. :( Not sure how to force the race where getUserInfo() returns null. Verified manually that getUserName() still works."
This commit is contained in:
committed by
Android (Google) Code Review
commit
a1dd6d87af
@@ -899,11 +899,8 @@ public class UserManager {
|
||||
* @return the user name
|
||||
*/
|
||||
public String getUserName() {
|
||||
try {
|
||||
return mService.getUserInfo(getUserHandle()).name;
|
||||
} catch (RemoteException re) {
|
||||
throw re.rethrowFromSystemServer();
|
||||
}
|
||||
UserInfo user = getUserInfo(getUserHandle());
|
||||
return user == null ? "" : user.name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user