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

Commit 38067cc1 authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Add traces to latency sensitive points

Those places have been identified as the main culprit of unfold latency in sysui doing some method tracing. By adding traces, we can monitor them better in perfetto recordings.

Bug: 197515205
Test: recorded a trace and checked if they were there.
Change-Id: I6f1d111b7fb33fabeba604e62d4208f5ca1f03d1
parent d6111dd1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.hardware.display.DisplayManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.RemoteException;
import android.os.Trace;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Log;
@@ -215,9 +216,11 @@ public class NavigationBarController implements
    /** @return {@code true} if taskbar is enabled, false otherwise */
    private boolean initializeTaskbarIfNecessary() {
        if (mIsTablet) {
            Trace.beginSection("NavigationBarController#initializeTaskbarIfNecessary");
            // Remove navigation bar when taskbar is showing
            removeNavigationBar(mContext.getDisplayId());
            mTaskbarDelegate.init(mContext.getDisplayId());
            Trace.endSection();
        } else {
            mTaskbarDelegate.destroy();
        }
+4 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Parcelable;
import android.os.Trace;
import android.os.UserHandle;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
@@ -370,10 +371,13 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
        }
        Drawable drawable;
        try {
            Trace.beginSection("StatusBarIconView#updateDrawable()");
            drawable = getIcon(mIcon);
        } catch (OutOfMemoryError e) {
            Log.w(TAG, "OOM while inflating " + mIcon.icon + " for slot " + mSlot);
            return false;
        } finally {
            Trace.endSection();
        }

        if (drawable == null) {
+8 −0
Original line number Diff line number Diff line
@@ -1108,6 +1108,12 @@ public class StatusBar extends CoreStartable implements
    }

    private void onFoldedStateChanged(boolean isFolded, boolean willGoToSleep) {
        Trace.beginSection("StatusBar#onFoldedStateChanged");
        onFoldedStateChangedInternal(isFolded, willGoToSleep);
        Trace.endSection();
    }

    private void onFoldedStateChangedInternal(boolean isFolded, boolean willGoToSleep) {
        // Folded state changes are followed by a screen off event.
        // By default turning off the screen also closes the shade.
        // We want to make sure that the shade status is kept after
@@ -3669,6 +3675,7 @@ public class StatusBar extends CoreStartable implements

        @Override
        public void onScreenTurnedOff() {
            Trace.beginSection("StatusBar#onScreenTurnedOff");
            mFalsingCollector.onScreenOff();
            mScrimController.onScreenTurnedOff();
            if (mCloseQsBeforeScreenOff) {
@@ -3676,6 +3683,7 @@ public class StatusBar extends CoreStartable implements
                mCloseQsBeforeScreenOff = false;
            }
            updateIsKeyguard();
            Trace.endSection();
        }
    };

+10 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static android.provider.Settings.Secure.DEVICE_STATE_ROTATION_LOCK_LOCKED

import android.annotation.Nullable;
import android.hardware.devicestate.DeviceStateManager;
import android.os.Trace;
import android.util.Log;

import com.android.settingslib.devicestate.DeviceStateRotationLockSettingsManager;
@@ -117,11 +118,16 @@ public final class DeviceStateRotationLockSettingController

    private void updateDeviceState(int state) {
        Log.v(TAG, "updateDeviceState [state=" + state + "]");
        Trace.beginSection("updateDeviceState [state=" + state + "]");
        try {
            if (mDeviceState == state) {
                return;
            }

            readPersistedSetting(state);
        } finally {
            Trace.endSection();
        }
    }

    private void readPersistedSetting(int state) {
+4 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.provider.Settings.Secure.CAMERA_AUTOROTATE
import com.android.internal.view.RotationPolicy
import com.android.internal.view.RotationPolicy.RotationPolicyListener
import com.android.systemui.util.settings.SecureSettings
import com.android.systemui.util.traceSection
import javax.inject.Inject

/**
@@ -44,8 +45,10 @@ class RotationPolicyWrapperImpl @Inject constructor(
        RotationPolicyWrapper {

    override fun setRotationLock(enabled: Boolean) {
        traceSection("RotationPolicyWrapperImpl#setRotationLock") {
            RotationPolicy.setRotationLock(context, enabled)
        }
    }

    override fun setRotationLockAtAngle(enabled: Boolean, rotation: Int) {
        RotationPolicy.setRotationLockAtAngle(context, enabled, rotation)