From ed538e53b0625c874fe549c67ed612e8c3028e68 Mon Sep 17 00:00:00 2001 From: thiruram Date: Mon, 23 Mar 2020 13:26:44 -0700 Subject: [DO NOT MERGE] Adds basic smart-folder logging. This would allow collecting trimmed down version of smart-folder logs from QPR devices. Change-Id: Ida332bd969774cabcfd72def5bed0e6409d6c8e1 (cherry picked from commit d684eddd9f47e97931c8960e11e4434c58270150) --- protos/launcher_log.proto | 3 +- src/com/android/launcher3/folder/Folder.java | 41 ++++++++++++++++++++++ src/com/android/launcher3/logging/LoggerUtils.java | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto index 055ade58e..fd36d4ba5 100644 --- a/protos/launcher_log.proto +++ b/protos/launcher_log.proto @@ -137,7 +137,8 @@ message Action { AUTOMATED = 1; COMMAND = 2; TIP = 3; - // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST + SOFT_KEYBOARD = 4; + // HARD_KEYBOARD, ASSIST } enum Touch { diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 0bd2c9af7..f483d78f4 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -17,6 +17,8 @@ package com.android.launcher3.folder; import static com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY; +import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; +import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.compat.AccessibilityManagerCompat.sendCustomAccessibilityEvent; @@ -74,6 +76,7 @@ import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.logging.LoggerUtils; import com.android.launcher3.pageindicators.PageIndicatorDots; +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.userevent.nano.LauncherLogProto.ContainerType; @@ -1340,6 +1343,9 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo if (hasFocus) { startEditingFolderName(); } else { + if (isEditingName()) { + logEditFolderLabel(); + } mFolderName.dispatchBackKey(); } } @@ -1517,4 +1523,39 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo super.draw(canvas); } } + + private void logEditFolderLabel() { + LauncherLogProto.LauncherEvent ev = new LauncherLogProto.LauncherEvent(); + LauncherLogProto.Action action = new LauncherLogProto.Action(); + action.type = LauncherLogProto.Action.Type.SOFT_KEYBOARD; + ev.action = action; + + LauncherLogProto.Target edittext_target = new LauncherLogProto.Target(); + edittext_target.type = LauncherLogProto.Target.Type.ITEM; + edittext_target.itemType = LauncherLogProto.ItemType.EDITTEXT; + + LauncherLogProto.Target folder_target = new LauncherLogProto.Target(); + folder_target.type = LauncherLogProto.Target.Type.CONTAINER; + folder_target.containerType = LauncherLogProto.ContainerType.FOLDER; + folder_target.pageIndex = mInfo.screenId; + folder_target.gridX = mInfo.cellX; + folder_target.gridY = mInfo.cellY; + folder_target.cardinality = mInfo.contents.size(); + + LauncherLogProto.Target parent_target = new LauncherLogProto.Target(); + parent_target.type = LauncherLogProto.Target.Type.CONTAINER; + switch (mInfo.container) { + case CONTAINER_HOTSEAT: + parent_target.containerType = LauncherLogProto.ContainerType.HOTSEAT; + break; + case CONTAINER_DESKTOP: + parent_target.containerType = LauncherLogProto.ContainerType.WORKSPACE; + break; + default: + Log.e(TAG, String.format("Expected container to be either %s or %s but found %s.", + CONTAINER_HOTSEAT, CONTAINER_DESKTOP, mInfo.container)); + } + ev.srcTarget = new LauncherLogProto.Target[]{edittext_target, folder_target, parent_target}; + mLauncher.getUserEventDispatcher().dispatchUserEvent(ev, null); + } } diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java index 598792abc..925b7ba28 100644 --- a/src/com/android/launcher3/logging/LoggerUtils.java +++ b/src/com/android/launcher3/logging/LoggerUtils.java @@ -109,7 +109,7 @@ public class LoggerUtils { t.containerType == NAVBAR) { str += " id=" + t.pageIndex; } else if (t.containerType == ContainerType.FOLDER) { - str += " grid(" + t.gridX + "," + t.gridY + ")"; + str += "[PageIndex=" + t.pageIndex + ", grid(" + t.gridX + "," + t.gridY + ")]"; } break; default: -- cgit v1.2.3 From 66dc70c91b22026800b6f7cfb85fe233a72fd462 Mon Sep 17 00:00:00 2001 From: Andy Wickham Date: Tue, 24 Mar 2020 01:03:52 +0000 Subject: Fixes ag/10573640 on qt-future-dev branch. Original qt-future-dev change was ag/10601877. The change needed to be in UiFactory, not RecentsUiFactory. Fixes: 146593239 Test: Installed NexusLauncherDebug on a QD4A build and tried the repo steps. Also built other launcher variants. Merged-In: Ib9c85de2f83f99d1ef53fb17fde5d0b3c514849a Change-Id: I802e2b0069a19ca62a08325bb6d0de5275c43c9b --- .../src/com/android/launcher3/uioverrides/RecentsUiFactory.java | 8 -------- quickstep/src/com/android/launcher3/uioverrides/UiFactory.java | 8 +++++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java index 4d935e115..cac170c68 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsUiFactory.java @@ -19,7 +19,6 @@ package com.android.launcher3.uioverrides; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; -import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import android.content.Context; import android.graphics.Rect; @@ -49,7 +48,6 @@ import com.android.quickstep.SysUINavigationMode; import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.TouchInteractionService; import com.android.quickstep.views.RecentsView; -import com.android.systemui.shared.system.ActivityManagerWrapper; import com.android.systemui.shared.system.WindowManagerWrapper; import java.util.ArrayList; @@ -210,12 +208,6 @@ public abstract class RecentsUiFactory { } } - /** Closes system windows. */ - public static void closeSystemWindows() { - ActivityManagerWrapper.getInstance() - .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); - } - private static final class LauncherTaskViewController extends TaskViewTouchController { diff --git a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java index eb58b9425..0790cf6b0 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java +++ b/quickstep/src/com/android/launcher3/uioverrides/UiFactory.java @@ -28,6 +28,7 @@ import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_COUNT; import static com.android.launcher3.allapps.DiscoveryBounce.HOME_BOUNCE_SEEN; import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_COUNT; import static com.android.launcher3.allapps.DiscoveryBounce.SHELF_BOUNCE_SEEN; +import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; import android.animation.AnimatorSet; import android.animation.ValueAnimator; @@ -58,6 +59,7 @@ import com.android.quickstep.SysUINavigationMode.Mode; import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener; import com.android.quickstep.util.RemoteFadeOutAnimationListener; import com.android.systemui.shared.system.ActivityCompat; +import com.android.systemui.shared.system.ActivityManagerWrapper; import java.io.ByteArrayOutputStream; import java.io.PrintWriter; @@ -252,5 +254,9 @@ public class UiFactory extends RecentsUiFactory { return persons == null ? Utilities.EMPTY_PERSON_ARRAY : persons; } - public static void closeSystemWindows() {} + /** Closes system windows. */ + public static void closeSystemWindows() { + ActivityManagerWrapper.getInstance() + .closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS); + } } -- cgit v1.2.3