Merge "Reverting the Intent package-equivalent component checks"
This commit is contained in:
@@ -11051,25 +11051,13 @@ 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 (!(this.hasPackageEquivalentComponent() && other.hasPackageEquivalentComponent())
|
||||
&& !Objects.equals(this.mPackage, other.mPackage)) {
|
||||
return false;
|
||||
}
|
||||
if (!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;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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().
|
||||
*
|
||||
|
||||
@@ -1109,6 +1109,9 @@ class Task extends TaskFragment {
|
||||
// as the one in the task because either one of them could be the alias activity.
|
||||
if (Objects.equals(realActivity, r.mActivityComponent) && this.intent != null) {
|
||||
intent.setComponent(this.intent.getComponent());
|
||||
// Make sure the package name the same to prevent one of the intent is set while the
|
||||
// other one is not.
|
||||
intent.setPackage(this.intent.getPackage());
|
||||
}
|
||||
return intent.filterEquals(this.intent);
|
||||
}
|
||||
|
||||
@@ -846,6 +846,7 @@ public class TaskTests extends WindowTestsBase {
|
||||
new ComponentName(DEFAULT_COMPONENT_PACKAGE_NAME, targetClassName);
|
||||
|
||||
final Intent intent = new Intent();
|
||||
intent.setPackage(DEFAULT_COMPONENT_PACKAGE_NAME);
|
||||
intent.setComponent(aliasComponent);
|
||||
final ActivityInfo info = new ActivityInfo();
|
||||
info.applicationInfo = new ApplicationInfo();
|
||||
|
||||
Reference in New Issue
Block a user