diff options
| author | 2019-09-26 02:48:42 +0000 | |
|---|---|---|
| committer | 2019-09-26 02:48:42 +0000 | |
| commit | 85ce7cb0fd1afc4f62aab4bcc00de2ca25402a13 (patch) | |
| tree | 6bfdae94efdd0e3bd3b20050e634e5b127951d63 | |
| parent | d9f17f81a5431ec2306ef8d2f1d54e7e865b6e02 (diff) | |
| parent | 9c5a3300a5c02d95f79ea71bc4b7383879fc9b73 (diff) | |
Merge "Do not check package if package-equivalent components have set"
| -rw-r--r-- | core/java/android/content/Intent.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index 3418b7be42d6..72204daf01ef 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -10004,7 +10004,10 @@ public class Intent implements Parcelable, Cloneable { if (!Objects.equals(this.mData, other.mData)) return false; if (!Objects.equals(this.mType, other.mType)) return false; if (!Objects.equals(this.mIdentifier, other.mIdentifier)) return false; - if (!Objects.equals(this.mPackage, other.mPackage)) return false; + if (!(this.hasPackageEquivalentComponent() && other.hasPackageEquivalentComponent()) + && !Objects.equals(this.mPackage, other.mPackage)) { + return false; + } if (!Objects.equals(this.mComponent, other.mComponent)) return false; if (!Objects.equals(this.mCategories, other.mCategories)) return false; @@ -10012,6 +10015,15 @@ public class Intent implements Parcelable, Cloneable { } /** + * Return {@code true} if the component name is not null and is in the same package that this + * intent limited to. otherwise return {@code false}. + */ + private boolean hasPackageEquivalentComponent() { + return mComponent != null + && (mPackage == null || mPackage.equals(mComponent.getPackageName())); + } + + /** * Generate hash code that matches semantics of filterEquals(). * * @return Returns the hash value of the action, data, type, class, and |