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

This commit is contained in:
TreeHugger Robot
2019-07-24 00:01:25 +00:00
committed by Android (Google) Code Review
4 changed files with 28 additions and 0 deletions

View File

@@ -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;

View File

@@ -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 {

View File

@@ -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";
}

View File

@@ -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);
}
}