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

Commit 6d0d8969 authored by Becky Qiu's avatar Becky Qiu Committed by Android (Google) Code Review
Browse files

Merge "Move swipe actions on container logging to west world." into ub-launcher3-qt-qpr1-dev

parents 94dcb3b5 f0a014d7
Loading
Loading
Loading
Loading
+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
    }
+2 −0
Original line number Diff line number Diff line
@@ -1052,6 +1052,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
            if (!mOverlayShown) {
                mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
                        Action.Direction.LEFT, ContainerType.WORKSPACE, 0);
                mLauncher.getStatsLogManager().logSwipeOnContainer(true, 0);
            }
            mOverlayShown = true;
            // Not announcing the overlay page for accessibility since it announces itself.
@@ -1061,6 +1062,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
                if (!ued.isPreviousHomeGesture()) {
                    mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE,
                        Action.Direction.RIGHT, ContainerType.WORKSPACE, -1);
                    mLauncher.getStatsLogManager().logSwipeOnContainer(false, -1);
                }
            } else if (Float.compare(mOverlayTranslation, 0f) != 0) {
                // When arriving to 0 overscroll from non-zero overscroll, announce page for
+1 −0
Original line number Diff line number Diff line
@@ -41,5 +41,6 @@ public class StatsLogManager implements ResourceBasedOverride {
    public void logAppLaunch(View v, Intent intent) { }
    public void logTaskLaunch(View v, ComponentKey key) { }
    public void logTaskDismiss(View v, ComponentKey key) { }
    public void logSwipeOnContainer(boolean isSwipingToLeft, int pageId) { }
    public void verify() {}     // TODO: should move into robo tests
}