Merge "Logging second order reasons for process starts" into tm-qpr-dev am: e181203b23
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20102054 Change-Id: I4a15ef01bfd2f44b9b59022666130af2ba1f3ec1 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -5009,7 +5009,8 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
hostingRecord.getType(),
|
||||
hostingRecord.getName(),
|
||||
shortAction,
|
||||
HostingRecord.getHostingTypeIdStatsd(hostingRecord.getType()));
|
||||
HostingRecord.getHostingTypeIdStatsd(hostingRecord.getType()),
|
||||
HostingRecord.getTriggerTypeForStatsd(hostingRecord.getTriggerType()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1921,7 +1921,8 @@ public final class BroadcastQueue {
|
||||
info.activityInfo.applicationInfo, true,
|
||||
r.intent.getFlags() | Intent.FLAG_FROM_BACKGROUND,
|
||||
new HostingRecord(HostingRecord.HOSTING_TYPE_BROADCAST, r.curComponent,
|
||||
r.intent.getAction()),
|
||||
r.intent.getAction(), (r.alarm ? HostingRecord.TRIGGER_TYPE_ALARM
|
||||
: HostingRecord.TRIGGER_TYPE_UNKNOWN)),
|
||||
isActivityCapable ? ZYGOTE_POLICY_FLAG_LATENCY_SENSITIVE : ZYGOTE_POLICY_FLAG_EMPTY,
|
||||
(r.intent.getFlags() & Intent.FLAG_RECEIVER_BOOT_UPGRADE) != 0, false);
|
||||
if (r.curApp == null) {
|
||||
|
||||
@@ -21,6 +21,8 @@ import android.annotation.Nullable;
|
||||
import android.content.ComponentName;
|
||||
import android.os.ProcessStartTime;
|
||||
|
||||
import com.android.internal.util.FrameworkStatsLog;
|
||||
|
||||
/**
|
||||
* This class describes various information required to start a process.
|
||||
*
|
||||
@@ -32,6 +34,9 @@ import android.os.ProcessStartTime;
|
||||
*
|
||||
* The {@code mHostingZygote} field describes from which Zygote the new process should be spawned.
|
||||
*
|
||||
* The {@code mTriggerType} field describes the trigger that started this processs. This could be
|
||||
* an alarm or a push-message for a broadcast, for example. This is purely for logging and stats.
|
||||
*
|
||||
* {@code mDefiningPackageName} contains the packageName of the package that defines the
|
||||
* component we want to start; this can be different from the packageName and uid in the
|
||||
* ApplicationInfo that we're creating the process with, in case the service is a
|
||||
@@ -71,7 +76,10 @@ public final class HostingRecord {
|
||||
public static final String HOSTING_TYPE_TOP_ACTIVITY = "top-activity";
|
||||
public static final String HOSTING_TYPE_EMPTY = "";
|
||||
|
||||
private @NonNull final String mHostingType;
|
||||
public static final String TRIGGER_TYPE_UNKNOWN = "unknown";
|
||||
public static final String TRIGGER_TYPE_ALARM = "alarm";
|
||||
|
||||
@NonNull private final String mHostingType;
|
||||
private final String mHostingName;
|
||||
private final int mHostingZygote;
|
||||
private final String mDefiningPackageName;
|
||||
@@ -79,11 +87,12 @@ public final class HostingRecord {
|
||||
private final boolean mIsTopApp;
|
||||
private final String mDefiningProcessName;
|
||||
@Nullable private final String mAction;
|
||||
@NonNull private final String mTriggerType;
|
||||
|
||||
public HostingRecord(@NonNull String hostingType) {
|
||||
this(hostingType, null /* hostingName */, REGULAR_ZYGOTE, null /* definingPackageName */,
|
||||
-1 /* mDefiningUid */, false /* isTopApp */, null /* definingProcessName */,
|
||||
null /* action */);
|
||||
null /* action */, TRIGGER_TYPE_UNKNOWN);
|
||||
}
|
||||
|
||||
public HostingRecord(@NonNull String hostingType, ComponentName hostingName) {
|
||||
@@ -91,22 +100,23 @@ public final class HostingRecord {
|
||||
}
|
||||
|
||||
public HostingRecord(@NonNull String hostingType, ComponentName hostingName,
|
||||
@Nullable String action) {
|
||||
@Nullable String action, @Nullable String triggerType) {
|
||||
this(hostingType, hostingName.toShortString(), REGULAR_ZYGOTE,
|
||||
null /* definingPackageName */, -1 /* mDefiningUid */, false /* isTopApp */,
|
||||
null /* definingProcessName */, action);
|
||||
null /* definingProcessName */, action, triggerType);
|
||||
}
|
||||
|
||||
public HostingRecord(@NonNull String hostingType, ComponentName hostingName,
|
||||
String definingPackageName, int definingUid, String definingProcessName) {
|
||||
this(hostingType, hostingName.toShortString(), REGULAR_ZYGOTE, definingPackageName,
|
||||
definingUid, false /* isTopApp */, definingProcessName, null /* action */);
|
||||
definingUid, false /* isTopApp */, definingProcessName, null /* action */,
|
||||
TRIGGER_TYPE_UNKNOWN);
|
||||
}
|
||||
|
||||
public HostingRecord(@NonNull String hostingType, ComponentName hostingName, boolean isTopApp) {
|
||||
this(hostingType, hostingName.toShortString(), REGULAR_ZYGOTE,
|
||||
null /* definingPackageName */, -1 /* mDefiningUid */, isTopApp /* isTopApp */,
|
||||
null /* definingProcessName */, null /* action */);
|
||||
null /* definingProcessName */, null /* action */, TRIGGER_TYPE_UNKNOWN);
|
||||
}
|
||||
|
||||
public HostingRecord(@NonNull String hostingType, String hostingName) {
|
||||
@@ -121,12 +131,12 @@ public final class HostingRecord {
|
||||
private HostingRecord(@NonNull String hostingType, String hostingName, int hostingZygote) {
|
||||
this(hostingType, hostingName, hostingZygote, null /* definingPackageName */,
|
||||
-1 /* mDefiningUid */, false /* isTopApp */, null /* definingProcessName */,
|
||||
null /* action */);
|
||||
null /* action */, TRIGGER_TYPE_UNKNOWN);
|
||||
}
|
||||
|
||||
private HostingRecord(@NonNull String hostingType, String hostingName, int hostingZygote,
|
||||
String definingPackageName, int definingUid, boolean isTopApp,
|
||||
String definingProcessName, @Nullable String action) {
|
||||
String definingProcessName, @Nullable String action, String triggerType) {
|
||||
mHostingType = hostingType;
|
||||
mHostingName = hostingName;
|
||||
mHostingZygote = hostingZygote;
|
||||
@@ -135,6 +145,7 @@ public final class HostingRecord {
|
||||
mIsTopApp = isTopApp;
|
||||
mDefiningProcessName = definingProcessName;
|
||||
mAction = action;
|
||||
mTriggerType = triggerType;
|
||||
}
|
||||
|
||||
public @NonNull String getType() {
|
||||
@@ -188,6 +199,11 @@ public final class HostingRecord {
|
||||
return mAction;
|
||||
}
|
||||
|
||||
/** Returns the type of trigger that led to this process start. */
|
||||
public @NonNull String getTriggerType() {
|
||||
return mTriggerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a HostingRecord for a process that must spawn from the webview zygote
|
||||
* @param hostingName name of the component to be hosted in this process
|
||||
@@ -197,7 +213,7 @@ public final class HostingRecord {
|
||||
String definingPackageName, int definingUid, String definingProcessName) {
|
||||
return new HostingRecord(HostingRecord.HOSTING_TYPE_EMPTY, hostingName.toShortString(),
|
||||
WEBVIEW_ZYGOTE, definingPackageName, definingUid, false /* isTopApp */,
|
||||
definingProcessName, null /* action */);
|
||||
definingProcessName, null /* action */, TRIGGER_TYPE_UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,7 +227,7 @@ public final class HostingRecord {
|
||||
int definingUid, String definingProcessName) {
|
||||
return new HostingRecord(HostingRecord.HOSTING_TYPE_EMPTY, hostingName.toShortString(),
|
||||
APP_ZYGOTE, definingPackageName, definingUid, false /* isTopApp */,
|
||||
definingProcessName, null /* action */);
|
||||
definingProcessName, null /* action */, TRIGGER_TYPE_UNKNOWN);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -267,4 +283,18 @@ public final class HostingRecord {
|
||||
return ProcessStartTime.HOSTING_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the string triggerType to enum TriggerType defined in ProcessStartTime proto.
|
||||
* @param triggerType
|
||||
* @return enum TriggerType defined in ProcessStartTime proto
|
||||
*/
|
||||
public static int getTriggerTypeForStatsd(@NonNull String triggerType) {
|
||||
switch(triggerType) {
|
||||
case TRIGGER_TYPE_ALARM:
|
||||
return FrameworkStatsLog.PROCESS_START_TIME__TRIGGER_TYPE__TRIGGER_TYPE_ALARM;
|
||||
default:
|
||||
return FrameworkStatsLog.PROCESS_START_TIME__TRIGGER_TYPE__TRIGGER_TYPE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user