Merge "Only log resolution when starting activities" into oc-mr1-dev

This commit is contained in:
Todd Kennedy
2017-08-22 23:00:58 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 6 deletions

View File

@@ -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;
}
}

View File

@@ -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);
}

View File

@@ -6778,7 +6778,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);
}
@@ -7362,7 +7362,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);
@@ -7372,7 +7373,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;
@@ -7421,7 +7422,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);