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

Commit dbde4251 authored by Pinyao Ting's avatar Pinyao Ting
Browse files

Include hashCode in app prediction classes

Bug: 341057962
Test: manual
Flag: EXEMPT bugfix
Change-Id: I5bf2a6141f9f38151ad5f03427ac3481c16bfb47
parent f5ecee63
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.Objects;

/**
 * Class that provides contextual information about the environment in which the app prediction is
 * used, such as package name, UI in which the app targets are shown, and number of targets.
@@ -98,6 +100,13 @@ public final class AppPredictionContext implements Parcelable {
                && mPackageName.equals(other.mPackageName);
    }

    @Override
    public int hashCode() {
        int hashCode = Objects.hash(mUiSurface, mPackageName);
        hashCode = 31 * hashCode + mPredictedTargetCount;
        return hashCode;
    }

    @Override
    public int describeContents() {
        return 0;
+10 −0
Original line number Diff line number Diff line
@@ -166,6 +166,16 @@ public final class AppTarget implements Parcelable {
                && mRank == other.mRank;
    }

    @Override
    public int hashCode() {
        int hashCode = Objects.hash(mId, mPackageName, mClassName, mUser);
        if (mShortcutInfo != null) {
            hashCode = 31 * hashCode + mShortcutInfo.getId().hashCode();
        }
        hashCode = 31 * hashCode + mRank;
        return hashCode;
    }

    @Override
    public int describeContents() {
        return 0;
+8 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.Parcelable;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;

/**
 * A representation of an app target event.
@@ -115,6 +116,13 @@ public final class AppTargetEvent implements Parcelable {
                && mAction == other.mAction;
    }

    @Override
    public int hashCode() {
        int hashCode = Objects.hash(mTarget, mLocation);
        hashCode = 31 * hashCode + mAction;
        return hashCode;
    }

    @Override
    public int describeContents() {
        return 0;