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

Commit 458ab233 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Include hashCode in app prediction classes" into main

parents 273cfe17 dbde4251
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;