Simplify UserHandle.equals

The resulting implementation is computationally cheaper
by saving the exception handling.

Bug: 286548714
Bug: 205124386
Change-Id: Icdf4d42155bad9c9277650ce0344215438c07a99
Test: m
Test: mp droid
This commit is contained in:
Santiago Seifert
2023-06-09 16:00:11 +00:00
parent c80d564f74
commit 5a5038ddb8

View File

@@ -597,12 +597,9 @@ public final class UserHandle implements Parcelable {
@Override
public boolean equals(@Nullable Object obj) {
try {
if (obj != null) {
UserHandle other = (UserHandle)obj;
return mHandle == other.mHandle;
}
} catch (ClassCastException ignore) {
if (obj instanceof UserHandle) {
UserHandle other = (UserHandle) obj;
return mHandle == other.mHandle;
}
return false;
}