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

Commit d138eb57 authored by Hawkwood Glazier's avatar Hawkwood Glazier
Browse files

Improve speed of fetching clock for metrics since it's on several transition hot paths

Bug: 296074144
Test: Manually checked CUJ logging
Change-Id: Iab50c4ced0d7fbd3637997b636d5987ba3351607
parent c7498aed
Loading
Loading
Loading
Loading
+5 −12
Original line number Diff line number Diff line
@@ -112,8 +112,9 @@ public class StatusBarStateControllerImpl implements
    // Record the HISTORY_SIZE most recent states
    private int mHistoryIndex = 0;
    private HistoricalState[] mHistoricalRecords = new HistoricalState[HISTORY_SIZE];
    // This is used by InteractionJankMonitor to get callback from HWUI.
    // These views are used by InteractionJankMonitor to get callback from HWUI.
    private View mView;
    private KeyguardClockSwitch mClockSwitchView;

    /**
     * If any of the system bars is hidden.
@@ -342,6 +343,7 @@ public class StatusBarStateControllerImpl implements
        if ((mView == null || !mView.isAttachedToWindow())
                && (view != null && view.isAttachedToWindow())) {
            mView = view;
            mClockSwitchView = view.findViewById(R.id.keyguard_clock_container);
        }
        mDozeAmountTarget = dozeAmount;
        if (animated) {
@@ -424,21 +426,12 @@ public class StatusBarStateControllerImpl implements

    /** Returns the id of the currently rendering clock */
    public String getClockId() {
        if (mView == null) {
            return KeyguardClockSwitch.MISSING_CLOCK_ID;
        }

        View clockSwitch = mView.findViewById(R.id.keyguard_clock_container);
        if (clockSwitch == null) {
        if (mClockSwitchView == null) {
            Log.e(TAG, "Clock container was missing");
            return KeyguardClockSwitch.MISSING_CLOCK_ID;
        }
        if (!(clockSwitch instanceof KeyguardClockSwitch)) {
            Log.e(TAG, "Clock container was incorrect type: " + clockSwitch);
            return KeyguardClockSwitch.MISSING_CLOCK_ID;
        }

        return ((KeyguardClockSwitch) clockSwitch).getClockId();
        return mClockSwitchView.getClockId();
    }

    private void beginInteractionJankMonitor() {