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