Merge "Non-functional simplification of ComponentName.equals" am: 00c792bba0 am: 13202ef31e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2268166 Change-Id: Iaea7147b859fdf26d4853d2cdd77dd2c7add6b61 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -314,17 +314,14 @@ public final class ComponentName implements Parcelable, Cloneable, Comparable<Co
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
try {
|
||||
if (obj != null) {
|
||||
ComponentName other = (ComponentName)obj;
|
||||
// Note: no null checks, because mPackage and mClass can
|
||||
// never be null.
|
||||
return mPackage.equals(other.mPackage)
|
||||
&& mClass.equals(other.mClass);
|
||||
}
|
||||
} catch (ClassCastException e) {
|
||||
if (obj instanceof ComponentName) {
|
||||
ComponentName other = (ComponentName) obj;
|
||||
// mPackage and mClass can never be null.
|
||||
return mPackage.equals(other.mPackage)
|
||||
&& mClass.equals(other.mClass);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user