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

Commit ee598ada authored by Vadim Tryshev's avatar Vadim Tryshev
Browse files

Adding logging to debug jank test problems

Bug: 110103162
Test: TaplTests
Change-Id: I0bae4f2242031ebcdbb24638f61a6b8d37b162e2
parent abbf01b7
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
package com.android.launcher3.tapl;

import android.graphics.Point;
import androidx.test.uiautomator.UiObject2;

import androidx.annotation.NonNull;
import androidx.test.uiautomator.UiObject2;

/**
 * Operations on AllApps opened from Overview.
@@ -44,6 +44,7 @@ public final class AllAppsFromOverview extends AllApps {
                allAppsContainer, "search_container_all_apps");
        final Point start = qsb.getVisibleCenter();
        final int endY = (int) (mLauncher.getDevice().getDisplayHeight() * 0.6);
        LauncherInstrumentation.log("AllAppsFromOverview.switchBackToOverview before swipe");
        mLauncher.swipe(start.x, start.y, start.x, endY);

        return new Overview(mLauncher);
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ public final class AppIcon {
     * Clicks the icon to launch its app.
     */
    public Background launch() {
        LauncherInstrumentation.log("AppIcon.launch before click");
        LauncherInstrumentation.assertTrue(
                "Launching an app didn't open a new window: " + mIcon.getText(),
                mIcon.clickAndWait(Until.newWindow(), LauncherInstrumentation.WAIT_TIME_MS));
+8 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.app.UiAutomation;
import android.os.Bundle;
import android.os.Parcelable;
import android.provider.Settings;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;

import androidx.annotation.NonNull;
@@ -47,6 +48,8 @@ import java.util.concurrent.TimeoutException;
 */
public final class LauncherInstrumentation {

    private static final String TAG = "Tapl";

    // Types for launcher containers that the user is interacting with. "Background" is a
    // pseudo-container corresponding to inactive launcher covered by another app.
    enum ContainerType {
@@ -119,6 +122,10 @@ public final class LauncherInstrumentation {
        return mSwipeUpEnabledOverride != null ? mSwipeUpEnabledOverride : mSwipeUpEnabled;
    }

    static void log(String message) {
        Log.d(TAG, message);
    }

    private static void fail(String message) {
        Assert.fail("http://go/tapl : " + message);
    }
@@ -144,6 +151,7 @@ public final class LauncherInstrumentation {
    }

    private UiObject2 verifyContainerType(ContainerType containerType) {
        log("verifyContainerType: " + containerType);
        switch (containerType) {
            case WORKSPACE: {
                waitUntilGone(APPS_RES_ID);
+5 −2
Original line number Diff line number Diff line
@@ -17,14 +17,14 @@
package com.android.launcher3.tapl;

import android.graphics.Point;

import androidx.annotation.NonNull;
import androidx.test.uiautomator.Direction;
import androidx.test.uiautomator.UiObject2;

import java.util.Collections;
import java.util.List;

import androidx.annotation.NonNull;

/**
 * Overview pane.
 */
@@ -46,6 +46,7 @@ public final class Overview extends LauncherInstrumentation.VisibleContainer {
     */
    public void flingForward() {
        final UiObject2 overview = verifyActiveContainer();
        LauncherInstrumentation.log("Overview.flingForward before fling");
        overview.fling(Direction.LEFT, DEFAULT_FLING_SPEED);
        mLauncher.waitForIdle();
        verifyActiveContainer();
@@ -56,6 +57,7 @@ public final class Overview extends LauncherInstrumentation.VisibleContainer {
     */
    public void flingBackward() {
        final UiObject2 overview = verifyActiveContainer();
        LauncherInstrumentation.log("Overview.flingBackward before fling");
        overview.fling(Direction.RIGHT, DEFAULT_FLING_SPEED);
        mLauncher.waitForIdle();
        verifyActiveContainer();
@@ -95,6 +97,7 @@ public final class Overview extends LauncherInstrumentation.VisibleContainer {
        // Swipe from navbar to the top.
        final UiObject2 navBar = mLauncher.getSystemUiObject("navigation_bar_frame");
        final Point start = navBar.getVisibleCenter();
        LauncherInstrumentation.log("Overview.switchToAllApps before swipe");
        mLauncher.swipe(start.x, start.y, start.x, 0);

        return new AllAppsFromOverview(mLauncher);