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

Commit 06d9d653 authored by Nicolo' Mazzucato's avatar Nicolo' Mazzucato
Browse files

Add ATrace in critical points for unfolding

Those traces will help in understanding how the time is spent during the screen unfold.
We used Debug.startMethodTracing() to identify the culprits: methods in this cl were the ones requiring more time. By adding those traces, we will be able to see them in perfetto recordings.

Bug: 197515205
Test: Manual
Change-Id: Id96e313b1e6a328335d0fc8a460452766fea7996
parent 5355b689
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.Looper;
import android.os.Looper;
import android.os.Parcelable;
import android.os.Parcelable;
import android.os.Trace;
import android.util.ArrayMap;
import android.util.ArrayMap;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View;
@@ -224,10 +225,12 @@ public class FragmentHostManager {
    }
    }


    public void reloadFragments() {
    public void reloadFragments() {
        Trace.beginSection("FrargmentHostManager#reloadFragments");
        // Save the old state.
        // Save the old state.
        Parcelable p = destroyFragmentHost();
        Parcelable p = destroyFragmentHost();
        // Generate a new fragment host and restore its state.
        // Generate a new fragment host and restore its state.
        createFragmentHost(p);
        createFragmentHost(p);
        Trace.endSection();
    }
    }


    class HostCallbacks extends FragmentHostCallback<FragmentHostManager> {
    class HostCallbacks extends FragmentHostCallback<FragmentHostManager> {
+9 −3
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@ import android.animation.AnimatorListenerAdapter;
import android.content.res.Configuration;
import android.content.res.Configuration;
import android.graphics.Rect;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Trace;
import android.util.Log;
import android.util.Log;
import android.view.ContextThemeWrapper;
import android.view.ContextThemeWrapper;
import android.view.LayoutInflater;
import android.view.LayoutInflater;
@@ -172,9 +173,14 @@ public class QSFragment extends LifecycleFragment implements QS, CommandQueue.Ca
    @Override
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
            Bundle savedInstanceState) {
            Bundle savedInstanceState) {
        try {
            Trace.beginSection("QSFragment#onCreateView");
            inflater = inflater.cloneInContext(new ContextThemeWrapper(getContext(),
            inflater = inflater.cloneInContext(new ContextThemeWrapper(getContext(),
                    R.style.Theme_SystemUI_QuickSettings));
                    R.style.Theme_SystemUI_QuickSettings));
            return inflater.inflate(R.layout.qs_panel, container, false);
            return inflater.inflate(R.layout.qs_panel, container, false);
        } finally {
            Trace.endSection();
        }
    }
    }


    @Override
    @Override
+3 −0
Original line number Original line Diff line number Diff line
@@ -69,6 +69,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.SystemClock;
import android.os.SystemClock;
import android.os.Trace;
import android.os.UserManager;
import android.os.UserManager;
import android.os.VibrationEffect;
import android.os.VibrationEffect;
import android.provider.Settings;
import android.provider.Settings;
@@ -4590,11 +4591,13 @@ public class NotificationPanelViewController extends PanelViewController {


        @Override
        @Override
        public void onSmallestScreenWidthChanged() {
        public void onSmallestScreenWidthChanged() {
            Trace.beginSection("onSmallestScreenWidthChanged");
            if (DEBUG) Log.d(TAG, "onSmallestScreenWidthChanged");
            if (DEBUG) Log.d(TAG, "onSmallestScreenWidthChanged");


            // Can affect multi-user switcher visibility as it depends on screen size by default:
            // Can affect multi-user switcher visibility as it depends on screen size by default:
            // it is enabled only for devices with large screens (see config_keyguardUserSwitcher)
            // it is enabled only for devices with large screens (see config_keyguardUserSwitcher)
            reInflateViews();
            reInflateViews();
            Trace.endSection();
        }
        }


        @Override
        @Override