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

Commit 6ebabca5 authored by Todd Kennedy's avatar Todd Kennedy
Browse files

Only log resolution when starting activities

Change-Id: I406af40953f3d6ade39e1bab18a35c534e308f3e
Fixes: 63804529
Test: Manual. Query web intent, notice no logs are emitted
Test: Manual. Start activity via web intent, notice logs are emitted
parent 003bd7e3
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -38,14 +38,18 @@ public final class InstantAppRequest {
     * Optional extra bundle provided by the source application to the installer for additional
     * verification. */
    public final Bundle verificationBundle;
    /** Whether resolution occurs because an application is starting */
    public final boolean resolveForStart;

    public InstantAppRequest(AuxiliaryResolveInfo responseObj, Intent origIntent,
            String resolvedType, String callingPackage, int userId, Bundle verificationBundle) {
            String resolvedType, String callingPackage, int userId, Bundle verificationBundle,
            boolean resolveForStart) {
        this.responseObj = responseObj;
        this.origIntent = origIntent;
        this.resolvedType = resolvedType;
        this.callingPackage = callingPackage;
        this.userId = userId;
        this.verificationBundle = verificationBundle;
        this.resolveForStart = resolveForStart;
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -122,7 +122,7 @@ public abstract class InstantAppResolver {
            }
        }
        // Only log successful instant application resolution
        if (resolutionStatus == RESOLUTION_SUCCESS) {
        if (requestObj.resolveForStart && resolutionStatus == RESOLUTION_SUCCESS) {
            logMetrics(ACTION_INSTANT_APP_RESOLUTION_PHASE_ONE, startTime, token,
                    resolutionStatus);
        }
+6 −4
Original line number Diff line number Diff line
@@ -6730,7 +6730,7 @@ public class PackageManagerService extends IPackageManager.Stub
            Bundle verificationBundle, int userId) {
        final Message msg = mHandler.obtainMessage(INSTANT_APP_RESOLUTION_PHASE_TWO,
                new InstantAppRequest(responseObj, origIntent, resolvedType,
                        callingPackage, userId, verificationBundle));
                        callingPackage, userId, verificationBundle, false /*resolveForStart*/));
        mHandler.sendMessage(msg);
    }
@@ -7292,7 +7292,8 @@ public class PackageManagerService extends IPackageManager.Stub
            }
        }
        if (addEphemeral) {
            result = maybeAddInstantAppInstaller(result, intent, resolvedType, flags, userId);
            result = maybeAddInstantAppInstaller(
                    result, intent, resolvedType, flags, userId, resolveForStart);
        }
        if (sortResult) {
            Collections.sort(result, mResolvePrioritySorter);
@@ -7302,7 +7303,7 @@ public class PackageManagerService extends IPackageManager.Stub
    }
    private List<ResolveInfo> maybeAddInstantAppInstaller(List<ResolveInfo> result, Intent intent,
            String resolvedType, int flags, int userId) {
            String resolvedType, int flags, int userId, boolean resolveForStart) {
        // first, check to see if we've got an instant app already installed
        final boolean alreadyResolvedLocally = (flags & PackageManager.MATCH_INSTANT) != 0;
        ResolveInfo localInstantApp = null;
@@ -7351,7 +7352,8 @@ public class PackageManagerService extends IPackageManager.Stub
                Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "resolveEphemeral");
                final InstantAppRequest requestObject = new InstantAppRequest(
                        null /*responseObj*/, intent /*origIntent*/, resolvedType,
                        null /*callingPackage*/, userId, null /*verificationBundle*/);
                        null /*callingPackage*/, userId, null /*verificationBundle*/,
                        resolveForStart);
                auxiliaryResponse =
                        InstantAppResolver.doInstantAppResolutionPhaseOne(
                                mContext, mInstantAppResolverConnection, requestObject);