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

Commit cd7b0085 authored by vadimt's avatar vadimt
Browse files

Adding debug tracing

Bug: 138251824
Change-Id: Ibe3de964aeacbf83fd46cc53fda7d15c9401fe4d
parent 44515f42
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ import com.android.launcher3.logging.EventLogArray;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.UiThreadHelper;
import com.android.quickstep.SysUINavigationMode.Mode;
@@ -339,16 +340,25 @@ public class TouchInteractionService extends Service implements
    }

    private void initInputMonitor() {
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "initInputMonitor 1");
        }
        if (!mMode.hasGestures || mISystemUiProxy == null) {
            return;
        }
        disposeEventHandlers();
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "initInputMonitor 2");
        }

        try {
            mInputMonitorCompat = InputMonitorCompat.fromBundle(mISystemUiProxy
                    .monitorGestureInput("swipe-up", mDefaultDisplayId), KEY_EXTRA_INPUT_MONITOR);
            mInputEventReceiver = mInputMonitorCompat.getInputReceiver(Looper.getMainLooper(),
                    mMainChoreographer, this::onInputEvent);
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "initInputMonitor 3");
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Unable to create input monitor", e);
        }
@@ -406,6 +416,9 @@ public class TouchInteractionService extends Service implements

    @Override
    public void onNavigationModeChanged(Mode newMode) {
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "onNavigationModeChanged " + newMode);
        }
        if (mMode.hasGestures != newMode.hasGestures) {
            if (newMode.hasGestures) {
                getSystemService(DisplayManager.class).registerDisplayListener(
@@ -515,6 +528,9 @@ public class TouchInteractionService extends Service implements
    }

    private void onInputEvent(InputEvent ev) {
        if (TestProtocol.sDebugTracing) {
            Log.d(TestProtocol.NO_BACKGROUND_TO_OVERVIEW_TAG, "onInputEvent " + ev);
        }
        if (!(ev instanceof MotionEvent)) {
            Log.e(TAG, "Unknown event " + ev);
            return;
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class NavigationModeSwitchRule implements TestRule {
            return new Statement() {
                @Override
                public void evaluate() throws Throwable {
                    mLauncher.enableDebugTracing();
                    final Context context = getInstrumentation().getContext();
                    final int currentInteractionMode =
                            LauncherInstrumentation.getCurrentInteractionMode(context);
@@ -104,6 +105,7 @@ public class NavigationModeSwitchRule implements TestRule {
                    } finally {
                        setActiveOverlay(prevOverlayPkg, originalMode);
                    }
                    mLauncher.disableDebugTracing();
                }

                public void evaluateWithoutChangingSetting(Statement base) throws Throwable {
+2 −0
Original line number Diff line number Diff line
@@ -77,4 +77,6 @@ public final class TestProtocol {
    public static boolean sDebugTracing = false;
    public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
    public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";

    public static final String NO_BACKGROUND_TO_OVERVIEW_TAG = "b/138251824";
}
+8 −0
Original line number Diff line number Diff line
@@ -937,4 +937,12 @@ public final class LauncherInstrumentation {
        getContext().getSystemService(WindowManager.class).getDefaultDisplay().getRealSize(size);
        return size;
    }

    public void enableDebugTracing() {
        getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING);
    }

    public void disableDebugTracing() {
        getTestInfo(TestProtocol.REQUEST_DISABLE_DEBUG_TRACING);
    }
}
 No newline at end of file