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

Commit 8c2e06e3 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Fix potential overflow of launch event uptime" into sc-dev am: 90b85f3e am: 0611f4bc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15044708

Change-Id: Icaa2d92064e346c0cf90763e50f08ce61fc85289
parents 69b84049 0611f4bc
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -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,