Merge "Fix potential overflow of launch event uptime" into sc-dev
This commit is contained in:
@@ -206,8 +206,8 @@ class ActivityMetricsLogger {
|
|||||||
* observer to identify which callbacks belong to a launch event.
|
* observer to identify which callbacks belong to a launch event.
|
||||||
*/
|
*/
|
||||||
final long mTransitionStartTimeNs;
|
final long mTransitionStartTimeNs;
|
||||||
/** The device uptime in seconds when this transition info is created. */
|
/** The device uptime in millis when this transition info is created. */
|
||||||
final int mCurrentTransitionDeviceUptime;
|
final long mTransitionDeviceUptimeMs;
|
||||||
/** The type can be cold (new process), warm (new activity), or hot (bring to front). */
|
/** The type can be cold (new process), warm (new activity), or hot (bring to front). */
|
||||||
final int mTransitionType;
|
final int mTransitionType;
|
||||||
/** Whether the process was already running when the transition started. */
|
/** Whether the process was already running when the transition started. */
|
||||||
@@ -277,8 +277,7 @@ class ActivityMetricsLogger {
|
|||||||
mTransitionType = transitionType;
|
mTransitionType = transitionType;
|
||||||
mProcessRunning = processRunning;
|
mProcessRunning = processRunning;
|
||||||
mProcessSwitch = processSwitch;
|
mProcessSwitch = processSwitch;
|
||||||
mCurrentTransitionDeviceUptime =
|
mTransitionDeviceUptimeMs = launchingState.mCurrentUpTimeMs;
|
||||||
(int) TimeUnit.MILLISECONDS.toSeconds(launchingState.mCurrentUpTimeMs);
|
|
||||||
setLatestLaunchedActivity(r);
|
setLatestLaunchedActivity(r);
|
||||||
launchingState.mAssociatedTransitionInfo = this;
|
launchingState.mAssociatedTransitionInfo = this;
|
||||||
if (options != null) {
|
if (options != null) {
|
||||||
@@ -908,7 +907,7 @@ class ActivityMetricsLogger {
|
|||||||
final TransitionInfoSnapshot infoSnapshot = new TransitionInfoSnapshot(info);
|
final TransitionInfoSnapshot infoSnapshot = new TransitionInfoSnapshot(info);
|
||||||
if (info.isInterestingToLoggerAndObserver()) {
|
if (info.isInterestingToLoggerAndObserver()) {
|
||||||
mLoggerHandler.post(() -> logAppTransition(
|
mLoggerHandler.post(() -> logAppTransition(
|
||||||
info.mCurrentTransitionDeviceUptime, info.mCurrentTransitionDelayMs,
|
info.mTransitionDeviceUptimeMs, info.mCurrentTransitionDelayMs,
|
||||||
infoSnapshot, isHibernating));
|
infoSnapshot, isHibernating));
|
||||||
}
|
}
|
||||||
mLoggerHandler.post(() -> logAppDisplayed(infoSnapshot));
|
mLoggerHandler.post(() -> logAppDisplayed(infoSnapshot));
|
||||||
@@ -920,7 +919,7 @@ class ActivityMetricsLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This gets called on another thread without holding the activity manager lock.
|
// This gets called on another thread without holding the activity manager lock.
|
||||||
private void logAppTransition(int currentTransitionDeviceUptime, int currentTransitionDelayMs,
|
private void logAppTransition(long transitionDeviceUptimeMs, int currentTransitionDelayMs,
|
||||||
TransitionInfoSnapshot info, boolean isHibernating) {
|
TransitionInfoSnapshot info, boolean isHibernating) {
|
||||||
final LogMaker builder = new LogMaker(APP_TRANSITION);
|
final LogMaker builder = new LogMaker(APP_TRANSITION);
|
||||||
builder.setPackageName(info.packageName);
|
builder.setPackageName(info.packageName);
|
||||||
@@ -937,7 +936,7 @@ class ActivityMetricsLogger {
|
|||||||
}
|
}
|
||||||
builder.addTaggedData(APP_TRANSITION_IS_EPHEMERAL, isInstantApp ? 1 : 0);
|
builder.addTaggedData(APP_TRANSITION_IS_EPHEMERAL, isInstantApp ? 1 : 0);
|
||||||
builder.addTaggedData(APP_TRANSITION_DEVICE_UPTIME_SECONDS,
|
builder.addTaggedData(APP_TRANSITION_DEVICE_UPTIME_SECONDS,
|
||||||
currentTransitionDeviceUptime);
|
TimeUnit.MILLISECONDS.toSeconds(transitionDeviceUptimeMs));
|
||||||
builder.addTaggedData(APP_TRANSITION_DELAY_MS, currentTransitionDelayMs);
|
builder.addTaggedData(APP_TRANSITION_DELAY_MS, currentTransitionDelayMs);
|
||||||
builder.setSubtype(info.reason);
|
builder.setSubtype(info.reason);
|
||||||
if (info.startingWindowDelayMs != INVALID_DELAY) {
|
if (info.startingWindowDelayMs != INVALID_DELAY) {
|
||||||
@@ -972,7 +971,7 @@ class ActivityMetricsLogger {
|
|||||||
info.launchedActivityName,
|
info.launchedActivityName,
|
||||||
info.launchedActivityLaunchedFromPackage,
|
info.launchedActivityLaunchedFromPackage,
|
||||||
isInstantApp,
|
isInstantApp,
|
||||||
currentTransitionDeviceUptime * 1000,
|
transitionDeviceUptimeMs,
|
||||||
info.reason,
|
info.reason,
|
||||||
currentTransitionDelayMs,
|
currentTransitionDelayMs,
|
||||||
info.startingWindowDelayMs,
|
info.startingWindowDelayMs,
|
||||||
|
|||||||
Reference in New Issue
Block a user