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

Commit f0a014d7 authored by Becky Qiu's avatar Becky Qiu
Browse files

Move swipe actions on container logging to west world.

Test: manual
Bug: 137777105

Log result for swiping in and out of -1 screen.
  data {
    elapsed_timestamp_nanos: 597609736235111
    atom {
      launcher_event {
        action: SWIPE_LEFT
        src_state: HOME
        dst_state: HOME
        is_swipe_up_enabled: true
      }
    }
  }

  data {
    elapsed_timestamp_nanos: 597610569783111
    atom {
      launcher_event {
        action: SWIPE_RIGHT
        src_state: HOME
        dst_state: HOME
        is_swipe_up_enabled: true
      }
    }
  }


Change-Id: Ic84d3c32d1c9f780f13ec5cd6320e9f1d610f018
parent d88f63bb
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
}