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

Commit 3e0b8ee3 authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Fixes non-matching instant app behavior

This change ensures that a correctly formatted intent is sent to the
instant app installer when no match can be found. Prior to this change,
the original intent with the installer set as the component would be
sent. After, we send an install intent with a sanitized intent set as an
extra, as expected.

Bug: 63117034
Test: manual - launch non-matching intents with flag set
Change-Id: I70a3e2fab55e8f0524bbc99e88fba98dc2e28aaa
parent 5d8dfe17
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.pm;

import static android.content.Intent.FLAG_ACTIVITY_MATCH_EXTERNAL;

import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_INSTANT_APP_RESOLUTION_PHASE_ONE;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.ACTION_INSTANT_APP_RESOLUTION_PHASE_TWO;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.FIELD_INSTANT_APP_LAUNCH_TOKEN;
@@ -366,6 +368,7 @@ public abstract class InstantAppResolver {
        final Intent failureIntent = new Intent(origIntent);
        boolean requiresSecondPhase = false;
        failureIntent.setFlags(failureIntent.getFlags() | Intent.FLAG_IGNORE_EPHEMERAL);
        failureIntent.setFlags(failureIntent.getFlags() & ~Intent.FLAG_ACTIVITY_MATCH_EXTERNAL);
        failureIntent.setLaunchToken(token);
        ArrayList<AuxiliaryResolveInfo.AuxiliaryFilter> filters = null;
        boolean isWebIntent = origIntent.isWebIntent();
@@ -408,6 +411,10 @@ public abstract class InstantAppResolver {
        if (filters != null && !filters.isEmpty()) {
            return new AuxiliaryResolveInfo(token, requiresSecondPhase, failureIntent, filters);
        }
        // if the match external flag is set, return an empty resolve info
        if ((origIntent.getFlags() & FLAG_ACTIVITY_MATCH_EXTERNAL) != 0) {
            return new AuxiliaryResolveInfo(token, false, failureIntent, null /* filters */);
        }
        // Hash or filter mis-match; no instant apps for this domain.
        return null;
    }