Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa44ba64 authored by Keisuke Kuroyanagi's avatar Keisuke Kuroyanagi Committed by android-build-merger
Browse files

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

am: c81b726e

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

Change-Id: Ia99bd3ac27e0418c7534f8bf6a0a122da0a5eaf5
parents 8e9e61e8 c81b726e
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -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>() {