summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorMichael Groover <mpgroover@google.com>2021-02-01 20:55:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-02-01 20:55:14 +0000
commit969c49681c4565912f43cf694412d0455b19e7d4 (patch)
tree5e13158b1997d442f342cec86c821f4b3c1ba617 /core/java
parentdb07cc3032b139bb84f0d16f6a250cb5fa027b0f (diff)
parentd8bd3028e3e94c8bb6c37ddb2a4d87abe7747c66 (diff)
Merge "Document Signature equals/hash should not include flags" into sc-dev
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/content/pm/Signature.java4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/java/android/content/pm/Signature.java b/core/java/android/content/pm/Signature.java
index 02fb06b808a2..bce4b872b8a6 100644
--- a/core/java/android/content/pm/Signature.java
+++ b/core/java/android/content/pm/Signature.java
@@ -256,6 +256,8 @@ public class Signature implements Parcelable {
try {
if (obj != null) {
Signature other = (Signature)obj;
+ // Note, some classes, such as PackageParser.SigningDetails, rely on equals
+ // only comparing the mSignature arrays without the flags.
return this == other || Arrays.equals(mSignature, other.mSignature);
}
} catch (ClassCastException e) {
@@ -268,6 +270,8 @@ public class Signature implements Parcelable {
if (mHaveHashCode) {
return mHashCode;
}
+ // Note, similar to equals some classes rely on the hash code not including
+ // the flags for Set membership checks.
mHashCode = Arrays.hashCode(mSignature);
mHaveHashCode = true;
return mHashCode;