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

Commit 443f0505 authored by vadimt's avatar vadimt Committed by android-build-merger
Browse files

Merge "Adding debug tracing" into ub-launcher3-qt-r1-dev

am: 8578309f

Change-Id: If2f3b4d4a849e94449c4b06a567c12610547fc61
parents 1fa0955a 8578309f
Loading
Loading
Loading
Loading
+16 −0
Original line number Original line 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.logging.UserEventDispatcher;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.LooperExecutor;
import com.android.launcher3.util.UiThreadHelper;
import com.android.launcher3.util.UiThreadHelper;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.SysUINavigationMode.Mode;
@@ -339,16 +340,25 @@ public class TouchInteractionService extends Service implements
    }
    }


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


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


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


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


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

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