Merge "Define equals and hashCode for InputDeviceIdentifier." into nyc-dev

am: c81b726

* commit 'c81b726ed1faf195d81d64a1af2e747d58a453df':
  Define equals and hashCode for InputDeviceIdentifier.

Change-Id: I91872ea38d0d7b04d23f3f61a8a0312065199494
This commit is contained in:
Keisuke Kuroyanagi
2016-04-19 04:17:43 +00:00
committed by android-build-merger

View File

@@ -16,8 +16,11 @@
package android.hardware.input;
import java.util.Objects;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
/**
* Wrapper for passing identifying information for input devices.
@@ -65,6 +68,21 @@ public final class InputDeviceIdentifier implements Parcelable {
return mProductId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof InputDeviceIdentifier)) return false;
final InputDeviceIdentifier that = (InputDeviceIdentifier) o;
return ((mVendorId == that.mVendorId) && (mProductId == that.mProductId)
&& TextUtils.equals(mDescriptor, that.mDescriptor));
}
@Override
public int hashCode() {
return Objects.hash(mDescriptor, mVendorId, mProductId);
}
public static final Parcelable.Creator<InputDeviceIdentifier> CREATOR =
new Parcelable.Creator<InputDeviceIdentifier>() {