diff options
66 files changed, 232 insertions, 1566 deletions
diff --git a/Android.mk b/Android.mk index 25f5412d21..349a134d75 100644 --- a/Android.mk +++ b/Android.mk @@ -36,18 +36,12 @@ LOCAL_STATIC_JAVA_LIBRARIES := \ launcher_log_protos_lite LOCAL_SRC_FILES := \ - $(call all-proto-files-under, protos) \ - $(call all-proto-files-under, proto_overrides) \ $(call all-java-files-under, src_build_config) \ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res LOCAL_PROGUARD_ENABLED := disabled -LOCAL_PROTOC_OPTIMIZE_TYPE := nano -LOCAL_PROTOC_FLAGS := --proto_path=$(LOCAL_PATH)/protos/ --proto_path=$(LOCAL_PATH)/proto_overrides/ -LOCAL_PROTO_JAVA_OUTPUT_PARAMS := enum_style=java - LOCAL_SDK_VERSION := current LOCAL_MIN_SDK_VERSION := 26 LOCAL_MODULE := Launcher3CommonDepsLib @@ -135,7 +129,6 @@ LOCAL_MODULE_TAGS := optional LOCAL_STATIC_JAVA_LIBRARIES := \ SystemUI-statsd \ SystemUISharedLib \ - launcherprotosnano \ launcher_log_protos_lite ifneq (,$(wildcard frameworks/base)) LOCAL_PRIVATE_PLATFORM_APIS := true @@ -203,7 +196,6 @@ LOCAL_MODULE_TAGS := optional LOCAL_STATIC_JAVA_LIBRARIES := \ SystemUI-statsd \ SystemUISharedLib \ - launcherprotosnano \ launcher_log_protos_lite ifneq (,$(wildcard frameworks/base)) LOCAL_PRIVATE_PLATFORM_APIS := true diff --git a/build.gradle b/build.gradle index 534ca65115..28a05d569c 100644 --- a/build.gradle +++ b/build.gradle @@ -82,7 +82,6 @@ android { manifest.srcFile 'AndroidManifest-common.xml' proto { srcDir 'protos/' - srcDir 'proto_overrides/' } } @@ -150,7 +149,6 @@ dependencies { implementation "androidx.preference:preference:${ANDROID_X_VERSION}" implementation project(':IconLoader') withQuickstepImplementation project(':SharedLibWrapper') - implementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/libs", include: 'launcher_protos.jar') // Recents lib dependency withQuickstepImplementation fileTree(dir: "${FRAMEWORK_PREBUILTS_DIR}/quickstep/libs", include: 'sysui_shared.jar') @@ -171,20 +169,16 @@ dependencies { protobuf { // Configure the protoc executable protoc { - artifact = 'com.google.protobuf:protoc:3.0.0' - - generateProtoTasks { - all().each { task -> - task.builtins { - remove java - javanano { - option "java_package=launcher_log_extension.proto|com.android.launcher3.userevent.nano" - option "java_package=launcher_log.proto|com.android.launcher3.userevent.nano" - option "java_package=launcher_dump.proto|com.android.launcher3.model.nano" - option "enum_style=java" - } + artifact = "com.google.protobuf:protoc:${protocVersion}" + } + generateProtoTasks { + all().each { task -> + task.builtins { + remove java + java { + option "lite" } } } } -} +}
\ No newline at end of file diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto deleted file mode 100644 index 9423cb2642..0000000000 --- a/protos/launcher_log.proto +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -syntax = "proto2"; - -import "launcher_log_extension.proto"; - -option java_package = "com.android.launcher3.userevent"; -option java_outer_classname = "LauncherLogProto"; - -package userevent; - -message Target { - enum Type { - NONE = 0; - ITEM = 1; - CONTROL = 2; - CONTAINER = 3; - } - - optional Type type = 1; - - // For container type and item type - // Used mainly for ContainerType.FOLDER, ItemType.* - optional int32 page_index = 2; - optional int32 rank = 3; - optional int32 grid_x = 4; - optional int32 grid_y = 5; - - // For container types only - optional ContainerType container_type = 6; - optional int32 cardinality = 7; - - // For control types only - optional ControlType control_type = 8; - - // For item types only - optional ItemType item_type = 9; - optional int32 package_name_hash = 10; - optional int32 component_hash = 11; // Used for ItemType.WIDGET - optional int32 intent_hash = 12; // Used for ItemType.SHORTCUT - optional int32 span_x = 13 [default = 1];// Used for ItemType.WIDGET - optional int32 span_y = 14 [default = 1];// Used for ItemType.WIDGET - optional int32 predictedRank = 15; - optional TargetExtension extension = 16; - optional TipType tip_type = 17; - optional int32 search_query_length = 18; - optional bool is_work_app = 19; - optional FromFolderLabelState from_folder_label_state = 20; - optional ToFolderLabelState to_folder_label_state = 21; - - // Note: proto does not support duplicate enum values, even if they belong to different enum type. - // Hence "FROM" and "TO" prefix added. - enum FromFolderLabelState { - FROM_FOLDER_LABEL_STATE_UNSPECIFIED = 0; - FROM_EMPTY = 1; - FROM_CUSTOM = 2; - FROM_SUGGESTED = 3; - } - - enum ToFolderLabelState { - TO_FOLDER_LABEL_STATE_UNSPECIFIED = 0; - TO_SUGGESTION0_WITH_VALID_PRIMARY = 1; - TO_SUGGESTION1_WITH_VALID_PRIMARY = 2; - TO_SUGGESTION1_WITH_EMPTY_PRIMARY = 3; - TO_SUGGESTION2_WITH_VALID_PRIMARY = 4; - TO_SUGGESTION2_WITH_EMPTY_PRIMARY = 5; - TO_SUGGESTION3_WITH_VALID_PRIMARY = 6; - TO_SUGGESTION3_WITH_EMPTY_PRIMARY = 7; - TO_EMPTY_WITH_VALID_SUGGESTIONS = 8 [deprecated = true]; - TO_EMPTY_WITH_VALID_PRIMARY = 15; - TO_EMPTY_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 16; - TO_EMPTY_WITH_EMPTY_SUGGESTIONS = 9; - TO_EMPTY_WITH_SUGGESTIONS_DISABLED = 10; - TO_CUSTOM_WITH_VALID_SUGGESTIONS = 11 [deprecated = true]; - TO_CUSTOM_WITH_VALID_PRIMARY = 17; - TO_CUSTOM_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY = 18; - TO_CUSTOM_WITH_EMPTY_SUGGESTIONS = 12; - TO_CUSTOM_WITH_SUGGESTIONS_DISABLED = 13; - UNCHANGED = 14; - } -} - -// Used to define what type of item a Target would represent. -enum ItemType { - DEFAULT_ITEMTYPE = 0; - APP_ICON = 1; - SHORTCUT = 2; - WIDGET = 3; - FOLDER_ICON = 4; - DEEPSHORTCUT = 5; - SEARCHBOX = 6; - EDITTEXT = 7; - NOTIFICATION = 8; - TASK = 9; // Each page of Recents UI (QuickStep) - WEB_APP = 10; - TASK_ICON = 11; -} - -// Used to define what type of container a Target would represent. -enum ContainerType { - DEFAULT_CONTAINERTYPE = 0; - WORKSPACE = 1; - HOTSEAT = 2; - FOLDER = 3; - ALLAPPS = 4; - WIDGETS = 5; - OVERVIEW = 6; // Zoomed out workspace (without QuickStep) - PREDICTION = 7; - SEARCHRESULT = 8; - DEEPSHORTCUTS = 9; - PINITEM = 10; // confirmation screen - NAVBAR = 11; - TASKSWITCHER = 12; // Recents UI Container (QuickStep) - APP = 13; // Foreground activity is another app (QuickStep) - TIP = 14; // Onboarding texts (QuickStep) - OTHER_LAUNCHER_APP = 15; -} - -// Used to define what type of control a Target would represent. -enum ControlType { - DEFAULT_CONTROLTYPE = 0; - ALL_APPS_BUTTON = 1; - WIDGETS_BUTTON = 2; - WALLPAPER_BUTTON = 3; - SETTINGS_BUTTON = 4; - REMOVE_TARGET = 5; - UNINSTALL_TARGET = 6; - APPINFO_TARGET = 7; - RESIZE_HANDLE = 8; - VERTICAL_SCROLL = 9; - HOME_INTENT = 10; // Deprecated, use enum Command instead - BACK_BUTTON = 11; - QUICK_SCRUB_BUTTON = 12; - CLEAR_ALL_BUTTON = 13; - CANCEL_TARGET = 14; - TASK_PREVIEW = 15; - SPLIT_SCREEN_TARGET = 16; - REMOTE_ACTION_SHORTCUT = 17; - APP_USAGE_SETTINGS = 18; - BACK_GESTURE = 19; - UNDO = 20; - DISMISS_PREDICTION = 21; - HYBRID_HOTSEAT_ACCEPTED = 22; - HYBRID_HOTSEAT_CANCELED = 23; - OVERVIEW_ACTIONS_SHARE_BUTTON = 24; - OVERVIEW_ACTIONS_SCREENSHOT_BUTTON = 25; - OVERVIEW_ACTIONS_SELECT_BUTTON = 26; - SELECT_MODE_CLOSE_BUTTON = 27; - SELECT_MODE_ITEM = 28; -} - -enum TipType { - DEFAULT_NONE = 0; - BOUNCE = 1; - SWIPE_UP_TEXT = 2; - QUICK_SCRUB_TEXT = 3; - PREDICTION_TEXT = 4; - DWB_TOAST = 5; - HYBRID_HOTSEAT = 6; -} - -// Used to define the action component of the LauncherEvent. -message Action { - enum Type { - TOUCH = 0; - AUTOMATED = 1; - COMMAND = 2; - TIP = 3; - SOFT_KEYBOARD = 4; - // HARD_KEYBOARD, ASSIST - } - - enum Touch { - TAP = 0; - LONGPRESS = 1; - DRAGDROP = 2; - SWIPE = 3; - FLING = 4; - PINCH = 5; - SWIPE_NOOP = 6; - } - - enum Direction { - NONE = 0; - UP = 1; - DOWN = 2; - LEFT = 3; - RIGHT = 4; - UPRIGHT = 5; - UPLEFT = 6; - } - enum Command { - HOME_INTENT = 0; - BACK = 1; - ENTRY = 2; // Indicates entry to one of Launcher container type target - // not using the HOME_INTENT - CANCEL = 3; // Indicates that a confirmation screen was cancelled - CONFIRM = 4; // Indicates thata confirmation screen was accepted - STOP = 5; // Indicates onStop() was called (screen time out, power off) - RECENTS_BUTTON = 6; // Indicates that Recents button was pressed - RESUME = 7; // Indicates onResume() was called - } - - optional Type type = 1; - optional Touch touch = 2; - optional Direction dir = 3; - optional Command command = 4; - // Log if the action was performed on outside of the container - optional bool is_outside = 5; - optional bool is_state_change = 6; -} - -// -// Context free grammar of typical user interaction: -// Action (Touch) + Target -// Action (Touch) + Target + Target -// -message LauncherEvent { - required Action action = 1; - // List of targets that touch actions can be operated on. - repeated Target src_target = 2; - repeated Target dest_target = 3; - - optional int64 action_duration_millis = 4; - optional int64 elapsed_container_millis = 5; - optional int64 elapsed_session_millis = 6; - - optional bool is_in_multi_window_mode = 7 [deprecated = true]; - optional bool is_in_landscape_mode = 8 [deprecated = true]; - - optional LauncherEventExtension extension = 9; -} diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java index d3c4c3d62d..5b066c6be6 100644 --- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java +++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java @@ -16,11 +16,8 @@ package com.android.launcher3.appprediction; -import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; -import static com.android.launcher3.logging.LoggerUtils.newTarget; import android.annotation.TargetApi; import android.content.Context; @@ -43,7 +40,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherAppState; -import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsSectionDecorator; import com.android.launcher3.allapps.FloatingHeaderRow; @@ -53,13 +49,11 @@ import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.keyboard.FocusIndicatorHelper; import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper; -import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.touch.ItemLongClickListener; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.Themes; import com.android.quickstep.AnimatedFloat; @@ -68,7 +62,7 @@ import java.util.List; @TargetApi(Build.VERSION_CODES.P) public class PredictionRowView extends LinearLayout implements - LogContainerProvider, OnDeviceProfileChangeListener, FloatingHeaderRow { + OnDeviceProfileChangeListener, FloatingHeaderRow { private static final IntProperty<PredictionRowView> TEXT_ALPHA = new IntProperty<PredictionRowView>("textAlpha") { @@ -271,29 +265,6 @@ public class PredictionRowView extends LinearLayout implements mParent.onHeightUpdated(); } - @Override - public void fillInLogContainerData(ItemInfo childInfo, LauncherLogProto.Target child, - ArrayList<LauncherLogProto.Target> parents) { - for (int i = 0; i < mPredictedApps.size(); i++) { - ItemInfoWithIcon appInfo = mPredictedApps.get(i); - if (appInfo == childInfo) { - child.predictedRank = i; - break; - } - } - parents.add(newContainerTarget(LauncherLogProto.ContainerType.PREDICTION)); - - // include where the prediction is coming this used to be Launcher#modifyUserEvent - LauncherLogProto.Target parent = newTarget(LauncherLogProto.Target.Type.CONTAINER); - LauncherState state = mLauncher.getStateManager().getState(); - if (state == LauncherState.ALL_APPS) { - parent.containerType = LauncherLogProto.ContainerType.ALLAPPS; - } else if (state == OVERVIEW) { - parent.containerType = LauncherLogProto.ContainerType.TASKSWITCHER; - } - parents.add(parent); - } - public void setTextAlpha(int textAlpha) { mIconLastSetTextAlpha = textAlpha; if (getAlpha() < 1 && textAlpha > 0) { diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java index 151a113d1e..380735044d 100644 --- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java @@ -55,7 +55,6 @@ import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.touch.ItemLongClickListener; import com.android.launcher3.uioverrides.PredictedAppIcon; import com.android.launcher3.uioverrides.QuickstepLauncher; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.views.ArrowTipView; import com.android.launcher3.views.Snackbar; diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java index bce73cd4e4..a2e3bdf8a0 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -16,6 +16,7 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; import android.content.Context; @@ -23,7 +24,6 @@ import android.content.Context; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.allapps.AllAppsContainerView; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; /** * Definition for AllApps state @@ -40,7 +40,7 @@ public class AllAppsState extends LauncherState { }; public AllAppsState(int id) { - super(id, ContainerType.ALLAPPS, STATE_FLAGS); + super(id, LAUNCHER_STATE_ALLAPPS, STATE_FLAGS); } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index 8ff05f2aaa..4b4f955204 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -15,12 +15,13 @@ */ package com.android.launcher3.uioverrides.states; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; + import android.content.Context; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.Launcher; import com.android.launcher3.allapps.AllAppsTransitionController; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; @@ -33,7 +34,7 @@ public class BackgroundAppState extends OverviewState { | FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS; public BackgroundAppState(int id) { - this(id, LauncherLogProto.ContainerType.TASKSWITCHER); + this(id, LAUNCHER_STATE_BACKGROUND); } protected BackgroundAppState(int id, int logContainer) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index fc0dcd5119..41c689d16d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -15,13 +15,14 @@ */ package com.android.launcher3.uioverrides.states; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; + import android.content.Context; import android.graphics.Rect; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.views.RecentsView; /** @@ -34,7 +35,7 @@ public class OverviewModalTaskState extends OverviewState { FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE; public OverviewModalTaskState(int id) { - super(id, ContainerType.OVERVIEW, STATE_FLAGS); + super(id, LAUNCHER_STATE_OVERVIEW, STATE_FLAGS); } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index bbe7821864..525ff5816d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -16,6 +16,7 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape; import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview; @@ -29,7 +30,6 @@ import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; import com.android.launcher3.Workspace; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.views.RecentsView; @@ -51,7 +51,7 @@ public class OverviewState extends LauncherState { } protected OverviewState(int id, int stateFlags) { - this(id, ContainerType.TASKSWITCHER, stateFlags); + this(id, LAUNCHER_STATE_OVERVIEW, stateFlags); } protected OverviewState(int id, int logContainer, int stateFlags) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java index 2c7373e206..51e72dacdc 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickSwitchState.java @@ -15,8 +15,9 @@ */ package com.android.launcher3.uioverrides.states; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; + import com.android.launcher3.Launcher; -import com.android.launcher3.userevent.nano.LauncherLogProto; /** * State to indicate we are about to launch a recent task. Note that this state is only used when @@ -26,7 +27,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto; public class QuickSwitchState extends BackgroundAppState { public QuickSwitchState(int id) { - super(id, LauncherLogProto.ContainerType.APP); + super(id, LAUNCHER_STATE_BACKGROUND); } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/LandscapeEdgeSwipeController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/LandscapeEdgeSwipeController.java index bef191ef8f..7a0f634b45 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/LandscapeEdgeSwipeController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/LandscapeEdgeSwipeController.java @@ -12,8 +12,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.states.StateAnimationConfig.AnimationFlags; import com.android.launcher3.touch.AbstractStateChangeTouchController; import com.android.launcher3.touch.SingleAxisSwipeDetector; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.quickstep.SystemUiProxy; /** @@ -46,11 +44,6 @@ public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchContro } @Override - protected int getLogContainerTypeForNormalState(MotionEvent ev) { - return LauncherLogProto.ContainerType.NAVBAR; - } - - @Override protected float getShiftRange() { return mLauncher.getDragLayer().getWidth(); } @@ -65,13 +58,8 @@ public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchContro } @Override - protected int getDirectionForLog() { - return mLauncher.getDeviceProfile().isSeascape() ? Direction.RIGHT : Direction.LEFT; - } - - @Override - protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) { - super.onSwipeInteractionCompleted(targetState, logAction); + protected void onSwipeInteractionCompleted(LauncherState targetState) { + super.onSwipeInteractionCompleted(targetState); if (mStartState == NORMAL && targetState == OVERVIEW) { SystemUiProxy.INSTANCE.get(mLauncher).onOverviewShown(true, TAG); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index 76168440a8..d210bc6851 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -45,12 +45,9 @@ import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.graphics.OverviewScrim; -import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.SingleAxisSwipeDetector; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.TouchController; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.AssistantUtilities; @@ -211,7 +208,6 @@ public class NavBarToHomeTouchController implements TouchController, @Override public void onDragEnd(float velocity) { boolean fling = mSwipeDetector.isFling(velocity); - final int logAction = fling ? Touch.FLING : Touch.SWIPE; float progress = mCurrentAnimation.getProgressFraction(); float interpolatedProgress = PULLBACK_INTERPOLATOR.getInterpolation(progress); boolean success = interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS @@ -230,7 +226,7 @@ public class NavBarToHomeTouchController implements TouchController, () -> onSwipeInteractionCompleted(mEndState)); } if (mStartState != mEndState) { - // TODO: add to WW log + logHomeGesture(); } AbstractFloatingView topOpenView = AbstractFloatingView.getTopOpenView(mLauncher); if (topOpenView != null) { @@ -255,17 +251,10 @@ public class NavBarToHomeTouchController implements TouchController, AccessibilityManagerCompat.sendStateEventToTest(mLauncher, targetState.ordinal); } - private void logStateChange(int startContainerType, int logAction) { - mLauncher.getUserEventDispatcher().logStateChangeAction(logAction, - LauncherLogProto.Action.Direction.UP, - mSwipeDetector.getDownX(), mSwipeDetector.getDownY(), - LauncherLogProto.ContainerType.NAVBAR, - startContainerType, - mEndState.containerType, - mLauncher.getWorkspace().getCurrentPage()); + private void logHomeGesture() { mLauncher.getStatsLogManager().logger() - .withSrcState(StatsLogManager.containerTypeToAtomState(mStartState.containerType)) - .withDstState(StatsLogManager.containerTypeToAtomState(mEndState.containerType)) + .withSrcState(mStartState.statsLogOrdinal) + .withDstState(mEndState.statsLogOrdinal) .log(LAUNCHER_HOME_GESTURE); } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java index c78d4741d8..2a3bdbfcb8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonNavbarToOverviewTouchController.java @@ -49,7 +49,6 @@ import com.android.launcher3.anim.Interpolators; import com.android.launcher3.graphics.OverviewScrim; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.VibratorWrapper; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.util.AnimatorControllerWithResistance; @@ -207,7 +206,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch private void maybeSwipeInteractionToOverviewComplete() { if (mReachedOverview && mDetector.isSettlingState()) { - onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE); + onSwipeInteractionCompleted(OVERVIEW); } } @@ -251,7 +250,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch private void goToOverviewOrHomeOnDragEnd(float velocity) { boolean goToHomeInsteadOfOverview = !mMotionPauseDetector.isPaused(); if (goToHomeInsteadOfOverview) { - new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL, Touch.FLING)) + new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL)) .animateWithVelocity(velocity); } if (mReachedOverview) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java index a6a3497f04..f378848a71 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java @@ -57,13 +57,9 @@ import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.graphics.OverviewScrim; -import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.BaseSwipeDetector; import com.android.launcher3.touch.BothAxesSwipeDetector; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.TouchController; import com.android.launcher3.util.VibratorWrapper; import com.android.quickstep.AnimatedFloat; @@ -287,7 +283,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController, boolean horizontalFling = mSwipeDetector.isFling(velocity.x); boolean verticalFling = mSwipeDetector.isFling(velocity.y); boolean noFling = !horizontalFling && !verticalFling; - int logAction = noFling ? Touch.SWIPE : Touch.FLING; if (mMotionPauseDetector.isPaused() && noFling) { cancelAnimations(); @@ -298,7 +293,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, overviewAnim.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { - onAnimationToStateCompleted(OVERVIEW, logAction); + onAnimationToStateCompleted(OVERVIEW); } }); overviewAnim.start(); @@ -393,7 +388,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController, } nonOverviewAnim.setDuration(Math.max(xDuration, yDuration)); - mNonOverviewAnim.setEndAction(() -> onAnimationToStateCompleted(targetState, logAction)); + mNonOverviewAnim.setEndAction(() -> onAnimationToStateCompleted(targetState)); cancelAnimations(); xOverviewAnim.start(); @@ -401,27 +396,17 @@ public class NoButtonQuickSwitchTouchController implements TouchController, nonOverviewAnim.start(); } - private void onAnimationToStateCompleted(LauncherState targetState, int logAction) { - mLauncher.getUserEventDispatcher().logStateChangeAction(logAction, - getDirectionForLog(), mSwipeDetector.getDownX(), mSwipeDetector.getDownY(), - LauncherLogProto.ContainerType.NAVBAR, - mStartState.containerType, - targetState.containerType, - mLauncher.getWorkspace().getCurrentPage()); + private void onAnimationToStateCompleted(LauncherState targetState) { mLauncher.getStatsLogManager().logger() .withSrcState(LAUNCHER_STATE_HOME) - .withDstState(StatsLogManager.containerTypeToAtomState(targetState.containerType)) - .log(getLauncherAtomEvent(mStartState.containerType, targetState.containerType, + .withDstState(targetState.statsLogOrdinal) + .log(getLauncherAtomEvent(mStartState.statsLogOrdinal, targetState.statsLogOrdinal, targetState.ordinal > mStartState.ordinal ? LAUNCHER_UNKNOWN_SWIPEUP : LAUNCHER_UNKNOWN_SWIPEDOWN)); mLauncher.getStateManager().goToState(targetState, false, this::clearState); } - private int getDirectionForLog() { - return Utilities.isRtl(mLauncher.getResources()) ? Direction.LEFT : Direction.RIGHT; - } - private void cancelAnimations() { if (mNonOverviewAnim != null) { mNonOverviewAnim.getAnimationPlayer().cancel(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java index 90911684ec..45e5e2fb7c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/OverviewToAllAppsTouchController.java @@ -25,7 +25,6 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.Utilities; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.views.RecentsView; @@ -73,9 +72,4 @@ public class OverviewToAllAppsTouchController extends PortraitStatesTouchControl } return fromState; } - - @Override - protected int getLogContainerTypeForNormalState(MotionEvent ev) { - return LauncherLogProto.ContainerType.WORKSPACE; - } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java index 059a703075..037d9889fd 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java @@ -48,8 +48,6 @@ import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.AbstractStateChangeTouchController; import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.launcher3.uioverrides.states.OverviewState; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.SystemUiProxy; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.util.LayoutUtils; @@ -172,11 +170,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr return fromState; } - @Override - protected int getLogContainerTypeForNormalState(MotionEvent ev) { - return isTouchOverHotseat(mLauncher, ev) ? ContainerType.HOTSEAT : ContainerType.WORKSPACE; - } - private StateAnimationConfig getNormalToOverviewAnimation() { mAllAppsInterpolatorWrapper.baseInterpolator = LINEAR; @@ -285,7 +278,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr private void cancelPendingAnim() { if (mPendingAnimation != null) { - mPendingAnimation.finish(false, Touch.SWIPE); + mPendingAnimation.finish(false); mPendingAnimation = null; } } @@ -320,8 +313,8 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr } @Override - protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) { - super.onSwipeInteractionCompleted(targetState, logAction); + protected void onSwipeInteractionCompleted(LauncherState targetState) { + super.onSwipeInteractionCompleted(targetState); if (mStartState == NORMAL && targetState == OVERVIEW) { SystemUiProxy.INSTANCE.get(mLauncher).onOverviewShown(true, TAG); } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java index c643858e5c..b8c2030852 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/QuickSwitchTouchController.java @@ -21,6 +21,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE; @@ -41,8 +42,6 @@ import com.android.launcher3.Utilities; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.AbstractStateChangeTouchController; import com.android.launcher3.touch.SingleAxisSwipeDetector; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.SystemUiProxy; @@ -92,14 +91,14 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll @Override public void onDragStart(boolean start, float startDisplacement) { super.onDragStart(start, startDisplacement); - mStartContainerType = LauncherLogProto.ContainerType.NAVBAR; + mStartContainerType = LAUNCHER_STATE_BACKGROUND; ActivityManagerWrapper.getInstance() .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); } @Override - protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) { - super.onSwipeInteractionCompleted(targetState, logAction); + protected void onSwipeInteractionCompleted(LauncherState targetState) { + super.onSwipeInteractionCompleted(targetState); } @Override @@ -153,14 +152,4 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll protected float getShiftRange() { return mLauncher.getDeviceProfile().widthPx / 2f; } - - @Override - protected int getLogContainerTypeForNormalState(MotionEvent ev) { - return LauncherLogProto.ContainerType.NAVBAR; - } - - @Override - protected int getDirectionForLog() { - return Utilities.isRtl(mLauncher.getResources()) ? Direction.LEFT : Direction.RIGHT; - } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java index 16bd9ed384..fe69c9b87d 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/StatusBarTouchController.java @@ -15,10 +15,12 @@ */ package com.android.launcher3.uioverrides.touchcontrollers; +import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_DOWN; import static android.view.MotionEvent.ACTION_MOVE; import static android.view.MotionEvent.ACTION_UP; -import static android.view.MotionEvent.ACTION_CANCEL; + +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN; import android.graphics.PointF; import android.util.SparseArray; @@ -31,12 +33,9 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.TouchController; - import com.android.quickstep.SystemUiProxy; + import java.io.PrintWriter; /** @@ -133,9 +132,8 @@ public class StatusBarTouchController implements TouchController { int action = ev.getAction(); if (action == ACTION_UP || action == ACTION_CANCEL) { dispatchTouchEvent(ev); - mLauncher.getUserEventDispatcher().logActionOnContainer(action == ACTION_UP ? - Touch.FLING : Touch.SWIPE, Direction.DOWN, ContainerType.WORKSPACE, - mLauncher.getWorkspace().getCurrentPage()); + mLauncher.getStatsLogManager().logger() + .log(LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN); setWindowSlippery(false); return true; } diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java index df6194d4b2..186caf6dc1 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java @@ -36,7 +36,6 @@ import com.android.launcher3.anim.PendingAnimation; import com.android.launcher3.touch.BaseSwipeDetector; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.touch.SingleAxisSwipeDetector; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.FlingBlockCheck; import com.android.launcher3.util.TouchController; import com.android.launcher3.views.BaseDragLayer; @@ -203,7 +202,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity> mCurrentAnimation.setPlayFraction(0); } if (mPendingAnimation != null) { - mPendingAnimation.finish(false, Touch.SWIPE); + mPendingAnimation.finish(false); mPendingAnimation = null; } @@ -285,7 +284,6 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity> public void onDragEnd(float velocity) { boolean fling = mDetector.isFling(velocity); final boolean goingToEnd; - final int logAction; boolean blockedFling = fling && mFlingBlockCheck.isBlocked(); if (blockedFling) { fling = false; @@ -294,11 +292,9 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity> float progress = mCurrentAnimation.getProgressFraction(); float interpolatedProgress = mCurrentAnimation.getInterpolatedProgress(); if (fling) { - logAction = Touch.FLING; boolean goingUp = orientationHandler.isGoingUp(velocity, mIsRtl); goingToEnd = goingUp == mCurrentAnimationIsGoingUp; } else { - logAction = Touch.SWIPE; goingToEnd = interpolatedProgress > SUCCESS_TRANSITION_PROGRESS; } long animationDuration = BaseSwipeDetector.calculateDuration( @@ -307,14 +303,14 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity> animationDuration *= LauncherAnimUtils.blockedFlingDurationFactor(velocity); } - mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd, logAction)); + mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd)); mCurrentAnimation.startWithVelocity(mActivity, goingToEnd, velocity, mEndDisplacement, animationDuration); } - private void onCurrentAnimationEnd(boolean wasSuccess, int logAction) { + private void onCurrentAnimationEnd(boolean wasSuccess) { if (mPendingAnimation != null) { - mPendingAnimation.finish(wasSuccess, logAction); + mPendingAnimation.finish(wasSuccess); mPendingAnimation = null; } clearState(); @@ -326,7 +322,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity> mTaskBeingDragged = null; mCurrentAnimation = null; if (mPendingAnimation != null) { - mPendingAnimation.finish(false, Touch.SWIPE); + mPendingAnimation.finish(false); mPendingAnimation = null; } } diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 22e6755eb1..6774433a1f 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -75,12 +75,8 @@ import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogManager.StatsLogger; -import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.WindowBounds; @@ -219,8 +215,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends private boolean mPassedOverviewThreshold; private boolean mGestureStarted; - private int mLogAction = Touch.SWIPE; - private int mLogDirection = Direction.UP; + private boolean mLogDirectionUpOrLeft = true; private PointF mDownPos; private boolean mIsLikelyToStartNewTask; @@ -745,7 +740,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends public void onGestureCancelled() { updateDisplacement(0); mStateCallback.setStateOnUiThread(STATE_GESTURE_COMPLETED); - mLogAction = Touch.SWIPE_NOOP; handleNormalGestureEnd(0, false, new PointF(), true /* isCancel */); } @@ -761,13 +755,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends boolean isFling = mGestureStarted && !mIsMotionPaused && Math.abs(endVelocity) > flingThreshold; mStateCallback.setStateOnUiThread(STATE_GESTURE_COMPLETED); - - mLogAction = isFling ? Touch.FLING : Touch.SWIPE; boolean isVelocityVertical = Math.abs(velocity.y) > Math.abs(velocity.x); if (isVelocityVertical) { - mLogDirection = velocity.y < 0 ? Direction.UP : Direction.DOWN; + mLogDirectionUpOrLeft = velocity.y < 0; } else { - mLogDirection = velocity.x < 0 ? Direction.LEFT : Direction.RIGHT; + mLogDirectionUpOrLeft = velocity.x < 0; } mDownPos = downPos; handleNormalGestureEnd(endVelocity, isFling, velocity, false /* isCancel */); @@ -979,8 +971,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends break; case LAST_TASK: case NEW_TASK: - event = (mLogDirection == Direction.LEFT) - ? LAUNCHER_QUICKSWITCH_LEFT + event = mLogDirectionUpOrLeft ? LAUNCHER_QUICKSWITCH_LEFT : LAUNCHER_QUICKSWITCH_RIGHT; break; default: @@ -988,12 +979,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends } StatsLogger logger = StatsLogManager.newInstance(mContext).logger() .withSrcState(LAUNCHER_STATE_BACKGROUND) - .withDstState(StatsLogManager.containerTypeToAtomState(endTarget.containerType)); + .withDstState(endTarget.containerType); if (targetTask != null) { logger.withItemInfo(targetTask.getItemInfo()); } - logger.log(event); - DeviceProfile dp = mDp; if (dp == null || mDownPos == null) { @@ -1003,12 +992,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends int pageIndex = endTarget == LAST_TASK ? LOG_NO_OP_PAGE_INDEX : mRecentsView.getNextPage(); - UserEventDispatcher.newInstance(mContext).logStateChangeAction( - mLogAction, mLogDirection, - (int) mDownPos.x, (int) mDownPos.y, - ContainerType.NAVBAR, ContainerType.APP, - endTarget.containerType, - pageIndex); + // TODO: set correct container using the pageIndex + logger.log(event); } /** Animates to the given progress, where 0 is the current app and 1 is overview. */ diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java index 8b108ac299..d35e270dd5 100644 --- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java +++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java @@ -152,11 +152,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T public abstract void onExitOverview(RotationTouchHelper deviceState, Runnable exitRunnable); - /** - * Used for containerType in {@link com.android.launcher3.logging.UserEventDispatcher} - */ - public abstract int getContainerType(); - public abstract boolean isInLiveTileMode(); public abstract void onLaunchTaskFailed(); diff --git a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java index 3898f0b0ca..2885abff1b 100644 --- a/quickstep/src/com/android/quickstep/FallbackActivityInterface.java +++ b/quickstep/src/com/android/quickstep/FallbackActivityInterface.java @@ -28,7 +28,6 @@ import androidx.annotation.Nullable; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.fallback.RecentsState; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; @@ -145,15 +144,6 @@ public final class FallbackActivityInterface extends } @Override - public int getContainerType() { - RecentsActivity activity = getCreatedActivity(); - boolean visible = activity != null && activity.isStarted() && activity.hasWindowFocus(); - return visible - ? LauncherLogProto.ContainerType.OTHER_LAUNCHER_APP - : LauncherLogProto.ContainerType.APP; - } - - @Override public boolean isInLiveTileMode() { return false; } diff --git a/quickstep/src/com/android/quickstep/GestureState.java b/quickstep/src/com/android/quickstep/GestureState.java index 00b5eb9880..9c23c8320b 100644 --- a/quickstep/src/com/android/quickstep/GestureState.java +++ b/quickstep/src/com/android/quickstep/GestureState.java @@ -15,6 +15,9 @@ */ package com.android.quickstep; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; import android.annotation.TargetApi; @@ -23,7 +26,6 @@ import android.content.Intent; import android.os.Build; import com.android.launcher3.statemanager.StatefulActivity; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.util.ActiveGestureLog; import com.android.systemui.shared.recents.model.ThumbnailData; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; @@ -44,13 +46,13 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL * Defines the end targets of a gesture and the associated state. */ public enum GestureEndTarget { - HOME(true, ContainerType.WORKSPACE, false), + HOME(true, LAUNCHER_STATE_HOME, false), - RECENTS(true, ContainerType.TASKSWITCHER, true), + RECENTS(true, LAUNCHER_STATE_OVERVIEW, true), - NEW_TASK(false, ContainerType.APP, true), + NEW_TASK(false, LAUNCHER_STATE_BACKGROUND, true), - LAST_TASK(false, ContainerType.APP, true); + LAST_TASK(false, LAUNCHER_STATE_BACKGROUND, true); GestureEndTarget(boolean isLauncher, int containerType, boolean recentsAttachedToAppWindow) { diff --git a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java index 036d473060..98b8455e51 100644 --- a/quickstep/src/com/android/quickstep/LauncherActivityInterface.java +++ b/quickstep/src/com/android/quickstep/LauncherActivityInterface.java @@ -44,7 +44,6 @@ import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty; import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; @@ -208,10 +207,6 @@ public final class LauncherActivityInterface extends return false; } - launcher.getUserEventDispatcher().logActionCommand( - LauncherLogProto.Action.Command.RECENTS_BUTTON, - getContainerType(), - LauncherLogProto.ContainerType.TASKSWITCHER); launcher.getStateManager().goToState(OVERVIEW, launcher.getStateManager().shouldAnimateStateChange(), onCompleteCallback); return true; @@ -253,13 +248,6 @@ public final class LauncherActivityInterface extends } @Override - public int getContainerType() { - final Launcher launcher = getVisibleLauncher(); - return launcher != null ? launcher.getStateManager().getState().containerType - : LauncherLogProto.ContainerType.APP; - } - - @Override public boolean isInLiveTileMode() { Launcher launcher = getCreatedActivity(); return launcher != null && launcher.getStateManager().getState() == OVERVIEW && diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index 365cff576a..2b10989ec5 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -30,7 +30,6 @@ import android.view.ViewConfiguration; import androidx.annotation.BinderThread; import com.android.launcher3.statemanager.StatefulActivity; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.RemoteAnimationProvider; import com.android.quickstep.views.RecentsView; @@ -150,7 +149,6 @@ public class OverviewCommandHelper { private final AppToOverviewAnimationProvider<T> mAnimationProvider; private final long mToggleClickedTime = SystemClock.uptimeMillis(); - private boolean mUserEventLogged; private ActivityInitListener mListener; public RecentsActivityCommand() { @@ -212,13 +210,6 @@ public class OverviewCommandHelper { private boolean onActivityReady(Boolean wasVisible) { final T activity = mActivityInterface.getCreatedActivity(); - if (!mUserEventLogged) { - activity.getUserEventDispatcher().logActionCommand( - LauncherLogProto.Action.Command.RECENTS_BUTTON, - mActivityInterface.getContainerType(), - LauncherLogProto.ContainerType.TASKSWITCHER); - mUserEventLogged = true; - } return mAnimationProvider.onActivityReady(activity, wasVisible); } diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index 6f2f9fb523..0e32c95199 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -118,7 +118,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> { * etc.) */ protected void onHandleConfigChanged() { - mUserEventDispatcher = null; initDeviceProfile(); AbstractFloatingView.closeOpenViews(this, true, diff --git a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java index 2b55b805c6..65bb0f35d1 100644 --- a/quickstep/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/src/com/android/quickstep/TaskShortcutFactory.java @@ -21,7 +21,6 @@ import static android.view.Display.DEFAULT_DISPLAY; import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SELECTIONS; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP; import android.app.Activity; import android.app.ActivityOptions; @@ -39,7 +38,6 @@ import com.android.launcher3.logging.StatsLogManager.LauncherEvent; import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.popup.SystemShortcut.AppInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.Executors; import com.android.launcher3.util.InstantAppResolver; import com.android.quickstep.views.RecentsView; @@ -228,8 +226,6 @@ public interface TaskShortcutFactory { @Override protected boolean onActivityStarted(BaseDraggingActivity activity) { - activity.getUserEventDispatcher().logActionOnControl(TAP, - LauncherLogProto.ControlType.SPLIT_SCREEN_TARGET); return true; } }; diff --git a/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java index 89e6931ed9..580e4ec807 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java @@ -25,12 +25,6 @@ import static android.view.MotionEvent.ACTION_POINTER_UP; import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.Utilities.squaredHypot; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPLEFT; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPRIGHT; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.FLING; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE_NOOP; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.NAVBAR; import android.animation.ValueAnimator; import android.content.Context; @@ -47,7 +41,6 @@ import android.view.ViewConfiguration; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; import com.android.launcher3.anim.Interpolators; -import com.android.launcher3.logging.UserEventDispatcher; import com.android.quickstep.BaseActivityInterface; import com.android.quickstep.GestureState; import com.android.quickstep.InputConsumer; @@ -80,7 +73,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer { private float mTimeFraction; private long mDragTime; private float mLastProgress; - private int mDirection; private BaseActivityInterface mActivityInterface; private final float mDragDistThreshold; @@ -197,8 +189,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer { if (mState != STATE_DELEGATE_ACTIVE && !mLaunchedAssistant) { ValueAnimator animator = ValueAnimator.ofFloat(mLastProgress, 0) .setDuration(RETRACT_ANIMATION_DURATION_MS); - UserEventDispatcher.newInstance(mContext).logActionOnContainer( - SWIPE_NOOP, mDirection, NAVBAR); animator.addUpdateListener(valueAnimator -> { float progress = (float) valueAnimator.getAnimatedValue(); SystemUiProxy.INSTANCE.get(mContext).onAssistantProgress(progress); @@ -223,7 +213,7 @@ public class AssistantInputConsumer extends DelegateInputConsumer { mLastProgress = Math.min(mDistance * 1f / mDragDistThreshold, 1) * mTimeFraction; if (mDistance >= mDragDistThreshold && mTimeFraction >= 1) { SystemUiProxy.INSTANCE.get(mContext).onAssistantGestureCompletion(0); - startAssistantInternal(SWIPE); + startAssistantInternal(); Bundle args = new Bundle(); args.putInt(OPA_BUNDLE_TRIGGER, OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE); @@ -236,10 +226,7 @@ public class AssistantInputConsumer extends DelegateInputConsumer { } } - private void startAssistantInternal(int gestureType) { - UserEventDispatcher.newInstance(mContext) - .logActionOnContainer(gestureType, mDirection, NAVBAR); - + private void startAssistantInternal() { BaseDraggingActivity launcherActivity = mActivityInterface.getCreatedActivity(); if (launcherActivity != null) { launcherActivity.getRootView().performHapticFeedback( @@ -253,7 +240,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer { */ private boolean isValidAssistantGestureAngle(float deltaX, float deltaY) { float angle = (float) Math.toDegrees(Math.atan2(deltaY, deltaX)); - mDirection = angle > 90 ? UPLEFT : UPRIGHT; // normalize so that angle is measured clockwise from horizontal in the bottom right corner // and counterclockwise from horizontal in the bottom left corner @@ -272,7 +258,7 @@ public class AssistantInputConsumer extends DelegateInputConsumer { mLastProgress = 1; SystemUiProxy.INSTANCE.get(mContext).onAssistantGestureCompletion( (float) Math.sqrt(velocityX * velocityX + velocityY * velocityY)); - startAssistantInternal(FLING); + startAssistantInternal(); Bundle args = new Bundle(); args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE); diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java index 1c77a0593d..924b32c015 100644 --- a/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java +++ b/quickstep/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java @@ -15,6 +15,7 @@ */ package com.android.quickstep.inputconsumers; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE; @@ -27,9 +28,6 @@ import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.quickstep.GestureState; import com.android.quickstep.InputConsumer; import com.android.quickstep.RecentsAnimationDeviceState; @@ -82,17 +80,12 @@ public class OverviewWithoutFocusInputConsumer implements InputConsumer, mContext.startActivity(mGestureState.getHomeIntent()); ActiveGestureLog.INSTANCE.addLog("startQuickstep"); BaseActivity activity = BaseDraggingActivity.fromContext(mContext); - int pageIndex = -1; // This number doesn't reflect workspace page index. - // It only indicates that launcher client screen was shown. - int containerType = (mGestureState != null && mGestureState.getEndTarget() != null) + int state = (mGestureState != null && mGestureState.getEndTarget() != null) ? mGestureState.getEndTarget().containerType - : LauncherLogProto.ContainerType.WORKSPACE; - activity.getUserEventDispatcher().logActionOnContainer( - wasFling ? Touch.FLING : Touch.SWIPE, Direction.UP, containerType, pageIndex); - activity.getUserEventDispatcher().setPreviousHomeGesture(true); + : LAUNCHER_STATE_HOME; activity.getStatsLogManager().logger() - .withSrcState(LAUNCHER_STATE_HOME) - .withDstState(LAUNCHER_STATE_HOME) + .withSrcState(LAUNCHER_STATE_BACKGROUND) + .withDstState(state) .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() .setWorkspace( LauncherAtom.WorkspaceContainer.newBuilder() diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java index df9b0cf435..de44e07bae 100644 --- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java +++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java @@ -23,7 +23,6 @@ import static android.view.Surface.ROTATION_180; import static android.view.Surface.ROTATION_270; import static android.view.Surface.ROTATION_90; -import static com.android.launcher3.logging.LoggerUtils.extractObjectNameAndAddress; import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS; @@ -72,6 +71,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre private static final String TAG = "RecentsOrientedState"; private static final boolean DEBUG = false; + private static final String DELIMITER_DOT = "\\."; private ContentObserver mSystemAutoRotateObserver = new ContentObserver(new Handler()) { @Override @@ -534,4 +534,13 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre ? idp.landscapeProfile : idp.portraitProfile; } + + /** + * String conversion for only the helpful parts of {@link Object#toString()} method + * @param stringToExtract "foo.bar.baz.MyObject@1234" + * @return "MyObject@1234" + */ + private static String extractObjectNameAndAddress(String stringToExtract) { + return stringToExtract.substring(stringToExtract.lastIndexOf(DELIMITER_DOT)); + } } diff --git a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java index b06d4bc355..95bde801bf 100644 --- a/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java +++ b/quickstep/src/com/android/quickstep/views/DigitalWellBeingToast.java @@ -42,7 +42,6 @@ import androidx.annotation.StringRes; import com.android.launcher3.BaseActivity; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.systemui.shared.recents.model.Task; import java.time.Duration; @@ -217,8 +216,8 @@ public final class DigitalWellBeingToast { view, 0, 0, view.getWidth(), view.getHeight()); activity.startActivity(intent, options.toBundle()); - activity.getUserEventDispatcher().logActionOnControl(LauncherLogProto.Action.Touch.TAP, - LauncherLogProto.ControlType.APP_USAGE_SETTINGS, view); + + // TODO: add WW logging on the app usage settings click. } catch (ActivityNotFoundException e) { Log.e(TAG, "Failed to open app usage settings for task " + mTask.getTopComponent().getPackageName(), e); diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java index 0d1dd22ba5..4bfa4da42a 100644 --- a/quickstep/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/src/com/android/quickstep/views/RecentsView.java @@ -35,12 +35,11 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_2; import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN; import static com.android.launcher3.statehandlers.DepthController.DEPTH; import static com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController.SUCCESS_TRANSITION_PROGRESS; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CLEAR_ALL_BUTTON; import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW; import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId; @@ -108,7 +107,6 @@ import com.android.launcher3.statehandlers.DepthController; import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.touch.PagedOrientationHandler; import com.android.launcher3.touch.PagedOrientationHandler.CurveProperties; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.DynamicResource; import com.android.launcher3.util.MultiValueAlpha; @@ -1463,7 +1461,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView public PendingAnimation createTaskDismissAnimation(TaskView taskView, boolean animateTaskView, boolean shouldRemoveTask, long duration) { if (mPendingAnimation != null) { - mPendingAnimation.finish(false, Touch.SWIPE); + mPendingAnimation.finish(false); } PendingAnimation anim = new PendingAnimation(duration); @@ -1625,7 +1623,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView protected void runDismissAnimation(PendingAnimation pendingAnim) { AnimatorPlaybackController controller = pendingAnim.createPlaybackController(); controller.dispatchOnStart(); - controller.setEndAction(() -> pendingAnim.finish(true, Touch.SWIPE)); + controller.setEndAction(() -> pendingAnim.finish(true)); controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN); controller.start(); } @@ -1638,7 +1636,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView @SuppressWarnings("unused") private void dismissAllTasks(View view) { runDismissAnimation(createAllTasksDismissAnimation(DISMISS_TASK_DURATION)); - mActivity.getUserEventDispatcher().logActionOnControl(TAP, CLEAR_ALL_BUTTON); + mActivity.getStatsLogManager().logger().log(LAUNCHER_TASK_CLEAR_ALL); } private void dismissCurrentTask() { diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java index 6a2ab5a304..034d9fb7f7 100644 --- a/quickstep/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/src/com/android/quickstep/views/TaskView.java @@ -73,15 +73,11 @@ import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.Interpolators; import com.android.launcher3.anim.PendingAnimation; -import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.testing.TestLogging; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.PagedOrientationHandler; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.TransformingTouchDelegate; import com.android.launcher3.util.ViewPool.Reusable; @@ -368,7 +364,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { this, RECENTS_LAUNCH_DURATION, TOUCH_RESPONSE_INTERPOLATOR); AnimatorPlaybackController currentAnimation = pendingAnimation.createPlaybackController(); currentAnimation.setEndAction(() -> { - pendingAnimation.finish(true, Touch.SWIPE); + pendingAnimation.finish(true); launchTask(false); }); return currentAnimation; @@ -483,15 +479,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { } } - private boolean showTaskMenu(int action) { + private boolean showTaskMenu() { if (!getRecentsView().isClearAllHidden()) { getRecentsView().snapToPage(getRecentsView().indexOfChild(this)); } else { mMenuView = TaskMenuView.showForTask(this); mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo()) .log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS); - UserEventDispatcher.newInstance(getContext()).logActionOnItem(action, Direction.NONE, - LauncherLogProto.ItemType.TASK_ICON); if (mMenuView != null) { mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener); } @@ -502,10 +496,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { private void setIcon(Drawable icon) { if (icon != null) { mIconView.setDrawable(icon); - mIconView.setOnClickListener(v -> showTaskMenu(Touch.TAP)); + mIconView.setOnClickListener(v -> showTaskMenu()); mIconView.setOnLongClickListener(v -> { requestDisallowInterceptTouchEvent(true); - return showTaskMenu(Touch.LONGPRESS); + return showTaskMenu(); }); } else { mIconView.setDrawable(null); diff --git a/res/values/config.xml b/res/values/config.xml index 325b62f9dc..46b8c23a62 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -59,7 +59,6 @@ <bool name="hotseat_transpose_layout_with_orientation">true</bool> <!-- Various classes overriden by projects/build flavors. --> - <string name="user_event_dispatcher_class" translatable="false"></string> <string name="folder_name_provider_class" translatable="false"></string> <string name="stats_log_manager_class" translatable="false"></string> <string name="app_transition_manager_class" translatable="false"></string> diff --git a/robolectric_tests/src/com/android/launcher3/secondarydisplay/SDWorkModeTest.java b/robolectric_tests/src/com/android/launcher3/secondarydisplay/SDWorkModeTest.java index 0ca5ce6f44..baae2a6a80 100644 --- a/robolectric_tests/src/com/android/launcher3/secondarydisplay/SDWorkModeTest.java +++ b/robolectric_tests/src/com/android/launcher3/secondarydisplay/SDWorkModeTest.java @@ -21,7 +21,6 @@ import static com.android.launcher3.util.Preconditions.assertNotNull; import static org.junit.Assert.assertNotSame; import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; import android.content.Context; import android.os.UserManager; @@ -30,8 +29,6 @@ import android.provider.Settings; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.allapps.AllAppsPagedView; import com.android.launcher3.allapps.AllAppsRecyclerView; -import com.android.launcher3.logging.UserEventDispatcher; -import com.android.launcher3.shadows.ShadowOverrides; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.LauncherModelHelper; @@ -69,8 +66,6 @@ public class SDWorkModeTest { mModelHelper = new LauncherModelHelper(); mTargetContext = RuntimeEnvironment.application; mIdp = InvariantDeviceProfile.INSTANCE.get(mTargetContext); - ShadowOverrides.setProvider(UserEventDispatcher.class, - c -> mock(UserEventDispatcher.class)); Settings.Global.putFloat(mTargetContext.getContentResolver(), Settings.Global.WINDOW_ANIMATION_SCALE, 0); diff --git a/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java b/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java index d330d10133..957ae77eee 100644 --- a/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java +++ b/robolectric_tests/src/com/android/launcher3/ui/LauncherUIScrollTest.java @@ -20,7 +20,6 @@ import static com.android.launcher3.util.LauncherUIHelper.doLayout; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; -import static org.mockito.Mockito.mock; import android.content.Context; import android.os.SystemClock; @@ -36,8 +35,6 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.folder.FolderPagedView; -import com.android.launcher3.logging.UserEventDispatcher; -import com.android.launcher3.shadows.ShadowOverrides; import com.android.launcher3.util.LauncherLayoutBuilder; import com.android.launcher3.util.LauncherLayoutBuilder.FolderBuilder; import com.android.launcher3.util.LauncherModelHelper; @@ -70,8 +67,6 @@ public class LauncherUIScrollTest { mModelHelper = new LauncherModelHelper(); mTargetContext = RuntimeEnvironment.application; mIdp = InvariantDeviceProfile.INSTANCE.get(mTargetContext); - ShadowOverrides.setProvider(UserEventDispatcher.class, - c -> mock(UserEventDispatcher.class)); Settings.Global.putFloat(mTargetContext.getContentResolver(), Settings.Global.WINDOW_ANIMATION_SCALE, 0); diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java index 310c306f19..5e50e278f0 100644 --- a/src/com/android/launcher3/BaseActivity.java +++ b/src/com/android/launcher3/BaseActivity.java @@ -37,8 +37,6 @@ import androidx.annotation.IntDef; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.logging.StatsLogManager; -import com.android.launcher3.logging.UserEventDispatcher; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.SystemUiController; import com.android.launcher3.util.ViewCache; import com.android.launcher3.views.ActivityContext; @@ -82,7 +80,6 @@ public abstract class BaseActivity extends Activity implements ActivityContext { new ArrayList<>(); protected DeviceProfile mDeviceProfile; - protected UserEventDispatcher mUserEventDispatcher; protected StatsLogManager mStatsLogManager; protected SystemUiController mSystemUiController; @@ -144,8 +141,6 @@ public abstract class BaseActivity extends Activity implements ActivityContext { return mDeviceProfile; } - public void modifyUserEvent(LauncherLogProto.LauncherEvent event) {} - public final StatsLogManager getStatsLogManager() { if (mStatsLogManager == null) { mStatsLogManager = StatsLogManager.newInstance(this); @@ -153,13 +148,6 @@ public abstract class BaseActivity extends Activity implements ActivityContext { return mStatsLogManager; } - public final UserEventDispatcher getUserEventDispatcher() { - if (mUserEventDispatcher == null) { - mUserEventDispatcher = UserEventDispatcher.newInstance(this); - } - return mUserEventDispatcher; - } - public SystemUiController getSystemUiController() { if (mSystemUiController == null) { mSystemUiController = new SystemUiController(getWindow()); diff --git a/src/com/android/launcher3/ButtonDropTarget.java b/src/com/android/launcher3/ButtonDropTarget.java index 09827d664b..df005e6357 100644 --- a/src/com/android/launcher3/ButtonDropTarget.java +++ b/src/com/android/launcher3/ButtonDropTarget.java @@ -47,7 +47,6 @@ import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.dragndrop.DragView; import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.Themes; import com.android.launcher3.util.Thunk; @@ -395,6 +394,4 @@ public abstract class ButtonDropTarget extends TextView TextUtils.TruncateAt.END); return !mText.equals(displayedText); } - - public abstract Target getDropTargetForLogging(); } diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java index 28574972ad..cc119c9361 100644 --- a/src/com/android/launcher3/DeleteDropTarget.java +++ b/src/com/android/launcher3/DeleteDropTarget.java @@ -18,8 +18,7 @@ package com.android.launcher3; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROPPED_ON_CANCEL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROPPED_ON_REMOVE; -import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.UNDO; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNDO; import android.content.Context; import android.text.TextUtils; @@ -28,22 +27,19 @@ import android.view.View; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate; import com.android.launcher3.dragndrop.DragOptions; -import com.android.launcher3.logging.LoggerUtils; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.views.Snackbar; public class DeleteDropTarget extends ButtonDropTarget { private final StatsLogManager mStatsLogManager; - private int mControlType = ControlType.DEFAULT_CONTROLTYPE; + private StatsLogManager.LauncherEvent mLauncherEvent; public DeleteDropTarget(Context context, AttributeSet attrs) { this(context, attrs, 0); @@ -115,8 +111,8 @@ public class DeleteDropTarget extends ButtonDropTarget { * Set mControlType depending on the drag item. */ private void setControlTypeBasedOnDragSource(ItemInfo item) { - mControlType = item.id != ItemInfo.NO_ID ? ControlType.REMOVE_TARGET - : ControlType.CANCEL_TARGET; + mLauncherEvent = item.id != ItemInfo.NO_ID ? LAUNCHER_ITEM_DROPPED_ON_REMOVE + : LAUNCHER_ITEM_DROPPED_ON_CANCEL; } @Override @@ -127,8 +123,7 @@ public class DeleteDropTarget extends ButtonDropTarget { } super.onDrop(d, options); mStatsLogManager.logger().withInstanceId(d.logInstanceId) - .log(mControlType == ControlType.REMOVE_TARGET ? LAUNCHER_ITEM_DROPPED_ON_REMOVE - : LAUNCHER_ITEM_DROPPED_ON_CANCEL); + .log(mLauncherEvent); } @Override @@ -141,7 +136,7 @@ public class DeleteDropTarget extends ButtonDropTarget { Runnable onUndoClicked = () -> { mLauncher.setPageToBindSynchronously(itemPage); modelWriter.abortDelete(); - mLauncher.getUserEventDispatcher().logActionOnControl(TAP, UNDO); + mLauncher.getStatsLogManager().logger().log(LAUNCHER_UNDO); }; Snackbar.show(mLauncher, R.string.item_removed, R.string.undo, modelWriter::commitDelete, onUndoClicked); @@ -161,11 +156,4 @@ public class DeleteDropTarget extends ButtonDropTarget { mLauncher.getDragLayer() .announceForAccessibility(getContext().getString(R.string.item_removed)); } - - @Override - public Target getDropTargetForLogging() { - Target t = LoggerUtils.newTarget(Target.Type.CONTROL); - t.controlType = mControlType; - return t; - } } diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 51f3819460..6547b53940 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -16,8 +16,6 @@ package com.android.launcher3; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; - import android.content.Context; import android.graphics.Rect; import android.util.AttributeSet; @@ -27,14 +25,10 @@ import android.view.ViewDebug; import android.view.ViewGroup; import android.widget.FrameLayout; -import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; -import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; - -import java.util.ArrayList; - -public class Hotseat extends CellLayout implements LogContainerProvider, Insettable { +/** + * View class that represents the bottom row of the home screen. + */ +public class Hotseat extends CellLayout implements Insettable { @ViewDebug.ExportedProperty(category = "launcher") private boolean mHasVerticalHotseat; @@ -79,15 +73,6 @@ public class Hotseat extends CellLayout implements LogContainerProvider, Insetta } @Override - public void fillInLogContainerData(ItemInfo childInfo, Target child, - ArrayList<Target> parents) { - child.rank = childInfo.rank; - child.gridX = childInfo.cellX; - child.gridY = childInfo.cellY; - parents.add(newContainerTarget(LauncherLogProto.ContainerType.HOTSEAT)); - } - - @Override public void setInsets(Rect insets) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams(); DeviceProfile grid = mActivity.getDeviceProfile(); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 1cf2e89e44..4b75a33fc1 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -37,11 +37,10 @@ import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.LauncherState.SPRING_LOADED; import static com.android.launcher3.Utilities.postAsyncCallback; import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP; -import static com.android.launcher3.logging.StatsLogManager.containerTypeToAtomState; import static com.android.launcher3.model.ItemInstallQueue.FLAG_ACTIVITY_PAUSED; import static com.android.launcher3.model.ItemInstallQueue.FLAG_DRAG_AND_DROP; import static com.android.launcher3.model.ItemInstallQueue.FLAG_LOADER_RUNNING; @@ -127,7 +126,6 @@ import com.android.launcher3.keyboard.ViewGroupFocusHelper; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logging.FileLog; import com.android.launcher3.logging.StatsLogManager; -import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.model.BgDataModel.Callbacks; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.ModelUtils; @@ -155,9 +153,6 @@ import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.AllAppsSwipeController; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ActivityResultInfo; import com.android.launcher3.util.ActivityTracker; import com.android.launcher3.util.ComponentKey; @@ -561,7 +556,6 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche } private void onIdpChanged(InvariantDeviceProfile idp) { - mUserEventDispatcher = null; initDeviceProfile(idp); dispatchDeviceProfileChanged(); @@ -917,7 +911,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche mOverlayManager.onActivityStopped(this); } - logStopAndResume(Action.Command.STOP); + logStopAndResume(false /* isResume */); mAppWidgetHost.setListenIfResumed(false); NotificationListener.removeNotificationsChangedListener(); } @@ -939,7 +933,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche @Override @CallSuper protected void onDeferredResumed() { - logStopAndResume(Action.Command.RESUME); + logStopAndResume(true /* isResume */); // Process any items that were added while Launcher was away. ItemInstallQueue.INSTANCE.get(this) @@ -956,32 +950,28 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche protected void handlePendingActivityRequest() { } - private void logStopAndResume(int command) { + private void logStopAndResume(boolean isResume) { if (mPendingExecutor != null) return; int pageIndex = mWorkspace.isOverlayShown() ? -1 : mWorkspace.getCurrentPage(); - int containerType = mStateManager.getState().containerType; + int statsLogOrdinal = mStateManager.getState().statsLogOrdinal; StatsLogManager.EventEnum event; StatsLogManager.StatsLogger logger = getStatsLogManager().logger(); - if (command == Action.Command.RESUME) { + if (isResume) { logger.withSrcState(LAUNCHER_STATE_BACKGROUND) - .withDstState(containerTypeToAtomState(mStateManager.getState().containerType)); + .withDstState(mStateManager.getState().statsLogOrdinal); event = LAUNCHER_ONRESUME; } else { /* command == Action.Command.STOP */ - logger.withSrcState(containerTypeToAtomState(mStateManager.getState().containerType)) + logger.withSrcState(mStateManager.getState().statsLogOrdinal) .withDstState(LAUNCHER_STATE_BACKGROUND); event = LAUNCHER_ONSTOP; } - if (containerType == ContainerType.WORKSPACE && mWorkspace != null) { - getUserEventDispatcher().logActionCommand(command, - containerType, -1, pageIndex); + if (statsLogOrdinal == LAUNCHER_STATE_HOME && mWorkspace != null) { logger.withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() .setWorkspace( LauncherAtom.WorkspaceContainer.newBuilder() .setPageIndex(pageIndex)).build()); - } else { - getUserEventDispatcher().logActionCommand(command, containerType, -1); } logger.log(event); } @@ -1483,11 +1473,6 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche } // Handle HOME_INTENT - UserEventDispatcher ued = getUserEventDispatcher(); - Target target = newContainerTarget(mStateManager.getState().containerType); - target.pageIndex = mWorkspace.getCurrentPage(); - ued.logActionCommand(Action.Command.HOME_INTENT, target, - newContainerTarget(ContainerType.WORKSPACE)); hideKeyboard(); if (mLauncherCallbacks != null) { diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index b6bc500a58..eba0ac9633 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -16,6 +16,7 @@ package com.android.launcher3; import static com.android.launcher3.anim.Interpolators.ACCEL_2; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; import static com.android.launcher3.testing.TestProtocol.ALL_APPS_STATE_ORDINAL; import static com.android.launcher3.testing.TestProtocol.BACKGROUND_APP_STATE_ORDINAL; import static com.android.launcher3.testing.TestProtocol.HINT_STATE_ORDINAL; @@ -35,7 +36,6 @@ import com.android.launcher3.states.SpringLoadedState; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.states.AllAppsState; import com.android.launcher3.uioverrides.states.OverviewState; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import java.util.Arrays; @@ -97,7 +97,7 @@ public abstract class LauncherState implements BaseState<LauncherState> { * TODO: Create a separate class for NORMAL state. */ public static final LauncherState NORMAL = new LauncherState(NORMAL_STATE_ORDINAL, - ContainerType.WORKSPACE, + LAUNCHER_STATE_HOME, FLAG_DISABLE_RESTORE | FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED | FLAG_HIDE_BACK_BUTTON | FLAG_HAS_SYS_UI_SCRIM) { @Override @@ -126,9 +126,9 @@ public abstract class LauncherState implements BaseState<LauncherState> { public final int ordinal; /** - * Used for containerType in {@link com.android.launcher3.logging.UserEventDispatcher} + * Used for {@link com.android.launcher3.logging.StatsLogManager} */ - public final int containerType; + public final int statsLogOrdinal; /** * True if the state has overview panel visible. @@ -137,8 +137,8 @@ public abstract class LauncherState implements BaseState<LauncherState> { private final int mFlags; - public LauncherState(int id, int containerType, int flags) { - this.containerType = containerType; + public LauncherState(int id, int statsLogOrdinal, int flags) { + this.statsLogOrdinal = statsLogOrdinal; this.mFlags = flags; this.overviewUi = (flags & FLAG_OVERVIEW_UI) != 0; this.ordinal = id; diff --git a/src/com/android/launcher3/SecondaryDropTarget.java b/src/com/android/launcher3/SecondaryDropTarget.java index 2df7f5ad20..92b88e6186 100644 --- a/src/com/android/launcher3/SecondaryDropTarget.java +++ b/src/com/android/launcher3/SecondaryDropTarget.java @@ -37,14 +37,11 @@ import com.android.launcher3.Launcher.OnResumeCallback; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.logging.FileLog; -import com.android.launcher3.logging.LoggerUtils; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogManager.StatsLogger; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.ItemInfoWithIcon; import com.android.launcher3.model.data.LauncherAppWidgetInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.Themes; @@ -135,19 +132,6 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList } @Override - public Target getDropTargetForLogging() { - Target t = LoggerUtils.newTarget(Target.Type.CONTROL); - if (mCurrentAccessibilityAction == UNINSTALL) { - t.controlType = ControlType.UNINSTALL_TARGET; - } else if (mCurrentAccessibilityAction == DISMISS_PREDICTION) { - t.controlType = ControlType.DISMISS_PREDICTION; - } else { - t.controlType = ControlType.SETTINGS_BUTTON; - } - return t; - } - - @Override protected boolean supportsDrop(ItemInfo info) { return supportsAccessibilityDrop(info, getViewUnderDrag(info)); } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index e7ded363a2..98328cf8af 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -85,7 +85,6 @@ import com.android.launcher3.icons.BitmapRenderer; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogManager.LauncherEvent; -import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.model.data.AppInfo; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; @@ -97,8 +96,6 @@ import com.android.launcher3.statemanager.StateManager; import com.android.launcher3.statemanager.StateManager.StateHandler; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.touch.WorkspaceTouchListener; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.Executors; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.IntSparseArrayMap; @@ -1004,8 +1001,6 @@ public class Workspace extends PagedView<WorkspacePageIndicator> public void onOverlayScrollChanged(float scroll) { if (Float.compare(scroll, 1f) == 0) { if (!mOverlayShown) { - mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE, - Action.Direction.LEFT, ContainerType.WORKSPACE, 0); mLauncher.getStatsLogManager().logger() .withSrcState(LAUNCHER_STATE_HOME) .withDstState(LAUNCHER_STATE_HOME) @@ -1020,20 +1015,16 @@ public class Workspace extends PagedView<WorkspacePageIndicator> // Not announcing the overlay page for accessibility since it announces itself. } else if (Float.compare(scroll, 0f) == 0) { if (mOverlayShown) { - UserEventDispatcher ued = mLauncher.getUserEventDispatcher(); - if (!ued.isPreviousHomeGesture()) { - mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE, - Action.Direction.RIGHT, ContainerType.WORKSPACE, -1); - mLauncher.getStatsLogManager().logger() - .withSrcState(LAUNCHER_STATE_HOME) - .withDstState(LAUNCHER_STATE_HOME) - .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() - .setWorkspace( - LauncherAtom.WorkspaceContainer.newBuilder() - .setPageIndex(-1)) - .build()) - .log(LAUNCHER_SWIPERIGHT); - } + // TODO: this is logged unnecessarily on home gesture. + mLauncher.getStatsLogManager().logger() + .withSrcState(LAUNCHER_STATE_HOME) + .withDstState(LAUNCHER_STATE_HOME) + .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() + .setWorkspace( + LauncherAtom.WorkspaceContainer.newBuilder() + .setPageIndex(-1)) + .build()) + .log(LAUNCHER_SWIPERIGHT); } else if (Float.compare(mOverlayTranslation, 0f) != 0) { // When arriving to 0 overscroll from non-zero overscroll, announce page for // accessibility since default announcements were disabled while in overscroll @@ -1124,12 +1115,8 @@ public class Workspace extends PagedView<WorkspacePageIndicator> protected void notifyPageSwitchListener(int prevPage) { super.notifyPageSwitchListener(prevPage); if (prevPage != mCurrentPage) { - int swipeDirection = (prevPage < mCurrentPage) - ? Action.Direction.RIGHT : Action.Direction.LEFT; StatsLogManager.EventEnum event = (prevPage < mCurrentPage) ? LAUNCHER_SWIPERIGHT : LAUNCHER_SWIPELEFT; - mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE, - swipeDirection, ContainerType.WORKSPACE, prevPage); mLauncher.getStatsLogManager().logger() .withSrcState(LAUNCHER_STATE_HOME) .withDstState(LAUNCHER_STATE_HOME) diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java index 13a93ff0cc..72b6d94192 100644 --- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java +++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java @@ -19,8 +19,6 @@ import static android.view.View.MeasureSpec.EXACTLY; import static android.view.View.MeasureSpec.UNSPECIFIED; import static android.view.View.MeasureSpec.makeMeasureSpec; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; - import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; @@ -38,10 +36,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.R; import com.android.launcher3.allapps.AllAppsGridAdapter.AppsGridLayoutManager; -import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; -import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.views.RecyclerViewFastScroller; import java.util.ArrayList; @@ -50,7 +44,7 @@ import java.util.List; /** * A RecyclerView with custom fast scroll support for the all apps view. */ -public class AllAppsRecyclerView extends BaseRecyclerView implements LogContainerProvider { +public class AllAppsRecyclerView extends BaseRecyclerView { private AlphabeticalAppsList mApps; private final int mNumAppsPerRow; @@ -176,13 +170,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine mAutoSizedOverlays.clear(); } - @Override - public void fillInLogContainerData(ItemInfo childInfo, Target child, - ArrayList<Target> parents) { - parents.add(newContainerTarget( - getApps().hasFilter() ? ContainerType.SEARCHRESULT : ContainerType.ALLAPPS)); - } - public void onSearchResultsChanged() { // Always scroll the view to the top so the user can see the changed results scrollToTop(); diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index 14595ca941..0005db88c8 100644 --- a/src/com/android/launcher3/allapps/DiscoveryBounce.java +++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java @@ -18,8 +18,6 @@ package com.android.launcher3.allapps; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.HOTSEAT; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.PREDICTION; import android.animation.Animator; import android.animation.AnimatorInflater; @@ -120,10 +118,10 @@ public class DiscoveryBounce extends AbstractFloatingView { return (type & TYPE_DISCOVERY_BOUNCE) != 0; } - private void show(int containerType) { + private void show() { mIsOpen = true; mLauncher.getDragLayer().addView(this); - mLauncher.getUserEventDispatcher().logActionBounceTip(containerType); + // TODO: add WW log for discovery bounce tip show event. } public static void showForHomeIfNeeded(Launcher launcher) { @@ -146,7 +144,7 @@ public class DiscoveryBounce extends AbstractFloatingView { } onboardingPrefs.incrementEventCount(OnboardingPrefs.HOME_BOUNCE_COUNT); - new DiscoveryBounce(launcher, 0).show(HOTSEAT); + new DiscoveryBounce(launcher, 0).show(); } public static void showForOverviewIfNeeded(Launcher launcher, @@ -179,7 +177,7 @@ public class DiscoveryBounce extends AbstractFloatingView { onboardingPrefs.incrementEventCount(OnboardingPrefs.SHELF_BOUNCE_COUNT); new DiscoveryBounce(launcher, (1 - OVERVIEW.getVerticalProgress(launcher))) - .show(PREDICTION); + .show(); } /** diff --git a/src/com/android/launcher3/anim/PendingAnimation.java b/src/com/android/launcher3/anim/PendingAnimation.java index 53625756b8..6dd316ed60 100644 --- a/src/com/android/launcher3/anim/PendingAnimation.java +++ b/src/com/android/launcher3/anim/PendingAnimation.java @@ -73,9 +73,9 @@ public class PendingAnimation implements PropertySetter { addAnimationHoldersRecur(a, mDuration, springProperty, mAnimHolders); } - public void finish(boolean isSuccess, int logAction) { + public void finish(boolean isSuccess) { for (Consumer<EndState> listeners : mEndListeners) { - listeners.accept(new EndState(isSuccess, logAction)); + listeners.accept(new EndState(isSuccess)); } mEndListeners.clear(); } @@ -164,7 +164,7 @@ public class PendingAnimation implements PropertySetter { /** * Add a listener of receiving the end state. - * Note that the listeners are called as a result of calling {@link #finish(boolean, int)} + * Note that the listeners are called as a result of calling {@link #finish(boolean)} * and not automatically */ public void addEndListener(Consumer<EndState> listener) { @@ -173,11 +173,9 @@ public class PendingAnimation implements PropertySetter { public static class EndState { public boolean isSuccess; - public int logAction; - public EndState(boolean isSuccess, int logAction) { + public EndState(boolean isSuccess) { this.isSuccess = isSuccess; - this.logAction = logAction; } } } diff --git a/src/com/android/launcher3/dragndrop/AddItemActivity.java b/src/com/android/launcher3/dragndrop/AddItemActivity.java index 2d625c5373..42e247aa9b 100644 --- a/src/com/android/launcher3/dragndrop/AddItemActivity.java +++ b/src/com/android/launcher3/dragndrop/AddItemActivity.java @@ -16,10 +16,11 @@ package com.android.launcher3.dragndrop; -import static com.android.launcher3.logging.LoggerUtils.newCommandAction; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; -import static com.android.launcher3.logging.LoggerUtils.newItemTarget; -import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ADD_EXTERNAL_ITEM_BACK; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ADD_EXTERNAL_ITEM_CANCELLED; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ADD_EXTERNAL_ITEM_DRAGGED; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ADD_EXTERNAL_ITEM_START; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import android.annotation.TargetApi; @@ -49,11 +50,10 @@ import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherAppWidgetHost; import com.android.launcher3.LauncherAppWidgetProviderInfo; import com.android.launcher3.R; +import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.ItemInstallQueue; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.pm.PinRequestHelper; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.InstantAppResolver; import com.android.launcher3.views.BaseDragLayer; import com.android.launcher3.widget.PendingAddShortcutInfo; @@ -125,7 +125,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener // savedInstanceState is null when the activity is created the first time (i.e., avoids // duplicate logging during rotation) if (savedInstanceState == null) { - logCommand(Action.Command.ENTRY); + logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_START); } } @@ -178,6 +178,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener startActivity(homeIntent, ActivityOptions.makeCustomAnimation(this, 0, android.R.anim.fade_out) .toBundle()); + logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_DRAGGED); mFinishOnPause = true; return false; } @@ -240,7 +241,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener * Called when the cancel button is clicked. */ public void onCancelClick(View v) { - logCommand(Action.Command.CANCEL); + logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_CANCELLED); finish(); } @@ -250,7 +251,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener public void onPlaceAutomaticallyClick(View v) { if (mRequest.getRequestType() == PinItemRequest.REQUEST_TYPE_SHORTCUT) { ItemInstallQueue.INSTANCE.get(this).queueItem(mRequest.getShortcutInfo()); - logCommand(Action.Command.CONFIRM); + logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY); mRequest.accept(); finish(); return; @@ -274,13 +275,13 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener .queueItem(mRequest.getAppWidgetProviderInfo(this), widgetId); mWidgetOptions.putInt(AppWidgetManager.EXTRA_APPWIDGET_ID, widgetId); mRequest.accept(mWidgetOptions); - logCommand(Action.Command.CONFIRM); + logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY); finish(); } @Override public void onBackPressed() { - logCommand(Action.Command.BACK); + logCommand(LAUNCHER_ADD_EXTERNAL_ITEM_BACK); super.onBackPressed(); } @@ -320,10 +321,7 @@ public class AddItemActivity extends BaseActivity implements OnLongClickListener throw new UnsupportedOperationException(); } - private void logCommand(int command) { - getUserEventDispatcher().dispatchUserEvent(newLauncherEvent( - newCommandAction(command), - newItemTarget(mWidgetCell.getWidgetView(), mInstantAppResolver), - newContainerTarget(ContainerType.PINITEM)), null); + private void logCommand(StatsLogManager.EventEnum command) { + getStatsLogManager().logger().log(command); } } diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index ef666f0acd..1cfe6acf05 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -206,7 +206,6 @@ public class DragController implements DragDriver.EventListener, TouchController } handleMoveEvent(mLastTouch.x, mLastTouch.y); - mLauncher.getUserEventDispatcher().resetActionDurationMillis(); if (!mLauncher.isTouchInProgress() && options.simulatedDndStartPoint == null) { // If it is an internal drag and the touch is already complete, cancel immediately @@ -544,7 +543,6 @@ public class DragController implements DragDriver.EventListener, TouchController } } final View dropTargetAsView = dropTarget instanceof View ? (View) dropTarget : null; - mLauncher.getUserEventDispatcher().logDragNDrop(mDragObject, dropTargetAsView); dispatchDropComplete(dropTargetAsView, accepted); } diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 281598a48b..63fa391d43 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -23,7 +23,6 @@ import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; import static com.android.launcher3.config.FeatureFlags.ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_CONVERTED_TO_ICON; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_LABEL_UPDATED; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED; @@ -95,7 +94,6 @@ import com.android.launcher3.model.data.FolderInfo.FolderListener; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.pageindicators.PageIndicatorDots; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.Executors; import com.android.launcher3.util.Thunk; import com.android.launcher3.views.ClipPathView; @@ -599,15 +597,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo * is played. */ private void animateOpen(List<WorkspaceItemInfo> items, int pageNo) { - animateOpen(items, pageNo, false); - } - - /** - * Opens the user folder described by the specified tag. The opening of the folder - * is animated relative to the specified View. If the View is null, no animation - * is played. - */ - private void animateOpen(List<WorkspaceItemInfo> items, int pageNo, boolean skipUserEventLog) { Folder openFolder = getOpen(mLauncher); if (openFolder != null && openFolder != this) { // Close any open folder before opening a folder. @@ -657,14 +646,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo mState = STATE_OPEN; announceAccessibilityChanges(); - if (!skipUserEventLog) { - mLauncher.getUserEventDispatcher().logActionOnItem( - LauncherLogProto.Action.Touch.TAP, - LauncherLogProto.Action.Direction.NONE, - LauncherLogProto.ItemType.FOLDER_ICON, mInfo.cellX, mInfo.cellY); - } - - mContent.setFocusOnFirstChild(); } }); @@ -1513,7 +1494,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo } statsLogger.log(LAUNCHER_FOLDER_LABEL_UPDATED); - logFolderLabelState(mFromLabelState, toLabelState); mFolderName.dispatchBackKey(); } } @@ -1644,8 +1624,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo return true; } } else { - mLauncher.getUserEventDispatcher().logActionTapOutside( - newContainerTarget(LauncherLogProto.ContainerType.FOLDER)); + // TODO: add ww log if need to gather tap outside to close folder close(true); return true; } @@ -1680,17 +1659,6 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo return mContent; } - /** - * Logs current folder label info. - * - * @deprecated This method is only used for log validation and soon will be removed. - */ - @Deprecated - public void logFolderLabelState(FromState fromState, ToState toState) { - mLauncher.getUserEventDispatcher() - .logLauncherEvent(mInfo.getFolderLabelStateLauncherEvent(fromState, toState)); - } - /** Returns the height of the current folder's bottom edge from the bottom of the screen. */ private int getHeightFromBottom() { DragLayer.LayoutParams layoutParams = (DragLayer.LayoutParams) getLayoutParams(); diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java index 32d061cb42..3296eed5ca 100644 --- a/src/com/android/launcher3/folder/FolderIcon.java +++ b/src/com/android/launcher3/folder/FolderIcon.java @@ -478,7 +478,6 @@ public class FolderIcon extends FrameLayout implements FolderListener, IconLabel // event is assumed to be folder creation on the server side. .withEditText(newTitle.toString()) .log(LAUNCHER_FOLDER_AUTO_LABELED); - mFolder.logFolderLabelState(fromState, ToState.TO_SUGGESTION0); } diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java deleted file mode 100644 index cd4f034e83..0000000000 --- a/src/com/android/launcher3/logging/LoggerUtils.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2016 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.launcher3.logging; - -import android.util.ArrayMap; -import android.util.SparseArray; -import android.view.View; - -import com.android.launcher3.ButtonDropTarget; -import com.android.launcher3.LauncherSettings; -import com.android.launcher3.model.data.AppInfo; -import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogExtensions.TargetExtension; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action; -import com.android.launcher3.userevent.nano.LauncherLogProto.ItemType; -import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; -import com.android.launcher3.util.InstantAppResolver; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.ArrayList; - -/** - * Helper methods for logging. - */ -public class LoggerUtils { - private static final ArrayMap<Class, SparseArray<String>> sNameCache = new ArrayMap<>(); - private static final String UNKNOWN = "UNKNOWN"; - private static final int DEFAULT_PREDICTED_RANK = 10000; - private static final String DELIMITER_DOT = "\\."; - - public static String getFieldName(int value, Class c) { - SparseArray<String> cache; - synchronized (sNameCache) { - cache = sNameCache.get(c); - if (cache == null) { - cache = new SparseArray<>(); - for (Field f : c.getDeclaredFields()) { - if (f.getType() == int.class && Modifier.isStatic(f.getModifiers())) { - try { - f.setAccessible(true); - cache.put(f.getInt(null), f.getName()); - } catch (IllegalAccessException e) { - // Ignore - } - } - } - sNameCache.put(c, cache); - } - } - String result = cache.get(value); - return result != null ? result : UNKNOWN; - } - - public static Target newItemTarget(int itemType) { - Target t = newTarget(Target.Type.ITEM); - t.itemType = itemType; - return t; - } - - public static Target newItemTarget(View v, InstantAppResolver instantAppResolver) { - return (v != null) && (v.getTag() instanceof ItemInfo) - ? newItemTarget((ItemInfo) v.getTag(), instantAppResolver) - : newTarget(Target.Type.ITEM); - } - - public static Target newItemTarget(ItemInfo info, InstantAppResolver instantAppResolver) { - Target t = newTarget(Target.Type.ITEM); - switch (info.itemType) { - case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION: - t.itemType = (instantAppResolver != null && info instanceof AppInfo - && instantAppResolver.isInstantApp(((AppInfo) info))) - ? ItemType.WEB_APP - : ItemType.APP_ICON; - t.predictedRank = DEFAULT_PREDICTED_RANK; - break; - case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT: - t.itemType = ItemType.SHORTCUT; - t.predictedRank = DEFAULT_PREDICTED_RANK; - break; - case LauncherSettings.Favorites.ITEM_TYPE_FOLDER: - t.itemType = ItemType.FOLDER_ICON; - break; - case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET: - t.itemType = ItemType.WIDGET; - break; - case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT: - t.itemType = ItemType.DEEPSHORTCUT; - t.predictedRank = DEFAULT_PREDICTED_RANK; - break; - } - return t; - } - - public static Target newDropTarget(View v) { - if (!(v instanceof ButtonDropTarget)) { - return newTarget(Target.Type.CONTAINER); - } - if (v instanceof ButtonDropTarget) { - return ((ButtonDropTarget) v).getDropTargetForLogging(); - } - return newTarget(Target.Type.CONTROL); - } - - public static Target newTarget(int targetType, TargetExtension extension) { - Target t = new Target(); - t.type = targetType; - t.extension = extension; - return t; - } - - public static Target newTarget(int targetType) { - Target t = new Target(); - t.type = targetType; - return t; - } - - public static Target newControlTarget(int controlType) { - Target t = newTarget(Target.Type.CONTROL); - t.controlType = controlType; - return t; - } - - public static Target newContainerTarget(int containerType) { - Target t = newTarget(Target.Type.CONTAINER); - t.containerType = containerType; - return t; - } - - public static Action newAction(int type) { - Action a = new Action(); - a.type = type; - return a; - } - - public static Action newCommandAction(int command) { - Action a = newAction(Action.Type.COMMAND); - a.command = command; - return a; - } - - public static Action newTouchAction(int touch) { - Action a = newAction(Action.Type.TOUCH); - a.touch = touch; - return a; - } - - public static LauncherEvent newLauncherEvent(Action action, Target... srcTargets) { - LauncherEvent event = new LauncherEvent(); - event.srcTarget = srcTargets; - event.action = action; - return event; - } - - /** - * Creates LauncherEvent using Action and ArrayList of Targets - */ - public static LauncherEvent newLauncherEvent(Action action, ArrayList<Target> targets) { - Target[] targetsArray = new Target[targets.size()]; - targets.toArray(targetsArray); - return newLauncherEvent(action, targetsArray); - } - - /** - * String conversion for only the helpful parts of {@link Object#toString()} method - * @param stringToExtract "foo.bar.baz.MyObject@1234" - * @return "MyObject@1234" - */ - public static String extractObjectNameAndAddress(String stringToExtract) { - String[] superStringParts = stringToExtract.split(DELIMITER_DOT); - if (superStringParts.length == 0) { - return ""; - } - return superStringParts[superStringParts.length - 1]; - } -} diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index ec1c3ef779..2c5bf320ad 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -27,7 +27,6 @@ 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.model.data.ItemInfo; -import com.android.launcher3.userevent.LauncherLogProto; import com.android.launcher3.util.ResourceBasedOverride; import java.util.List; @@ -51,40 +50,22 @@ public class StatsLogManager implements ResourceBasedOverride { 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 + * Returns event enum based on the two state 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()) { + public static EventEnum getLauncherAtomEvent(int startState, + int targetState, EventEnum fallbackEvent) { + if (startState == LAUNCHER_STATE_HOME + && targetState == LAUNCHER_STATE_HOME) { return LAUNCHER_HOME_GESTURE; - } else if (startContainerType != LauncherLogProto.ContainerType.TASKSWITCHER.getNumber() - && targetContainerType == LauncherLogProto.ContainerType.TASKSWITCHER.getNumber()) { + } else if (startState != LAUNCHER_STATE_OVERVIEW + && targetState == LAUNCHER_STATE_OVERVIEW) { return LAUNCHER_OVERVIEW_GESTURE; - } else if (startContainerType != LauncherLogProto.ContainerType.ALLAPPS.getNumber() - && targetContainerType == LauncherLogProto.ContainerType.ALLAPPS.getNumber()) { + } else if (startState != LAUNCHER_STATE_ALLAPPS + && targetState == LAUNCHER_STATE_ALLAPPS) { return LAUNCHER_ALLAPPS_OPEN_UP; - } else if (startContainerType == LauncherLogProto.ContainerType.ALLAPPS.getNumber() - && targetContainerType != LauncherLogProto.ContainerType.ALLAPPS.getNumber()) { + } else if (startState == LAUNCHER_STATE_ALLAPPS + && targetState != LAUNCHER_STATE_ALLAPPS) { return LAUNCHER_ALLAPPS_CLOSE_DOWN; } return fallbackEvent; // TODO fix @@ -322,7 +303,38 @@ public class StatsLogManager implements ResourceBasedOverride { LAUNCHER_FOLDER_CONVERTED_TO_ICON(628), @UiEvent(doc = "A hotseat prediction item was pinned") - LAUNCHER_HOTSEAT_PREDICTION_PINNED(629); + LAUNCHER_HOTSEAT_PREDICTION_PINNED(629), + + @UiEvent(doc = "Activity to add external item was started") + LAUNCHER_ADD_EXTERNAL_ITEM_START(641), + + @UiEvent(doc = "Activity to add external item was cancelled") + LAUNCHER_ADD_EXTERNAL_ITEM_CANCELLED(642), + + @UiEvent(doc = "Activity to add external item was backed out") + LAUNCHER_ADD_EXTERNAL_ITEM_BACK(643), + + @UiEvent(doc = "Item was placed automatically in external item addition flow") + LAUNCHER_ADD_EXTERNAL_ITEM_PLACED_AUTOMATICALLY(644), + + @UiEvent(doc = "Item was dragged in external item addition flow") + LAUNCHER_ADD_EXTERNAL_ITEM_DRAGGED(645), + + @UiEvent(doc = "Undo event was tapped.") + LAUNCHER_UNDO(648), + + @UiEvent(doc = "Task switcher clear all target was tapped.") + LAUNCHER_TASK_CLEAR_ALL(649), + + @UiEvent(doc = "Task preview was long pressed.") + LAUNCHER_TASK_PREVIEW_LONGPRESS(650), + + @UiEvent(doc = "User swiped down on workspace (triggering noti shade to open).") + LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN(651), + + @UiEvent(doc = "Notification dismissed by swiping right.") + LAUNCHER_NOTIFICATION_DISMISSED(652), + ; // ADD MORE diff --git a/src/com/android/launcher3/logging/StatsLogUtils.java b/src/com/android/launcher3/logging/StatsLogUtils.java deleted file mode 100644 index a5cc7ea305..0000000000 --- a/src/com/android/launcher3/logging/StatsLogUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.android.launcher3.logging; - -import android.view.View; -import android.view.ViewParent; - -import androidx.annotation.Nullable; - -import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; - -import java.util.ArrayList; - -public class StatsLogUtils { - private final static int MAXIMUM_VIEW_HIERARCHY_LEVEL = 5; - - /** - * Implemented by containers to provide a container source for a given child. - */ - public interface LogContainerProvider { - - /** - * Populates parent container targets for an item - */ - void fillInLogContainerData(ItemInfo childInfo, Target child, ArrayList<Target> parents); - } - - /** - * Recursively finds the parent of the given child which implements IconLogInfoProvider - */ - public static LogContainerProvider getLaunchProviderRecursive(@Nullable View v) { - ViewParent parent; - if (v != null) { - parent = v.getParent(); - } else { - return null; - } - - // Optimization to only check up to 5 parents. - int count = MAXIMUM_VIEW_HIERARCHY_LEVEL; - while (parent != null && count-- > 0) { - if (parent instanceof LogContainerProvider) { - return (LogContainerProvider) parent; - } else { - parent = parent.getParent(); - } - } - return null; - } -} diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java deleted file mode 100644 index a40cc263db..0000000000 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * Copyright (C) 2012 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.launcher3.logging; - -import static com.android.launcher3.logging.LoggerUtils.newAction; -import static com.android.launcher3.logging.LoggerUtils.newCommandAction; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; -import static com.android.launcher3.logging.LoggerUtils.newDropTarget; -import static com.android.launcher3.logging.LoggerUtils.newItemTarget; -import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent; -import static com.android.launcher3.logging.LoggerUtils.newTarget; -import static com.android.launcher3.logging.LoggerUtils.newTouchAction; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ItemType; -import static com.android.launcher3.userevent.nano.LauncherLogProto.TipType; - -import static java.util.Optional.ofNullable; - -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.SystemClock; -import android.util.Log; -import android.view.View; - -import androidx.annotation.NonNull; -import androidx.annotation.Nullable; - -import com.android.launcher3.DropTarget; -import com.android.launcher3.R; -import com.android.launcher3.Utilities; -import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider; -import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.LauncherLogProto; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action; -import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent; -import com.android.launcher3.userevent.nano.LauncherLogProto.Target; -import com.android.launcher3.util.InstantAppResolver; -import com.android.launcher3.util.LogConfig; -import com.android.launcher3.util.ResourceBasedOverride; - -import com.google.protobuf.InvalidProtocolBufferException; -import com.google.protobuf.nano.InvalidProtocolBufferNanoException; -import com.google.protobuf.nano.MessageNano; - -import java.util.ArrayList; -import java.util.UUID; - -/** - * Manages the creation of {@link LauncherEvent}. - * To debug this class, execute following command before side loading a new apk. - * <p> - * $ adb shell setprop log.tag.UserEvent VERBOSE - */ -public class UserEventDispatcher implements ResourceBasedOverride { - - private static final String TAG = "UserEvent"; - private static final boolean IS_VERBOSE = Utilities.isPropertyEnabled(LogConfig.USEREVENT); - private static final String UUID_STORAGE = "uuid"; - - /** - * A factory method for UserEventDispatcher - */ - public static UserEventDispatcher newInstance(Context context) { - SharedPreferences sharedPrefs = Utilities.getDevicePrefs(context); - String uuidStr = sharedPrefs.getString(UUID_STORAGE, null); - if (uuidStr == null) { - uuidStr = UUID.randomUUID().toString(); - sharedPrefs.edit().putString(UUID_STORAGE, uuidStr).apply(); - } - UserEventDispatcher ued = Overrides.getObject(UserEventDispatcher.class, - context.getApplicationContext(), R.string.user_event_dispatcher_class); - ued.mUuidStr = uuidStr; - ued.mInstantAppResolver = InstantAppResolver.newInstance(context); - return ued; - } - - - /** - * Fills in the container data on the given event if the given view is not null. - * - * @return whether container data was added. - */ - private boolean fillLogContainer(@Nullable View v, Target child, - @Nullable ArrayList<Target> targets) { - LogContainerProvider firstParent = StatsLogUtils.getLaunchProviderRecursive(v); - if (v == null || !(v.getTag() instanceof ItemInfo) || firstParent == null) { - return false; - } - final ItemInfo itemInfo = (ItemInfo) v.getTag(); - firstParent.fillInLogContainerData(itemInfo, child, targets); - return true; - } - - protected void onFillInLogContainerData(@NonNull ItemInfo itemInfo, @NonNull Target target, - @NonNull ArrayList<Target> targets) { - } - - private boolean mSessionStarted; - private long mElapsedContainerMillis; - private long mElapsedSessionMillis; - private long mActionDurationMillis; - private String mUuidStr; - protected InstantAppResolver mInstantAppResolver; - private boolean mAppOrTaskLaunch; - private boolean mPreviousHomeGesture; - - private void fillComponentInfo(Target target, ComponentName cn) { - if (cn != null) { - target.packageNameHash = (mUuidStr + cn.getPackageName()).hashCode(); - target.componentHash = (mUuidStr + cn.flattenToString()).hashCode(); - } - } - - public void logActionCommand(int command, int srcContainerType, int dstContainerType) { - logActionCommand(command, newContainerTarget(srcContainerType), - dstContainerType >= 0 ? newContainerTarget(dstContainerType) : null); - } - - public void logActionCommand(int command, int srcContainerType, int dstContainerType, - int pageIndex) { - Target srcTarget = newContainerTarget(srcContainerType); - srcTarget.pageIndex = pageIndex; - logActionCommand(command, srcTarget, - dstContainerType >= 0 ? newContainerTarget(dstContainerType) : null); - } - - public void logActionCommand(int command, Target srcTarget, Target dstTarget) { - LauncherEvent event = newLauncherEvent(newCommandAction(command), srcTarget); - if (command == Action.Command.STOP) { - if (mAppOrTaskLaunch || !mSessionStarted) { - mSessionStarted = false; - return; - } - } - - if (dstTarget != null) { - event.destTarget = new Target[1]; - event.destTarget[0] = dstTarget; - event.action.isStateChange = true; - } - dispatchUserEvent(event, null); - } - - public void logActionOnControl(int action, int controlType) { - logActionOnControl(action, controlType, null); - } - - public void logActionOnControl(int action, int controlType, int parentContainerType) { - logActionOnControl(action, controlType, null, parentContainerType); - } - - /** - * Logs control action with proper parent hierarchy - */ - public void logActionOnControl(int actionType, int controlType, - @Nullable View controlInContainer, int... parentTypes) { - Target control = newTarget(Target.Type.CONTROL); - control.controlType = controlType; - Action action = newAction(actionType); - - ArrayList<Target> targets = makeTargetsList(control); - if (controlInContainer != null) { - fillLogContainer(controlInContainer, control, targets); - } - for (int parentContainerType : parentTypes) { - if (parentContainerType < 0) continue; - targets.add(newContainerTarget(parentContainerType)); - } - LauncherEvent event = newLauncherEvent(action, targets); - if (actionType == Action.Touch.DRAGDROP) { - event.actionDurationMillis = SystemClock.uptimeMillis() - mActionDurationMillis; - } - dispatchUserEvent(event, null); - } - - public void logActionTapOutside(Target target) { - LauncherEvent event = newLauncherEvent(newTouchAction(Action.Type.TOUCH), - target); - event.action.isOutside = true; - dispatchUserEvent(event, null); - } - - public void logActionBounceTip(int containerType) { - LauncherEvent event = newLauncherEvent(newAction(Action.Type.TIP), - newContainerTarget(containerType)); - event.srcTarget[0].tipType = TipType.BOUNCE; - dispatchUserEvent(event, null); - } - - public void logActionOnContainer(int action, int dir, int containerType) { - logActionOnContainer(action, dir, containerType, 0); - } - - public void logActionOnContainer(int action, int dir, int containerType, int pageIndex) { - LauncherEvent event = newLauncherEvent(newTouchAction(action), - newContainerTarget(containerType)); - event.action.dir = dir; - event.srcTarget[0].pageIndex = pageIndex; - dispatchUserEvent(event, null); - } - - /** - * Used primarily for swipe up and down when state changes when swipe up happens from the - * navbar bezel, the {@param srcChildContainerType} is NAVBAR and - * {@param srcParentContainerType} is either one of the two - * (1) WORKSPACE: if the launcher is the foreground activity - * (2) APP: if another app was the foreground activity - */ - public void logStateChangeAction(int action, int dir, int downX, int downY, - int srcChildTargetType, int srcParentContainerType, int dstContainerType, - int pageIndex) { - LauncherEvent event; - if (srcChildTargetType == ItemType.TASK) { - event = newLauncherEvent(newTouchAction(action), - newItemTarget(srcChildTargetType), - newContainerTarget(srcParentContainerType)); - } else { - event = newLauncherEvent(newTouchAction(action), - newContainerTarget(srcChildTargetType), - newContainerTarget(srcParentContainerType)); - } - event.destTarget = new Target[1]; - event.destTarget[0] = newContainerTarget(dstContainerType); - event.action.dir = dir; - event.action.isStateChange = true; - event.srcTarget[0].pageIndex = pageIndex; - event.srcTarget[0].spanX = downX; - event.srcTarget[0].spanY = downY; - dispatchUserEvent(event, null); - } - - public void logActionOnItem(int action, int dir, int itemType) { - logActionOnItem(action, dir, itemType, null, null); - } - - /** - * Creates new {@link LauncherEvent} of ITEM target type with input arguments and dispatches it. - * - * @param touchAction ENUM value of {@link LauncherLogProto.Action.Touch} Action - * @param dir ENUM value of {@link LauncherLogProto.Action.Direction} Action - * @param itemType ENUM value of {@link LauncherLogProto.ItemType} - * @param gridX Nullable X coordinate of item's position on the workspace grid - * @param gridY Nullable Y coordinate of item's position on the workspace grid - */ - public void logActionOnItem(int touchAction, int dir, int itemType, - @Nullable Integer gridX, @Nullable Integer gridY) { - Target itemTarget = newTarget(Target.Type.ITEM); - itemTarget.itemType = itemType; - ofNullable(gridX).ifPresent(value -> itemTarget.gridX = value); - ofNullable(gridY).ifPresent(value -> itemTarget.gridY = value); - LauncherEvent event = newLauncherEvent(newTouchAction(touchAction), itemTarget); - event.action.dir = dir; - dispatchUserEvent(event, null); - } - - /** - * Logs proto lite version of LauncherEvent object to clearcut. - */ - public void logLauncherEvent( - com.android.launcher3.userevent.LauncherLogProto.LauncherEvent launcherEvent) { - - if (mPreviousHomeGesture) { - mPreviousHomeGesture = false; - } - mAppOrTaskLaunch = false; - launcherEvent.toBuilder() - .setElapsedContainerMillis(SystemClock.uptimeMillis() - mElapsedContainerMillis) - .setElapsedSessionMillis( - SystemClock.uptimeMillis() - mElapsedSessionMillis).build(); - try { - dispatchUserEvent(LauncherEvent.parseFrom(launcherEvent.toByteArray()), null); - } catch (InvalidProtocolBufferNanoException e) { - throw new RuntimeException("Cannot convert LauncherEvent from Lite to Nano version."); - } - } - - public void logDeepShortcutsOpen(View icon) { - ItemInfo info = (ItemInfo) icon.getTag(); - Target child = newItemTarget(info, mInstantAppResolver); - ArrayList<Target> targets = makeTargetsList(child); - fillLogContainer(icon, child, targets); - dispatchUserEvent(newLauncherEvent(newTouchAction(Action.Touch.TAP), targets), null); - } - - public void logDragNDrop(DropTarget.DragObject dragObj, View dropTargetAsView) { - Target srcChild = newItemTarget(dragObj.originalDragInfo, mInstantAppResolver); - ArrayList<Target> srcTargets = makeTargetsList(srcChild); - - - Target destChild = newItemTarget(dragObj.originalDragInfo, mInstantAppResolver); - ArrayList<Target> destTargets = makeTargetsList(destChild); - - //dragObj.dragSource.fillInLogContainerData(dragObj.originalDragInfo, srcChild, srcTargets); - if (dropTargetAsView instanceof LogContainerProvider) { - ((LogContainerProvider) dropTargetAsView).fillInLogContainerData(dragObj.dragInfo, - destChild, destTargets); - } - else { - destTargets.add(newDropTarget(dropTargetAsView)); - } - LauncherEvent event = newLauncherEvent(newTouchAction(Action.Touch.DRAGDROP), srcTargets); - Target[] destTargetsArray = new Target[destTargets.size()]; - destTargets.toArray(destTargetsArray); - event.destTarget = destTargetsArray; - - event.actionDurationMillis = SystemClock.uptimeMillis() - mActionDurationMillis; - dispatchUserEvent(event, null); - } - - public final void startSession() { - mSessionStarted = true; - mElapsedSessionMillis = SystemClock.uptimeMillis(); - mElapsedContainerMillis = SystemClock.uptimeMillis(); - } - - public final void setPreviousHomeGesture(boolean homeGesture) { - mPreviousHomeGesture = homeGesture; - } - - public final boolean isPreviousHomeGesture() { - return mPreviousHomeGesture; - } - - public final void resetActionDurationMillis() { - mActionDurationMillis = SystemClock.uptimeMillis(); - } - - public void dispatchUserEvent(LauncherEvent ev, Intent intent) { - if (mPreviousHomeGesture) { - mPreviousHomeGesture = false; - } - mAppOrTaskLaunch = false; - ev.elapsedContainerMillis = SystemClock.uptimeMillis() - mElapsedContainerMillis; - ev.elapsedSessionMillis = SystemClock.uptimeMillis() - mElapsedSessionMillis; - if (!IS_VERBOSE) { - return; - } - LauncherLogProto.LauncherEvent liteLauncherEvent; - try { - liteLauncherEvent = - LauncherLogProto.LauncherEvent.parseFrom(MessageNano.toByteArray(ev)); - } catch (InvalidProtocolBufferException e) { - throw new RuntimeException("Cannot parse LauncherEvent from Nano to Lite version"); - } - Log.d(TAG, liteLauncherEvent.toString()); - } - - /** - * Constructs an ArrayList with targets - */ - public static ArrayList<Target> makeTargetsList(Target... targets) { - ArrayList<Target> result = new ArrayList<>(); - for (Target target : targets) { - result.add(target); - } - return result; - } -} diff --git a/src/com/android/launcher3/model/data/FolderInfo.java b/src/com/android/launcher3/model/data/FolderInfo.java index 41ccbd7054..06a2c92dab 100644 --- a/src/com/android/launcher3/model/data/FolderInfo.java +++ b/src/com/android/launcher3/model/data/FolderInfo.java @@ -20,15 +20,9 @@ import static android.text.TextUtils.isEmpty; import static androidx.core.util.Preconditions.checkNotNull; -import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; -import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; import static com.android.launcher3.logger.LauncherAtom.Attribute.EMPTY_LABEL; import static com.android.launcher3.logger.LauncherAtom.Attribute.MANUAL_LABEL; import static com.android.launcher3.logger.LauncherAtom.Attribute.SUGGESTED_LABEL; -import static com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState.FROM_CUSTOM; -import static com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState.FROM_EMPTY; -import static com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState.FROM_FOLDER_LABEL_STATE_UNSPECIFIED; -import static com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState.FROM_SUGGESTED; import android.os.Process; @@ -43,10 +37,6 @@ import com.android.launcher3.logger.LauncherAtom.Attribute; import com.android.launcher3.logger.LauncherAtom.FromState; import com.android.launcher3.logger.LauncherAtom.ToState; import com.android.launcher3.model.ModelWriter; -import com.android.launcher3.userevent.LauncherLogProto; -import com.android.launcher3.userevent.LauncherLogProto.Target; -import com.android.launcher3.userevent.LauncherLogProto.Target.FromFolderLabelState; -import com.android.launcher3.userevent.LauncherLogProto.Target.ToFolderLabelState; import com.android.launcher3.util.ContentWriter; import java.util.ArrayList; @@ -359,113 +349,4 @@ public class FolderInfo extends ItemInfo { } return LauncherAtom.ToState.TO_STATE_UNSPECIFIED; } - - /** - * Returns {@link LauncherLogProto.LauncherEvent} to log current folder label info. - * - * @deprecated This method is used only for validation purpose and soon will be removed. - */ - @Deprecated - public LauncherLogProto.LauncherEvent getFolderLabelStateLauncherEvent(FromState fromState, - ToState toState) { - return LauncherLogProto.LauncherEvent.newBuilder() - .setAction(LauncherLogProto.Action - .newBuilder() - .setType(LauncherLogProto.Action.Type.SOFT_KEYBOARD)) - .addSrcTarget(Target - .newBuilder() - .setType(Target.Type.ITEM) - .setItemType(LauncherLogProto.ItemType.EDITTEXT) - .setFromFolderLabelState(convertFolderLabelState(fromState)) - .setToFolderLabelState(convertFolderLabelState(toState))) - .addSrcTarget(Target.newBuilder() - .setType(Target.Type.CONTAINER) - .setContainerType(LauncherLogProto.ContainerType.FOLDER) - .setPageIndex(screenId) - .setGridX(cellX) - .setGridY(cellY) - .setCardinality(contents.size())) - .addSrcTarget(newParentContainerTarget()) - .build(); - } - - /** - * @deprecated This method is used only for validation purpose and soon will be removed. - */ - @Deprecated - private Target.Builder newParentContainerTarget() { - Target.Builder builder = Target.newBuilder().setType(Target.Type.CONTAINER); - switch (container) { - case CONTAINER_HOTSEAT: - return builder.setContainerType(LauncherLogProto.ContainerType.HOTSEAT); - case CONTAINER_DESKTOP: - return builder.setContainerType(LauncherLogProto.ContainerType.WORKSPACE); - default: - throw new AssertionError(String - .format("Expected container to be either %s or %s but found %s.", - CONTAINER_HOTSEAT, - CONTAINER_DESKTOP, - container)); - } - } - - /** - * @deprecated This method is used only for validation purpose and soon will be removed. - */ - @Deprecated - private static FromFolderLabelState convertFolderLabelState(FromState fromState) { - switch (fromState) { - case FROM_EMPTY: - return FROM_EMPTY; - case FROM_SUGGESTED: - return FROM_SUGGESTED; - case FROM_CUSTOM: - return FROM_CUSTOM; - default: - return FROM_FOLDER_LABEL_STATE_UNSPECIFIED; - } - } - - /** - * @deprecated This method is used only for validation purpose and soon will be removed. - */ - @Deprecated - private static ToFolderLabelState convertFolderLabelState(ToState toState) { - switch (toState) { - case UNCHANGED: - return ToFolderLabelState.UNCHANGED; - case TO_SUGGESTION0: - return ToFolderLabelState.TO_SUGGESTION0_WITH_VALID_PRIMARY; - case TO_SUGGESTION1_WITH_VALID_PRIMARY: - return ToFolderLabelState.TO_SUGGESTION1_WITH_VALID_PRIMARY; - case TO_SUGGESTION1_WITH_EMPTY_PRIMARY: - return ToFolderLabelState.TO_SUGGESTION1_WITH_EMPTY_PRIMARY; - case TO_SUGGESTION2_WITH_VALID_PRIMARY: - return ToFolderLabelState.TO_SUGGESTION2_WITH_VALID_PRIMARY; - case TO_SUGGESTION2_WITH_EMPTY_PRIMARY: - return ToFolderLabelState.TO_SUGGESTION2_WITH_EMPTY_PRIMARY; - case TO_SUGGESTION3_WITH_VALID_PRIMARY: - return ToFolderLabelState.TO_SUGGESTION3_WITH_VALID_PRIMARY; - case TO_SUGGESTION3_WITH_EMPTY_PRIMARY: - return ToFolderLabelState.TO_SUGGESTION3_WITH_EMPTY_PRIMARY; - case TO_EMPTY_WITH_VALID_PRIMARY: - return ToFolderLabelState.TO_EMPTY_WITH_VALID_PRIMARY; - case TO_EMPTY_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY: - return ToFolderLabelState.TO_EMPTY_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY; - case TO_EMPTY_WITH_EMPTY_SUGGESTIONS: - return ToFolderLabelState.TO_EMPTY_WITH_EMPTY_SUGGESTIONS; - case TO_EMPTY_WITH_SUGGESTIONS_DISABLED: - return ToFolderLabelState.TO_EMPTY_WITH_SUGGESTIONS_DISABLED; - case TO_CUSTOM_WITH_VALID_PRIMARY: - return ToFolderLabelState.TO_CUSTOM_WITH_VALID_PRIMARY; - case TO_CUSTOM_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY: - return ToFolderLabelState.TO_CUSTOM_WITH_VALID_SUGGESTIONS_AND_EMPTY_PRIMARY; - case TO_CUSTOM_WITH_EMPTY_SUGGESTIONS: - return ToFolderLabelState.TO_CUSTOM_WITH_EMPTY_SUGGESTIONS; - case TO_CUSTOM_WITH_SUGGESTIONS_DISABLED: - return ToFolderLabelState.TO_CUSTOM_WITH_SUGGESTIONS_DISABLED; - default: - return ToFolderLabelState.TO_FOLDER_LABEL_STATE_UNSPECIFIED; - } - } } diff --git a/src/com/android/launcher3/notification/NotificationMainView.java b/src/com/android/launcher3/notification/NotificationMainView.java index 32f060ba85..9b065233b9 100644 --- a/src/com/android/launcher3/notification/NotificationMainView.java +++ b/src/com/android/launcher3/notification/NotificationMainView.java @@ -17,6 +17,7 @@ package com.android.launcher3.notification; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_NOTIFICATION_DISMISSED; import android.animation.Animator; import android.animation.ObjectAnimator; @@ -41,7 +42,6 @@ import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.touch.BaseSwipeDetector; import com.android.launcher3.touch.OverScroll; import com.android.launcher3.touch.SingleAxisSwipeDetector; -import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.Themes; /** @@ -168,10 +168,7 @@ public class NotificationMainView extends FrameLayout implements SingleAxisSwipe Launcher launcher = Launcher.getLauncher(getContext()); launcher.getPopupDataProvider().cancelNotification( mNotificationInfo.notificationKey); - launcher.getUserEventDispatcher().logActionOnItem( - LauncherLogProto.Action.Touch.SWIPE, - LauncherLogProto.Action.Direction.RIGHT, // Assume all swipes are right for logging. - LauncherLogProto.ItemType.NOTIFICATION); + launcher.getStatsLogManager().logger().log(LAUNCHER_NOTIFICATION_DISMISSED); } // SingleAxisSwipeDetector.Listener's diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index 26b32b8195..6d92b8b627 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -19,10 +19,8 @@ package com.android.launcher3.popup; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS; import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.Utilities.squaredTouchSlop; -import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; import static com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS; import static com.android.launcher3.popup.PopupPopulator.MAX_SHORTCUTS_IF_NOTIFICATIONS; -import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import static com.android.launcher3.util.Executors.MODEL_EXECUTOR; import android.animation.AnimatorSet; @@ -160,8 +158,7 @@ public class PopupContainerWithArrow<T extends BaseDraggingActivity> extends Arr if (ev.getAction() == MotionEvent.ACTION_DOWN) { BaseDragLayer dl = getPopupContainer(); if (!dl.isEventOverView(this, ev)) { - mLauncher.getUserEventDispatcher().logActionTapOutside( - newContainerTarget(ContainerType.DEEPSHORTCUTS)); + // TODO: add WW log if want to log if tap closed deep shortcut container. close(true); // We let touches on the original icon go through so that users can launch @@ -435,7 +432,9 @@ public class PopupContainerWithArrow<T extends BaseDraggingActivity> extends Arr // Make sure we keep the original icon hidden while it is being dragged. mOriginalIcon.setVisibility(INVISIBLE); } else { - mLauncher.getUserEventDispatcher().logDeepShortcutsOpen(mOriginalIcon); + // TODO: add WW logging if want to add logging for long press on popup + // container. + // mLauncher.getUserEventDispatcher().logDeepShortcutsOpen(mOriginalIcon); if (!mIsAboveIcon) { // Show the icon but keep the text hidden. mOriginalIcon.setVisibility(VISIBLE); diff --git a/src/com/android/launcher3/popup/RemoteActionShortcut.java b/src/com/android/launcher3/popup/RemoteActionShortcut.java index 61829c002b..7c393ad1e2 100644 --- a/src/com/android/launcher3/popup/RemoteActionShortcut.java +++ b/src/com/android/launcher3/popup/RemoteActionShortcut.java @@ -37,7 +37,6 @@ import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.R; import com.android.launcher3.Utilities; import com.android.launcher3.model.data.ItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto; @TargetApi(Build.VERSION_CODES.Q) public class RemoteActionShortcut extends SystemShortcut<BaseDraggingActivity> { @@ -107,9 +106,6 @@ public class RemoteActionShortcut extends SystemShortcut<BaseDraggingActivity> { Toast.LENGTH_SHORT) .show(); } - - mTarget.getUserEventDispatcher().logActionOnControl(LauncherLogProto.Action.Touch.TAP, - LauncherLogProto.ControlType.REMOTE_ACTION_SHORTCUT, view); } @Override diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index 81302ac1f7..577fe4afaa 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -21,8 +21,6 @@ import com.android.launcher3.R; import com.android.launcher3.model.WidgetItem; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action; -import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; import com.android.launcher3.util.InstantAppResolver; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.PackageUserKey; @@ -117,8 +115,6 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite (WidgetsBottomSheet) mTarget.getLayoutInflater().inflate( R.layout.widgets_bottom_sheet, mTarget.getDragLayer(), false); widgetsBottomSheet.populateAndShow(mItemInfo); - mTarget.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP, - ControlType.WIDGETS_BUTTON, view); mTarget.getStatsLogManager().logger().withItemInfo(mItemInfo) .log(LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP); } @@ -139,8 +135,6 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite Rect sourceBounds = mTarget.getViewBounds(view); new PackageManagerHelper(mTarget).startDetailsActivityForInfo( mItemInfo, sourceBounds, ActivityOptions.makeBasic().toBundle()); - mTarget.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP, - ControlType.APPINFO_TARGET, view); mTarget.getStatsLogManager().logger().withItemInfo(mItemInfo) .log(LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP); } diff --git a/src/com/android/launcher3/states/HintState.java b/src/com/android/launcher3/states/HintState.java index b8a184fcfc..fd1d965982 100644 --- a/src/com/android/launcher3/states/HintState.java +++ b/src/com/android/launcher3/states/HintState.java @@ -15,11 +15,12 @@ */ package com.android.launcher3.states; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; + import android.content.Context; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; /** * Scale down workspace/hotseat to hint at going to either overview (on pause) or first home screen. @@ -30,7 +31,7 @@ public class HintState extends LauncherState { | FLAG_HAS_SYS_UI_SCRIM; public HintState(int id) { - super(id, ContainerType.DEFAULT_CONTAINERTYPE, STATE_FLAGS); + super(id, LAUNCHER_STATE_HOME, STATE_FLAGS); } @Override diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java index 2a4f887503..45172b56ef 100644 --- a/src/com/android/launcher3/states/SpringLoadedState.java +++ b/src/com/android/launcher3/states/SpringLoadedState.java @@ -15,6 +15,8 @@ */ package com.android.launcher3.states; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; + import android.content.Context; import android.graphics.Rect; @@ -22,7 +24,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.Workspace; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; /** * Definition for spring loaded state used during drag and drop. @@ -35,7 +36,7 @@ public class SpringLoadedState extends LauncherState { | FLAG_HIDE_BACK_BUTTON; public SpringLoadedState(int id) { - super(id, ContainerType.WORKSPACE, STATE_FLAGS); + super(id, LAUNCHER_STATE_HOME, STATE_FLAGS); } @Override diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 8ee5a6e533..9fd53e2563 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -21,6 +21,9 @@ import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity; import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEDOWN; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_UNKNOWN_SWIPEUP; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_COMPONENTS; @@ -52,9 +55,6 @@ import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.states.StateAnimationConfig; import com.android.launcher3.states.StateAnimationConfig.AnimationFlags; import com.android.launcher3.testing.TestProtocol; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; -import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.FlingBlockCheck; import com.android.launcher3.util.TouchController; @@ -190,11 +190,6 @@ public abstract class AbstractStateChangeTouchController protected abstract float initCurrentAnimation(@AnimationFlags int animComponents); - /** - * Returns the container that the touch started from when leaving NORMAL state. - */ - protected abstract int getLogContainerTypeForNormalState(MotionEvent ev); - private boolean reinitCurrentAnimation(boolean reachedToState, boolean isDragTowardPositive) { LauncherState newFromState = mFromState == null ? mLauncher.getStateManager().getState() : reachedToState ? mToState : mFromState; @@ -307,11 +302,11 @@ public abstract class AbstractStateChangeTouchController public boolean onDrag(float displacement, MotionEvent ev) { if (!mIsLogContainerSet) { if (mStartState == ALL_APPS) { - mStartContainerType = ContainerType.ALLAPPS; + mStartContainerType = LAUNCHER_STATE_ALLAPPS; } else if (mStartState == NORMAL) { - mStartContainerType = getLogContainerTypeForNormalState(ev); + mStartContainerType = LAUNCHER_STATE_HOME; } else if (mStartState == OVERVIEW) { - mStartContainerType = ContainerType.TASKSWITCHER; + mStartContainerType = LAUNCHER_STATE_OVERVIEW; } mIsLogContainerSet = true; } @@ -401,7 +396,6 @@ public abstract class AbstractStateChangeTouchController @Override public void onDragEnd(float velocity) { boolean fling = mDetector.isFling(velocity); - final int logAction = fling ? Touch.FLING : Touch.SWIPE; boolean blockedFling = fling && mFlingBlockCheck.isBlocked(); if (blockedFling) { @@ -458,7 +452,7 @@ public abstract class AbstractStateChangeTouchController } } - mCurrentAnimation.setEndAction(() -> onSwipeInteractionCompleted(targetState, logAction)); + mCurrentAnimation.setEndAction(() -> onSwipeInteractionCompleted(targetState)); ValueAnimator anim = mCurrentAnimation.getAnimationPlayer(); anim.setFloatValues(startProgress, endProgress); maybeUpdateAtomicAnim(mFromState, targetState, targetState == mToState ? 1f : 0f); @@ -522,11 +516,7 @@ public abstract class AbstractStateChangeTouchController .setInterpolator(scrollInterpolatorForVelocity(velocity)); } - protected int getDirectionForLog() { - return mToState.ordinal > mFromState.ordinal ? Direction.UP : Direction.DOWN; - } - - protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) { + protected void onSwipeInteractionCompleted(LauncherState targetState) { if (mAtomicComponentsController != null) { mAtomicComponentsController.getAnimationPlayer().end(); mAtomicComponentsController = null; @@ -535,18 +525,18 @@ public abstract class AbstractStateChangeTouchController boolean shouldGoToTargetState = true; if (mPendingAnimation != null) { boolean reachedTarget = mToState == targetState; - mPendingAnimation.finish(reachedTarget, logAction); + mPendingAnimation.finish(reachedTarget); mPendingAnimation = null; shouldGoToTargetState = !reachedTarget; } if (shouldGoToTargetState) { - goToTargetState(targetState, logAction); + goToTargetState(targetState); } } - protected void goToTargetState(LauncherState targetState, int logAction) { + protected void goToTargetState(LauncherState targetState) { if (targetState != mStartState) { - logReachedState(logAction, targetState); + logReachedState(targetState); } if (!mLauncher.isInState(targetState)) { // If we're already in the target state, don't jump to it at the end of the animation in @@ -556,24 +546,18 @@ public abstract class AbstractStateChangeTouchController mLauncher.getDragLayer().getScrim().createSysuiMultiplierAnim(1f).setDuration(0).start(); } - private void logReachedState(int logAction, LauncherState targetState) { + private void logReachedState(LauncherState targetState) { // Transition complete. log the action - mLauncher.getUserEventDispatcher().logStateChangeAction(logAction, - getDirectionForLog(), mDetector.getDownX(), mDetector.getDownY(), - mStartContainerType /* e.g., hotseat */, - mStartState.containerType /* e.g., workspace */, - targetState.containerType, - mLauncher.getWorkspace().getCurrentPage()); mLauncher.getStatsLogManager().logger() - .withSrcState(StatsLogManager.containerTypeToAtomState(mStartState.containerType)) - .withDstState(StatsLogManager.containerTypeToAtomState(targetState.containerType)) + .withSrcState(mStartState.statsLogOrdinal) + .withDstState(targetState.statsLogOrdinal) .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() .setWorkspace( LauncherAtom.WorkspaceContainer.newBuilder() .setPageIndex(mLauncher.getWorkspace().getCurrentPage())) .build()) - .log(StatsLogManager.getLauncherAtomEvent(mStartState.containerType, - targetState.containerType, mToState.ordinal > mFromState.ordinal + .log(StatsLogManager.getLauncherAtomEvent(mStartState.statsLogOrdinal, + targetState.statsLogOrdinal, mToState.ordinal > mFromState.ordinal ? LAUNCHER_UNKNOWN_SWIPEUP : LAUNCHER_UNKNOWN_SWIPEDOWN)); } diff --git a/src/com/android/launcher3/touch/AllAppsSwipeController.java b/src/com/android/launcher3/touch/AllAppsSwipeController.java index 4a202b65d8..f9dcf2d2e9 100644 --- a/src/com/android/launcher3/touch/AllAppsSwipeController.java +++ b/src/com/android/launcher3/touch/AllAppsSwipeController.java @@ -24,7 +24,6 @@ import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.states.StateAnimationConfig.AnimationFlags; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; /** * TouchController to switch between NORMAL and ALL_APPS state. @@ -70,12 +69,6 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController { } @Override - protected int getLogContainerTypeForNormalState(MotionEvent ev) { - return mLauncher.getDragLayer().isEventOverView(mLauncher.getHotseat(), mTouchDownEvent) - ? ContainerType.HOTSEAT : ContainerType.WORKSPACE; - } - - @Override protected float initCurrentAnimation(@AnimationFlags int animComponents) { float range = getShiftRange(); long maxAccuracy = (long) (2 * range); diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java index ec3f93ff1b..a4e53a1cc0 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java @@ -16,13 +16,13 @@ package com.android.launcher3.uioverrides.states; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS; import android.content.Context; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.R; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; /** * Definition for AllApps state @@ -41,7 +41,7 @@ public class AllAppsState extends LauncherState { }; public AllAppsState(int id) { - super(id, ContainerType.ALLAPPS, STATE_FLAGS); + super(id, LAUNCHER_STATE_ALLAPPS, STATE_FLAGS); } @Override diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java index d102bccaad..da5a94f6fd 100644 --- a/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/OverviewState.java @@ -15,10 +15,11 @@ */ package com.android.launcher3.uioverrides.states; +import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW; + import android.content.Context; import com.android.launcher3.LauncherState; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; /** * Definition for overview state @@ -26,7 +27,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; public class OverviewState extends LauncherState { public OverviewState(int id) { - super(id, ContainerType.WORKSPACE, FLAG_DISABLE_RESTORE); + super(id, LAUNCHER_STATE_OVERVIEW, FLAG_DISABLE_RESTORE); } @Override |