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

Commit b6d7a85a authored by Hyunyoung Song's avatar Hyunyoung Song Committed by android-build-merger
Browse files

Merging from ub-launcher3-qt-qpr1-dev @ build 5834630

am: 151970d5

Change-Id: I62da9e8c0c5eb1d7b9221c5a869ff2a39ce947c8
parents 74406e6d 151970d5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -25,11 +25,13 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import android.util.Log;
import android.view.ViewConfiguration;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.ActivityControlHelper.ActivityInitListener;
import com.android.quickstep.views.RecentsView;
@@ -162,6 +164,9 @@ public class OverviewCommandHelper {

        @Override
        public void run() {
            if (TestProtocol.sDebugTracing) {
                Log.d(TestProtocol.ALL_APPS_UPON_RECENTS, "RecentsActivityCommand.run");
            }
            long elapsedTime = mCreateTime - mLastToggleTime;
            mLastToggleTime = mCreateTime;

+23 −7
Original line number Diff line number Diff line
@@ -16,11 +16,6 @@

package com.android.quickstep.logging;

import android.content.Context;
import android.content.Intent;
import android.stats.launcher.nano.LauncherExtension;
import android.stats.launcher.nano.LauncherTarget;

import static android.stats.launcher.nano.Launcher.ALLAPPS;
import static android.stats.launcher.nano.Launcher.HOME;
import static android.stats.launcher.nano.Launcher.LAUNCH_APP;
@@ -29,6 +24,11 @@ import static android.stats.launcher.nano.Launcher.DISMISS_TASK;
import static android.stats.launcher.nano.Launcher.BACKGROUND;
import static android.stats.launcher.nano.Launcher.OVERVIEW;

import android.content.Context;
import android.content.Intent;
import android.stats.launcher.nano.Launcher;
import android.stats.launcher.nano.LauncherExtension;
import android.stats.launcher.nano.LauncherTarget;
import android.view.View;

import com.android.launcher3.ItemInfo;
@@ -39,8 +39,6 @@ import com.android.launcher3.util.ComponentKey;
import com.android.systemui.shared.system.StatsLogCompat;
import com.google.protobuf.nano.MessageNano;

import androidx.annotation.Nullable;

/**
 * This method calls the StatsLog hidden method until they are made available public.
 *
@@ -85,6 +83,17 @@ public class StatsLogCompatManager extends StatsLogManager {
                MessageNano.toByteArray(ext), true);
    }

    @Override
    public void logSwipeOnContainer(boolean isSwipingToLeft, int pageId) {
        LauncherExtension ext = new LauncherExtension();
        ext.srcTarget = new LauncherTarget[1];
        int srcState = mStateProvider.getCurrentState();
        fillInLauncherExtensionWithPageId(ext, pageId);
        int launcherAction = isSwipingToLeft ? Launcher.SWIPE_LEFT : Launcher.SWIPE_RIGHT;
        StatsLogCompat.write(launcherAction, srcState, srcState,
                MessageNano.toByteArray(ext), true);
    }

    public static boolean fillInLauncherExtension(View v, LauncherExtension extension) {
        StatsLogUtils.LogContainerProvider provider = StatsLogUtils.getLaunchProviderRecursive(v);
        if (v == null || !(v.getTag() instanceof ItemInfo) || provider == null) {
@@ -99,6 +108,13 @@ public class StatsLogCompatManager extends StatsLogManager {
        return true;
    }

    public static boolean fillInLauncherExtensionWithPageId(LauncherExtension ext, int pageId) {
        Target target = new Target();
        target.pageIndex = pageId;
        copy(target, ext.srcTarget[0]);
        return true;
    }

    private static void copy(Target src, LauncherTarget dst) {
        // fill in
    }
+14 −5
Original line number Diff line number Diff line
@@ -34,9 +34,9 @@ import androidx.test.uiautomator.UiDevice;

import com.android.launcher3.tapl.LauncherInstrumentation;
import com.android.launcher3.tapl.TestHelpers;
import com.android.launcher3.util.rule.FailureWatcher;
import com.android.systemui.shared.system.QuickStepContract;

import org.junit.Assert;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
@@ -79,6 +79,14 @@ public class NavigationModeSwitchRule implements TestRule {
                description.getAnnotation(NavigationModeSwitch.class) != null) {
            Mode mode = description.getAnnotation(NavigationModeSwitch.class).mode();
            return new Statement() {
                private void assertTrue(String message, boolean condition) {
                    if(!condition) {
                        final AssertionError assertionError = new AssertionError(message);
                        FailureWatcher.onError(mLauncher.getDevice(), description, assertionError);
                        throw assertionError;
                    }
                }

                @Override
                public void evaluate() throws Throwable {
                    mLauncher.enableDebugTracing();
@@ -107,7 +115,8 @@ public class NavigationModeSwitchRule implements TestRule {
                        Log.e(TAG, "Exception", e);
                        throw e;
                    } finally {
                        Assert.assertTrue(setActiveOverlay(prevOverlayPkg, originalMode));
                        assertTrue("Couldn't set overlay",
                                setActiveOverlay(prevOverlayPkg, originalMode));
                    }
                    mLauncher.disableDebugTracing();
                }
@@ -176,7 +185,7 @@ public class NavigationModeSwitchRule implements TestRule {
                        latch.await(10, TimeUnit.SECONDS);
                        targetContext.getMainExecutor().execute(() ->
                                sysUINavigationMode.removeModeChangeListener(listener));
                        Assert.assertTrue("Navigation mode didn't change to " + expectedMode,
                        assertTrue("Navigation mode didn't change to " + expectedMode,
                                currentSysUiNavigationMode() == expectedMode);
                    }

@@ -184,7 +193,7 @@ public class NavigationModeSwitchRule implements TestRule {
                        if (mLauncher.getNavigationModel() == expectedMode) break;
                        Thread.sleep(100);
                    }
                    Assert.assertTrue("Couldn't switch to " + overlayPackage,
                    assertTrue("Couldn't switch to " + overlayPackage,
                            mLauncher.getNavigationModel() == expectedMode);

                    for (int i = 0; i != 100; ++i) {
@@ -192,7 +201,7 @@ public class NavigationModeSwitchRule implements TestRule {
                        Thread.sleep(100);
                    }
                    final String error = mLauncher.getNavigationModeMismatchError();
                    Assert.assertTrue("Switching nav mode: " + error, error == null);
                    assertTrue("Switching nav mode: " + error, error == null);

                    Thread.sleep(5000);
                    return true;
+2 −0
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
    @Test
    @PortraitLandscape
    public void testOverview() throws Exception {
        mLauncher.enableDebugTracing();
        startTestApps();
        Overview overview = mLauncher.pressHome().switchToOverview();
        assertTrue("Launcher internal state didn't switch to Overview",
@@ -176,6 +177,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
        executeOnLauncher(
                launcher -> assertEquals("Still have tasks after dismissing all",
                        0, getTaskCount(launcher)));
        mLauncher.disableDebugTracing();
    }

    private int getCurrentOverviewPage(Launcher launcher) {
+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ public class PackageInstallStateChangedTaskTest extends BaseModelUpdateTaskTestC

    private PackageInstallStateChangedTask newTask(String pkg, int progress) {
        int state = PackageInstallerCompat.STATUS_INSTALLING;
        PackageInstallInfo installInfo = new PackageInstallInfo(pkg, state, progress);
        PackageInstallInfo installInfo = new PackageInstallInfo(pkg, state, progress,
                android.os.Process.myUserHandle());
        return new PackageInstallStateChangedTask(installInfo);
    }

Loading