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

Commit 249a4536 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

resolve merge conflicts of c55cce48 to master

Change-Id: If833e3c5efed891fb1ba7b32b2edc96a60ea2566
parents 12e78b45 c55cce48
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -761,6 +761,7 @@ public class Activity extends ContextThemeWrapper
    boolean mStartedActivity;
    private boolean mDestroyed;
    private boolean mDoReportFullyDrawn = true;
    private boolean mRestoredFromBundle;
    /** true if the activity is going through a transient pause */
    /*package*/ boolean mTemporaryPause = false;
    /** true if the activity is being destroyed in order to recreate it with a new configuration */
@@ -1012,6 +1013,7 @@ public class Activity extends ContextThemeWrapper
        if (mVoiceInteractor != null) {
            mVoiceInteractor.attachActivity(this);
        }
        mRestoredFromBundle = savedInstanceState != null;
        mCalled = true;
    }

@@ -1948,7 +1950,7 @@ public class Activity extends ContextThemeWrapper
        if (mDoReportFullyDrawn) {
            mDoReportFullyDrawn = false;
            try {
                ActivityManager.getService().reportActivityFullyDrawn(mToken);
                ActivityManager.getService().reportActivityFullyDrawn(mToken, mRestoredFromBundle);
            } catch (RemoteException e) {
            }
        }
+1 −1
Original line number Diff line number Diff line
@@ -376,7 +376,7 @@ interface IActivityManager {
    boolean convertFromTranslucent(in IBinder token);
    boolean convertToTranslucent(in IBinder token, in Bundle options);
    void notifyActivityDrawn(in IBinder token);
    void reportActivityFullyDrawn(in IBinder token);
    void reportActivityFullyDrawn(in IBinder token, boolean restoredFromBundle);
    void restart();
    void performIdleMaintenance();
    void takePersistableUriPermission(in Uri uri, int modeFlags, int userId);
+16 −0
Original line number Diff line number Diff line
@@ -62,6 +62,14 @@ message MetricsEvent {

    // The action failed
    TYPE_FAILURE = 11;

    // Type for APP_TRANSITION_REPORTED_DRAWN event: The activity was started without restoring from
    // a bundle.
    TYPE_TRANSITION_REPORTED_DRAWN_NO_BUNDLE = 12;

    // Type for APP_TRANSITION_REPORTED_DRAWN event: The activity was started with restoring from
    // a bundle.
    TYPE_TRANSITION_REPORTED_DRAWN_WITH_BUNDLE = 13;
  }

  // Types of alerts, as bit field values
@@ -4265,6 +4273,14 @@ message MetricsEvent {
    // FIELD: The numeric preference value (of type int) when it is changed in Settings
    FIELD_SETTINGS_PREFERENCE_CHANGE_INT_VALUE = 1089;

    // ACTION: Logged when the app has notified that it has fully drawn. See
    // Activity.reportFullyDrawn().
    APP_TRANSITION_REPORTED_DRAWN = 1090;

    // FIELD: The delay of the activity reporting to be fully drawn measured from the beginning of
    // the app transition.
    APP_TRANSITION_REPORTED_DRAWN_MS = 1091;

    // ---- End O-MR1 Constants, all O-MR1 constants go above this line ----

    // OPEN: Settings > Network & Internet > Mobile network
+2 −2
Original line number Diff line number Diff line
@@ -4899,13 +4899,13 @@ public class ActivityManagerService extends IActivityManager.Stub
    }
    @Override
    public void reportActivityFullyDrawn(IBinder token) {
    public void reportActivityFullyDrawn(IBinder token, boolean restoredFromBundle) {
        synchronized (this) {
            ActivityRecord r = ActivityRecord.isInStackLocked(token);
            if (r == null) {
                return;
            }
            r.reportFullyDrawnLocked();
            r.reportFullyDrawnLocked(restoredFromBundle);
        }
    }
+28 −1
Original line number Diff line number Diff line
@@ -15,12 +15,17 @@ import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TR
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_DELAY_MS;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_DEVICE_UPTIME_SECONDS;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_IS_EPHEMERAL;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_PROCESS_RUNNING;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_REPORTED_DRAWN;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_REPORTED_DRAWN_MS;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_STARTING_WINDOW_DELAY_MS;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.APP_TRANSITION_WINDOWS_DRAWN_DELAY_MS;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.FIELD_CLASS_NAME;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.FIELD_INSTANT_APP_LAUNCH_TOKEN;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.TYPE_TRANSITION_COLD_LAUNCH;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.TYPE_TRANSITION_HOT_LAUNCH;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.TYPE_TRANSITION_REPORTED_DRAWN_NO_BUNDLE;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.TYPE_TRANSITION_REPORTED_DRAWN_WITH_BUNDLE;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.TYPE_TRANSITION_WARM_LAUNCH;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
@@ -67,12 +72,14 @@ class ActivityMetricsLogger {
    private final MetricsLogger mMetricsLogger = new MetricsLogger();

    private long mCurrentTransitionStartTime = INVALID_START_TIME;
    private long mLastTransitionStartTime = INVALID_START_TIME;

    private int mCurrentTransitionDeviceUptime;
    private int mCurrentTransitionDelayMs;
    private boolean mLoggedTransitionStarting;

    private final SparseArray<StackTransitionInfo> mStackTransitionInfo = new SparseArray<>();
    private final SparseArray<StackTransitionInfo> mLastStackTransitionInfo = new SparseArray<>();

    private final class StackTransitionInfo {
        private ActivityRecord launchedActivity;
@@ -136,6 +143,7 @@ class ActivityMetricsLogger {
    void notifyActivityLaunching() {
        if (!isAnyTransitionActive()) {
            mCurrentTransitionStartTime = SystemClock.uptimeMillis();
            mLastTransitionStartTime = mCurrentTransitionStartTime;
        }
    }

@@ -223,7 +231,8 @@ class ActivityMetricsLogger {
        newInfo.launchedActivity = launchedActivity;
        newInfo.currentTransitionProcessRunning = processRunning;
        newInfo.startResult = resultCode;
        mStackTransitionInfo.append(stackId, newInfo);
        mStackTransitionInfo.put(stackId, newInfo);
        mLastStackTransitionInfo.put(stackId, newInfo);
        mCurrentTransitionDeviceUptime = (int) (SystemClock.uptimeMillis() / 1000);
    }

@@ -388,6 +397,24 @@ class ActivityMetricsLogger {
        }
    }

    void logAppTransitionReportedDrawn(ActivityRecord r, boolean restoredFromBundle) {
        final StackTransitionInfo info = mLastStackTransitionInfo.get(r.getStackId());
        if (info == null) {
            return;
        }
        final LogMaker builder = new LogMaker(APP_TRANSITION_REPORTED_DRAWN);
        builder.setPackageName(r.packageName);
        builder.addTaggedData(FIELD_CLASS_NAME, r.info.name);
        builder.addTaggedData(APP_TRANSITION_REPORTED_DRAWN_MS,
                SystemClock.uptimeMillis() - mLastTransitionStartTime);
        builder.setType(restoredFromBundle
                ? TYPE_TRANSITION_REPORTED_DRAWN_WITH_BUNDLE
                : TYPE_TRANSITION_REPORTED_DRAWN_NO_BUNDLE);
        builder.addTaggedData(APP_TRANSITION_PROCESS_RUNNING,
                info.currentTransitionProcessRunning ? 1 : 0);
        mMetricsLogger.write(builder);
    }

    private int getTransitionType(StackTransitionInfo info) {
        if (info.currentTransitionProcessRunning) {
            if (info.startResult == START_SUCCESS) {
Loading