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

Commit 02705976 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Reverting the Intent package-equivalent component checks"

parents 30aba087 40cc579c
Loading
Loading
Loading
Loading
+1 −13
Original line number Diff line number Diff line
@@ -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().
     *
+3 −0
Original line number Diff line number Diff line
@@ -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);
    }
+1 −0
Original line number Diff line number Diff line
@@ -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();