2018-10-25 14:09:50 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2018 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.content.Context;
|
2019-12-10 13:23:51 -08:00
|
|
|
|
2020-05-18 09:33:37 -07:00
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
|
2020-06-03 17:25:09 -07:00
|
|
|
import com.android.launcher3.LauncherState;
|
2018-10-25 14:09:50 -07:00
|
|
|
import com.android.launcher3.R;
|
2020-06-12 15:40:24 -07:00
|
|
|
import com.android.launcher3.logger.LauncherAtom;
|
2019-12-10 13:23:51 -08:00
|
|
|
import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
|
2020-06-10 00:35:35 -07:00
|
|
|
import com.android.launcher3.model.data.ItemInfo;
|
2018-10-25 14:09:50 -07:00
|
|
|
import com.android.launcher3.util.ResourceBasedOverride;
|
|
|
|
|
|
|
|
|
|
/**
|
2020-03-26 01:48:24 -07:00
|
|
|
* Handles the user event logging in R+.
|
2020-05-11 11:19:58 -07:00
|
|
|
* All of the event ids are defined here.
|
2020-04-27 01:12:01 -07:00
|
|
|
* Most of the methods are dummy methods for Launcher3
|
|
|
|
|
* Actual call happens only for Launcher variant that implements QuickStep.
|
2018-10-25 14:09:50 -07:00
|
|
|
*/
|
2018-11-14 15:11:48 -08:00
|
|
|
public class StatsLogManager implements ResourceBasedOverride {
|
2018-10-25 14:09:50 -07:00
|
|
|
|
2020-05-28 23:36:14 -07:00
|
|
|
public interface EventEnum {
|
2020-04-15 16:52:19 +00:00
|
|
|
int getId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public enum LauncherEvent implements EventEnum {
|
2020-06-06 14:44:27 -07:00
|
|
|
/* Used to prevent double logging. */
|
|
|
|
|
IGNORE(-1),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "App launched from workspace, hotseat or folder in launcher")
|
2020-04-27 01:12:01 -07:00
|
|
|
LAUNCHER_APP_LAUNCH_TAP(338),
|
2020-05-11 11:19:58 -07:00
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "Task launched from overview using TAP")
|
2020-04-27 01:12:01 -07:00
|
|
|
LAUNCHER_TASK_LAUNCH_TAP(339),
|
2020-05-11 11:19:58 -07:00
|
|
|
|
2020-06-01 17:17:24 -07:00
|
|
|
@UiEvent(doc = "User tapped on notification inside popup context menu.")
|
|
|
|
|
LAUNCHER_NOTIFICATION_LAUNCH_TAP(516),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "Task launched from overview using SWIPE DOWN")
|
2020-04-27 01:12:01 -07:00
|
|
|
LAUNCHER_TASK_LAUNCH_SWIPE_DOWN(340),
|
2020-05-11 11:19:58 -07:00
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "TASK dismissed from overview using SWIPE UP")
|
2020-04-27 01:12:01 -07:00
|
|
|
LAUNCHER_TASK_DISMISS_SWIPE_UP(341),
|
2020-05-11 11:19:58 -07:00
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "User dragged a launcher item")
|
2020-05-01 13:54:53 -07:00
|
|
|
LAUNCHER_ITEM_DRAG_STARTED(383),
|
2020-05-11 11:19:58 -07:00
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "A dragged launcher item is successfully dropped")
|
2020-05-04 17:49:37 -07:00
|
|
|
LAUNCHER_ITEM_DROP_COMPLETED(385),
|
2020-05-11 11:19:58 -07:00
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "A dragged launcher item is successfully dropped on another item "
|
2020-05-11 11:19:58 -07:00
|
|
|
+ "resulting in a new folder creation")
|
|
|
|
|
LAUNCHER_ITEM_DROP_FOLDER_CREATED(386),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "User action resulted in or manually updated the folder label to "
|
2020-05-08 17:53:19 -07:00
|
|
|
+ "new/same value.")
|
|
|
|
|
LAUNCHER_FOLDER_LABEL_UPDATED(460),
|
2020-05-08 11:04:32 -07:00
|
|
|
|
2020-05-28 23:36:14 -07:00
|
|
|
@UiEvent(doc = "User long pressed on the workspace empty space.")
|
|
|
|
|
LAUNCHER_WORKSPACE_LONGPRESS(461),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User tapped or long pressed on a wallpaper icon inside launcher settings.")
|
|
|
|
|
LAUNCHER_WALLPAPER_BUTTON_TAP_OR_LONGPRESS(462),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User tapped or long pressed on settings icon inside launcher settings.")
|
|
|
|
|
LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS(463),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User tapped or long pressed on widget tray icon inside launcher settings.")
|
|
|
|
|
LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS(464),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "A dragged item is dropped on 'Remove' button in the target bar")
|
2020-05-11 11:19:58 -07:00
|
|
|
LAUNCHER_ITEM_DROPPED_ON_REMOVE(465),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "A dragged item is dropped on 'Cancel' button in the target bar")
|
2020-05-11 11:19:58 -07:00
|
|
|
LAUNCHER_ITEM_DROPPED_ON_CANCEL(466),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "A predicted item is dragged and dropped on 'Don't suggest app'"
|
2020-05-11 11:19:58 -07:00
|
|
|
+ " button in the target bar")
|
|
|
|
|
LAUNCHER_ITEM_DROPPED_ON_DONT_SUGGEST(467),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "A dragged item is dropped on 'Uninstall' button in target bar")
|
2020-05-11 11:19:58 -07:00
|
|
|
LAUNCHER_ITEM_DROPPED_ON_UNINSTALL(468),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "User completed uninstalling the package after dropping on "
|
2020-05-11 11:19:58 -07:00
|
|
|
+ "the icon onto 'Uninstall' button in the target bar")
|
|
|
|
|
LAUNCHER_ITEM_UNINSTALL_COMPLETED(469),
|
|
|
|
|
|
2020-05-15 10:30:31 -07:00
|
|
|
@UiEvent(doc = "User cancelled uninstalling the package after dropping on "
|
2020-05-11 11:19:58 -07:00
|
|
|
+ "the icon onto 'Uninstall' button in the target bar")
|
2020-06-01 14:05:13 -07:00
|
|
|
LAUNCHER_ITEM_UNINSTALL_CANCELLED(470),
|
|
|
|
|
|
2020-06-02 15:40:25 -07:00
|
|
|
@UiEvent(doc = "User tapped or long pressed on the task icon(aka package icon) "
|
|
|
|
|
+ "from overview to open task menu.")
|
|
|
|
|
LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(517),
|
|
|
|
|
|
2020-06-01 14:05:13 -07:00
|
|
|
@UiEvent(doc = "User opened package specific widgets list by tapping on widgets system "
|
2020-06-01 17:17:24 -07:00
|
|
|
+ "shortcut inside popup context menu.")
|
2020-06-01 14:05:13 -07:00
|
|
|
LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP(514),
|
|
|
|
|
|
2020-06-03 11:13:02 -07:00
|
|
|
@UiEvent(doc = "User tapped on app info system shortcut.")
|
2020-06-02 11:32:51 -07:00
|
|
|
LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP(515),
|
|
|
|
|
|
2020-06-02 15:40:25 -07:00
|
|
|
@UiEvent(doc = "User tapped on split screen icon on a task menu.")
|
|
|
|
|
LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP(518),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User tapped on free form icon on a task menu.")
|
2020-06-03 11:13:02 -07:00
|
|
|
LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP(519),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User tapped on pause app system shortcut.")
|
2020-06-04 16:22:45 -07:00
|
|
|
LAUNCHER_SYSTEM_SHORTCUT_PAUSE_TAP(521),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User tapped on pin system shortcut.")
|
2020-06-07 15:41:41 -07:00
|
|
|
LAUNCHER_SYSTEM_SHORTCUT_PIN_TAP(522),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User is shown All Apps education view.")
|
2020-06-09 14:24:49 -07:00
|
|
|
LAUNCHER_ALL_APPS_EDU_SHOWN(523),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "User opened a folder.")
|
2020-06-09 18:10:31 -07:00
|
|
|
LAUNCHER_FOLDER_OPEN(551),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "Hotseat education half sheet seen")
|
|
|
|
|
LAUNCHER_HOTSEAT_EDU_SEEN(479),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "Hotseat migration accepted")
|
|
|
|
|
LAUNCHER_HOTSEAT_EDU_ACCEPT(480),
|
2020-03-26 01:48:24 -07:00
|
|
|
|
2020-06-09 18:10:31 -07:00
|
|
|
@UiEvent(doc = "Hotseat migration denied")
|
|
|
|
|
LAUNCHER_HOTSEAT_EDU_DENY(481),
|
|
|
|
|
|
|
|
|
|
@UiEvent(doc = "Hotseat education tip shown")
|
|
|
|
|
LAUNCHER_HOTSEAT_EDU_ONLY_TIP(482);
|
|
|
|
|
// ADD MORE
|
2020-03-26 01:48:24 -07:00
|
|
|
private final int mId;
|
2020-05-12 14:41:03 -07:00
|
|
|
|
2020-03-26 01:48:24 -07:00
|
|
|
LauncherEvent(int id) {
|
|
|
|
|
mId = id;
|
|
|
|
|
}
|
2020-05-12 14:41:03 -07:00
|
|
|
|
2020-03-26 01:48:24 -07:00
|
|
|
public int getId() {
|
|
|
|
|
return mId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-09 17:24:29 -07:00
|
|
|
/**
|
|
|
|
|
* Launcher specific ranking related events.
|
|
|
|
|
*/
|
|
|
|
|
public enum LauncherRankingEvent implements EventEnum {
|
|
|
|
|
|
|
|
|
|
UNKNOWN(0);
|
|
|
|
|
// ADD MORE
|
|
|
|
|
|
|
|
|
|
private final int mId;
|
|
|
|
|
|
|
|
|
|
LauncherRankingEvent(int id) {
|
|
|
|
|
mId = id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getId() {
|
|
|
|
|
return mId;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-25 14:09:50 -07:00
|
|
|
protected LogStateProvider mStateProvider;
|
2020-03-26 01:48:24 -07:00
|
|
|
|
2020-04-15 10:22:28 -07:00
|
|
|
/**
|
|
|
|
|
* Creates a new instance of {@link StatsLogManager} based on provided context.
|
|
|
|
|
*/
|
|
|
|
|
public static StatsLogManager newInstance(Context context) {
|
|
|
|
|
return newInstance(context, null);
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-25 14:09:50 -07:00
|
|
|
public static StatsLogManager newInstance(Context context, LogStateProvider stateProvider) {
|
|
|
|
|
StatsLogManager mgr = Overrides.getObject(StatsLogManager.class,
|
|
|
|
|
context.getApplicationContext(), R.string.stats_log_manager_class);
|
|
|
|
|
mgr.mStateProvider = stateProvider;
|
|
|
|
|
return mgr;
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-11 11:19:58 -07:00
|
|
|
/**
|
2020-06-10 00:35:35 -07:00
|
|
|
* Logs an event.
|
|
|
|
|
*
|
|
|
|
|
* @param event an enum implementing EventEnum interface.
|
2020-05-12 14:41:03 -07:00
|
|
|
*/
|
2020-05-28 23:36:14 -07:00
|
|
|
public void log(EventEnum event) {
|
2020-05-12 14:41:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2020-06-10 00:35:35 -07:00
|
|
|
* Logs an event.
|
|
|
|
|
*
|
|
|
|
|
* @param event an enum implementing EventEnum interface.
|
|
|
|
|
* @param instanceId an identifier obtained from an InstanceIdSequence.
|
2020-05-11 11:19:58 -07:00
|
|
|
*/
|
2020-05-28 23:36:14 -07:00
|
|
|
public void log(EventEnum event, InstanceId instanceId) {
|
2020-05-11 11:19:58 -07:00
|
|
|
}
|
|
|
|
|
|
2019-12-10 13:23:51 -08:00
|
|
|
/**
|
2020-06-10 00:35:35 -07:00
|
|
|
* Logs an event.
|
|
|
|
|
*
|
|
|
|
|
* @param event an enum implementing EventEnum interface.
|
|
|
|
|
* @param itemInfo item typically containing app or task launch related information.
|
2019-12-10 13:23:51 -08:00
|
|
|
*/
|
2020-05-28 23:36:14 -07:00
|
|
|
public void log(EventEnum event, @Nullable ItemInfo itemInfo) {
|
2020-05-12 14:41:03 -07:00
|
|
|
}
|
2020-03-26 01:48:24 -07:00
|
|
|
|
2020-06-12 15:40:24 -07:00
|
|
|
/**
|
|
|
|
|
* Logs an event and accompanying {@link LauncherState}s.
|
|
|
|
|
*
|
|
|
|
|
* @param event an enum implementing EventEnum interface.
|
|
|
|
|
* @param launcherAtomItemInfo item typically containing app or task launch related information.
|
|
|
|
|
*/
|
|
|
|
|
public void log(EventEnum event, @Nullable LauncherAtom.ItemInfo launcherAtomItemInfo,
|
|
|
|
|
int srcState, int dstState) {
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-09 14:24:49 -07:00
|
|
|
/**
|
2020-06-10 00:35:35 -07:00
|
|
|
* Logs an event.
|
|
|
|
|
*
|
|
|
|
|
* @param event an enum implementing EventEnum interface.
|
|
|
|
|
* @param instanceId an identifier obtained from an InstanceIdSequence.
|
|
|
|
|
* @param itemInfo item typically containing app or task launch related information.
|
2020-05-12 14:41:03 -07:00
|
|
|
*/
|
2020-05-28 23:36:14 -07:00
|
|
|
public void log(EventEnum event, InstanceId instanceId, @Nullable ItemInfo itemInfo) {
|
2020-05-12 14:41:03 -07:00
|
|
|
}
|
2020-05-01 13:54:53 -07:00
|
|
|
|
2020-06-09 17:24:29 -07:00
|
|
|
/**
|
|
|
|
|
* Log an event with ranked-choice information along with package. Does nothing if event.getId()
|
|
|
|
|
* <= 0.
|
|
|
|
|
*
|
2020-06-10 00:35:35 -07:00
|
|
|
* @param rankingEvent an enum implementing EventEnum interface.
|
2020-06-09 17:24:29 -07:00
|
|
|
* @param instanceId An identifier obtained from an InstanceIdSequence.
|
|
|
|
|
* @param packageName the package name of the relevant app, if known (null otherwise).
|
|
|
|
|
* @param position the position picked.
|
|
|
|
|
*/
|
|
|
|
|
public void log(EventEnum rankingEvent, InstanceId instanceId, @Nullable String packageName,
|
|
|
|
|
int position) {
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-03 17:25:09 -07:00
|
|
|
/**
|
|
|
|
|
* Logs an event and accompanying {@link LauncherState}s. If either of the state refers
|
|
|
|
|
* to workspace state, then use pageIndex to pass in index of workspace.
|
|
|
|
|
*/
|
|
|
|
|
public void log(EventEnum event, int srcState, int dstState, int pageIndex) {
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-26 01:48:24 -07:00
|
|
|
/**
|
|
|
|
|
* Logs snapshot, or impression of the current workspace.
|
|
|
|
|
*/
|
2020-05-12 14:41:03 -07:00
|
|
|
public void logSnapshot() {
|
|
|
|
|
}
|
2018-10-25 14:09:50 -07:00
|
|
|
}
|