mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 15:56:49 +00:00
Log Launcher transitions to WW
- ONRESUME / ONSTOP - HOME_GESTURE - OVERVIEW_GESTURE - QUICKSWITCH - SWIPELEFT/SWIPERIGHT Bug: 156875719 Bug: 148822714 Bug: 137777105 Debug log: go/launcher-log-parity Change-Id: I64a0deab4996b5be36320fbe0339f320891c53e0
This commit is contained in:
@@ -15,6 +15,12 @@
|
||||
*/
|
||||
package com.android.launcher3.logging;
|
||||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_CLOSE_DOWN;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_OPEN_UP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_GESTURE;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -23,8 +29,8 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
|
||||
import com.android.launcher3.logger.LauncherAtom.FromState;
|
||||
import com.android.launcher3.logger.LauncherAtom.ToState;
|
||||
import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.userevent.LauncherLogProto;
|
||||
import com.android.launcher3.util.ResourceBasedOverride;
|
||||
|
||||
/**
|
||||
@@ -35,6 +41,54 @@ import com.android.launcher3.util.ResourceBasedOverride;
|
||||
*/
|
||||
public class StatsLogManager implements ResourceBasedOverride {
|
||||
|
||||
public static final int LAUNCHER_STATE_UNSPECIFIED = 0;
|
||||
public static final int LAUNCHER_STATE_BACKGROUND = 1;
|
||||
public static final int LAUNCHER_STATE_HOME = 2;
|
||||
public static final int LAUNCHER_STATE_OVERVIEW = 3;
|
||||
public static final int LAUNCHER_STATE_ALLAPPS = 4;
|
||||
public static final int LAUNCHER_STATE_UNCHANGED = 5;
|
||||
|
||||
/**
|
||||
* Returns proper launcher state enum for {@link StatsLogManager}
|
||||
* (to be removed during UserEventDispatcher cleanup)
|
||||
*/
|
||||
public static int containerTypeToAtomState(int containerType) {
|
||||
switch (containerType) {
|
||||
case LauncherLogProto.ContainerType.ALLAPPS_VALUE:
|
||||
return LAUNCHER_STATE_ALLAPPS;
|
||||
case LauncherLogProto.ContainerType.OVERVIEW_VALUE:
|
||||
return LAUNCHER_STATE_OVERVIEW;
|
||||
case LauncherLogProto.ContainerType.WORKSPACE_VALUE:
|
||||
return LAUNCHER_STATE_HOME;
|
||||
case LauncherLogProto.ContainerType.APP_VALUE:
|
||||
return LAUNCHER_STATE_BACKGROUND;
|
||||
}
|
||||
return LAUNCHER_STATE_UNSPECIFIED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns event enum based on the two {@link ContainerType} transition information when
|
||||
* swipe gesture happens.
|
||||
* (to be removed during UserEventDispatcher cleanup)
|
||||
*/
|
||||
public static EventEnum getLauncherAtomEvent(int startContainerType,
|
||||
int targetContainerType, EventEnum fallbackEvent) {
|
||||
if (startContainerType == LauncherLogProto.ContainerType.WORKSPACE.getNumber()
|
||||
&& targetContainerType == LauncherLogProto.ContainerType.WORKSPACE.getNumber()) {
|
||||
return LAUNCHER_HOME_GESTURE;
|
||||
} else if (startContainerType != LauncherLogProto.ContainerType.TASKSWITCHER.getNumber()
|
||||
&& targetContainerType == LauncherLogProto.ContainerType.TASKSWITCHER.getNumber()) {
|
||||
return LAUNCHER_OVERVIEW_GESTURE;
|
||||
} else if (startContainerType != LauncherLogProto.ContainerType.ALLAPPS.getNumber()
|
||||
&& targetContainerType == LauncherLogProto.ContainerType.ALLAPPS.getNumber()) {
|
||||
return LAUNCHER_ALLAPPS_OPEN_UP;
|
||||
} else if (startContainerType == LauncherLogProto.ContainerType.ALLAPPS.getNumber()
|
||||
&& targetContainerType != LauncherLogProto.ContainerType.ALLAPPS.getNumber()) {
|
||||
return LAUNCHER_ALLAPPS_CLOSE_DOWN;
|
||||
}
|
||||
return fallbackEvent; // TODO fix
|
||||
}
|
||||
|
||||
public interface EventEnum {
|
||||
int getId();
|
||||
}
|
||||
@@ -164,6 +218,44 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
|
||||
@UiEvent(doc = "App launch ranking logged for hotseat predictions)")
|
||||
LAUNCHER_HOTSEAT_RANKED(553),
|
||||
@UiEvent(doc = "Launcher is now in background. e.g., Screen off event")
|
||||
LAUNCHER_ONSTOP(562),
|
||||
|
||||
@UiEvent(doc = "Launcher is now in foreground. e.g., Screen on event, back button")
|
||||
LAUNCHER_ONRESUME(563),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in LEFT direction on workspace.")
|
||||
LAUNCHER_SWIPELEFT(564),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in RIGHT direction on workspace.")
|
||||
LAUNCHER_SWIPERIGHT(565),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in UP direction in unknown way.")
|
||||
LAUNCHER_UNKNOWN_SWIPEUP(566),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in DOWN direction in unknown way.")
|
||||
LAUNCHER_UNKNOWN_SWIPEDOWN(567),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in UP direction to open apps drawer.")
|
||||
LAUNCHER_ALLAPPS_OPEN_UP(568),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in DOWN direction to close apps drawer.")
|
||||
LAUNCHER_ALLAPPS_CLOSE_DOWN(569),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in UP direction and hold from the bottom bazel area")
|
||||
LAUNCHER_OVERVIEW_GESTURE(570),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in LEFT direction on the bottom bazel area.")
|
||||
LAUNCHER_QUICKSWITCH_LEFT(571),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in RIGHT direction on the bottom bazel area.")
|
||||
LAUNCHER_QUICKSWITCH_RIGHT(572),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in DOWN direction on the bottom bazel area.")
|
||||
LAUNCHER_SWIPEDOWN_NAVBAR(573),
|
||||
|
||||
@UiEvent(doc = "User swipes or fling in UP direction from bottom bazel area.")
|
||||
LAUNCHER_HOME_GESTURE(574),
|
||||
|
||||
@UiEvent(doc = "User's workspace layout information is snapshot in the background.")
|
||||
LAUNCHER_WORKSPACE_SNAPSHOT(579),
|
||||
@@ -184,6 +276,7 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
LAUNCHER_SELECT_MODE_ITEM(584);
|
||||
|
||||
// ADD MORE
|
||||
|
||||
private final int mId;
|
||||
|
||||
LauncherEvent(int id) {
|
||||
@@ -301,19 +394,12 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
};
|
||||
}
|
||||
|
||||
protected LogStateProvider mStateProvider;
|
||||
|
||||
/**
|
||||
* Creates a new instance of {@link StatsLogManager} based on provided context.
|
||||
*/
|
||||
public static StatsLogManager newInstance(Context context) {
|
||||
return newInstance(context, null);
|
||||
}
|
||||
|
||||
public static StatsLogManager newInstance(Context context, LogStateProvider stateProvider) {
|
||||
StatsLogManager mgr = Overrides.getObject(StatsLogManager.class,
|
||||
context.getApplicationContext(), R.string.stats_log_manager_class);
|
||||
mgr.mStateProvider = stateProvider;
|
||||
return mgr;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user