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

Commit b2f2fa41 authored by Josh Tsuji's avatar Josh Tsuji Committed by Automerger Merge Worker
Browse files

Merge "Add jank instrumentation for occlude/unocclude/launcher unlock." into...

Merge "Add jank instrumentation for occlude/unocclude/launcher unlock." into tm-qpr-dev am: 11ffb9c8 am: e99749d2

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



Change-Id: I5becbcb9d1324ec025b2f153da5e9bffba6df715
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 4074a914 e99749d2
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -29,7 +29,9 @@ import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_IN
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_APP_LAUNCH_FROM_WIDGET;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_OPEN_ALL_APPS;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_QUICK_SWITCH;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_UNLOCK_ENTRANCE_ANIMATION;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_LAUNCH_CAMERA;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_OCCLUSION;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_PASSWORD_APPEAR;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_PASSWORD_DISAPPEAR;
import static com.android.internal.util.FrameworkStatsLog.UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_PATTERN_APPEAR;
@@ -220,6 +222,8 @@ public class InteractionJankMonitor {
    public static final int CUJ_TASKBAR_EXPAND = 60;
    public static final int CUJ_TASKBAR_COLLAPSE = 61;
    public static final int CUJ_SHADE_CLEAR_ALL = 62;
    public static final int CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION = 63;
    public static final int CUJ_LOCKSCREEN_OCCLUSION = 64;

    private static final int NO_STATSD_LOGGING = -1;

@@ -291,6 +295,8 @@ public class InteractionJankMonitor {
            UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__TASKBAR_EXPAND,
            UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__TASKBAR_COLLAPSE,
            UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__SHADE_CLEAR_ALL,
            UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LAUNCHER_UNLOCK_ENTRANCE_ANIMATION,
            UIINTERACTION_FRAME_INFO_REPORTED__INTERACTION_TYPE__LOCKSCREEN_OCCLUSION,
    };

    private static class InstanceHolder {
@@ -377,7 +383,9 @@ public class InteractionJankMonitor {
            CUJ_USER_DIALOG_OPEN,
            CUJ_TASKBAR_EXPAND,
            CUJ_TASKBAR_COLLAPSE,
            CUJ_SHADE_CLEAR_ALL
            CUJ_SHADE_CLEAR_ALL,
            CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION,
            CUJ_LOCKSCREEN_OCCLUSION
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CujType {
@@ -885,6 +893,10 @@ public class InteractionJankMonitor {
                return "TASKBAR_COLLAPSE";
            case CUJ_SHADE_CLEAR_ALL:
                return "SHADE_CLEAR_ALL";
            case CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION:
                return "LAUNCHER_UNLOCK_ENTRANCE_ANIMATION";
            case CUJ_LOCKSCREEN_OCCLUSION:
                return "LOCKSCREEN_OCCLUSION";
        }
        return "UNKNOWN";
    }
+3 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ public final class InteractionJankMonitorWrapper {
            InteractionJankMonitor.CUJ_LAUNCHER_APP_LAUNCH_FROM_WIDGET;
    public static final int CUJ_SPLIT_SCREEN_ENTER =
            InteractionJankMonitor.CUJ_SPLIT_SCREEN_ENTER;
    public static final int CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION =
            InteractionJankMonitor.CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION;

    @IntDef({
            CUJ_APP_LAUNCH_FROM_RECENTS,
@@ -57,6 +59,7 @@ public final class InteractionJankMonitorWrapper {
            CUJ_APP_CLOSE_TO_PIP,
            CUJ_QUICK_SWITCH,
            CUJ_APP_LAUNCH_FROM_WIDGET,
            CUJ_LAUNCHER_UNLOCK_ENTRANCE_ANIMATION
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface CujType {
+30 −7
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG
import static android.view.WindowManagerPolicyConstants.KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER;

import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.NAV_BAR_HANDLE_SHOW_OVER_LOCKSCREEN;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_OCCLUSION;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_TRANSITION_FROM_AOD;
import static com.android.internal.jank.InteractionJankMonitor.CUJ_LOCKSCREEN_UNLOCK_ANIMATION;
import static com.android.internal.widget.LockPatternUtils.StrongAuthTracker.SOME_AUTH_REQUIRED_AFTER_TRUSTAGENT_EXPIRED;
@@ -845,6 +846,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                    if (launchIsFullScreen) {
                        mCentralSurfaces.instantCollapseNotificationPanel();
                    }

                    mInteractionJankMonitor.end(CUJ_LOCKSCREEN_OCCLUSION);
                }

                @NonNull
@@ -991,6 +994,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                    setOccluded(isKeyguardOccluded /* isOccluded */, false /* animate */);
                    Log.d(TAG, "Unocclude animation cancelled. Occluded state is now: "
                            + mOccluded);

                    mInteractionJankMonitor.cancel(CUJ_LOCKSCREEN_OCCLUSION);
                }

                @Override
@@ -999,6 +1004,9 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                        RemoteAnimationTarget[] nonApps,
                        IRemoteAnimationFinishedCallback finishedCallback) throws RemoteException {
                    Log.d(TAG, "UnoccludeAnimator#onAnimationStart. Set occluded = false.");
                    mInteractionJankMonitor.begin(
                            createInteractionJankMonitorConf(CUJ_LOCKSCREEN_OCCLUSION)
                                    .setTag("UNOCCLUDE"));
                    setOccluded(false /* isOccluded */, true /* animate */);

                    if (apps == null || apps.length == 0 || apps[0] == null) {
@@ -1057,6 +1065,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                                try {
                                    finishedCallback.onAnimationFinished();
                                    mUnoccludeAnimator = null;

                                    mInteractionJankMonitor.end(CUJ_LOCKSCREEN_OCCLUSION);
                                } catch (RemoteException e) {
                                    e.printStackTrace();
                                }
@@ -2567,7 +2577,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                        };
                try {
                    mInteractionJankMonitor.begin(
                            createInteractionJankMonitorConf("RunRemoteAnimation"));
                            createInteractionJankMonitorConf(
                                    CUJ_LOCKSCREEN_UNLOCK_ANIMATION, "RunRemoteAnimation"));
                    runner.onAnimationStart(WindowManager.TRANSIT_KEYGUARD_GOING_AWAY, apps,
                            wallpapers, nonApps, callback);
                } catch (RemoteException e) {
@@ -2582,7 +2593,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                mSurfaceBehindRemoteAnimationRunning = true;

                mInteractionJankMonitor.begin(
                        createInteractionJankMonitorConf("DismissPanel"));
                        createInteractionJankMonitorConf(
                                CUJ_LOCKSCREEN_UNLOCK_ANIMATION, "DismissPanel"));

                // Pass the surface and metadata to the unlock animation controller.
                mKeyguardUnlockAnimationControllerLazy.get()
@@ -2590,7 +2602,8 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                                apps, startTime, mSurfaceBehindRemoteAnimationRequested);
            } else {
                mInteractionJankMonitor.begin(
                        createInteractionJankMonitorConf("RemoteAnimationDisabled"));
                        createInteractionJankMonitorConf(
                                CUJ_LOCKSCREEN_UNLOCK_ANIMATION, "RemoteAnimationDisabled"));

                mKeyguardViewControllerLazy.get().hide(startTime, fadeoutDuration);

@@ -2670,10 +2683,15 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
        sendUserPresentBroadcast();
    }

    private Configuration.Builder createInteractionJankMonitorConf(String tag) {
        return Configuration.Builder.withView(CUJ_LOCKSCREEN_UNLOCK_ANIMATION,
                mKeyguardViewControllerLazy.get().getViewRootImpl().getView())
                .setTag(tag);
    private Configuration.Builder createInteractionJankMonitorConf(int cuj) {
        return createInteractionJankMonitorConf(cuj, null /* tag */);
    }

    private Configuration.Builder createInteractionJankMonitorConf(int cuj, @Nullable String tag) {
        final Configuration.Builder builder = Configuration.Builder.withView(
                cuj, mKeyguardViewControllerLazy.get().getViewRootImpl().getView());

        return tag != null ? builder.setTag(tag) : builder;
    }

    /**
@@ -3284,6 +3302,10 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                IRemoteAnimationFinishedCallback finishedCallback) throws RemoteException {
            super.onAnimationStart(transit, apps, wallpapers, nonApps, finishedCallback);

            mInteractionJankMonitor.begin(
                    createInteractionJankMonitorConf(CUJ_LOCKSCREEN_OCCLUSION)
                            .setTag("OCCLUDE"));

            // This is the first signal we have from WM that we're going to be occluded. Set our
            // internal state to reflect that immediately, vs. waiting for the launch animator to
            // begin. Otherwise, calls to setShowingLocked, etc. will not know that we're about to
@@ -3300,6 +3322,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
                    + "Setting occluded state to: " + isKeyguardOccluded);
            setOccluded(isKeyguardOccluded /* occluded */, false /* animate */);

            mInteractionJankMonitor.cancel(CUJ_LOCKSCREEN_OCCLUSION);
        }
    }
}