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:
Santiago Seifert
2022-10-26 12:40:19 +00:00
committed by Automerger Merge Worker

View File

@@ -314,18 +314,15 @@ public final class ComponentName implements Parcelable, Cloneable, Comparable<Co
*/ */
@Override @Override
public boolean equals(@Nullable Object obj) { public boolean equals(@Nullable Object obj) {
try { if (obj instanceof ComponentName) {
if (obj != null) {
ComponentName other = (ComponentName) obj; ComponentName other = (ComponentName) obj;
// Note: no null checks, because mPackage and mClass can // mPackage and mClass can never be null.
// never be null.
return mPackage.equals(other.mPackage) return mPackage.equals(other.mPackage)
&& mClass.equals(other.mClass); && mClass.equals(other.mClass);
} } else {
} catch (ClassCastException e) {
}
return false; return false;
} }
}
@Override @Override
public int hashCode() { public int hashCode() {