diff options
author | Winson Chung <winsonc@google.com> | 2019-04-02 15:09:36 -0700 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2019-04-03 22:41:39 +0000 |
commit | 41d58f7100c7ce658ef9cdaad3352671a55ce456 (patch) | |
tree | 96a661eae8005cbeabb6163b35ab3bed61e52a52 | |
parent | 131e0b1d1830134cf39945282a87e910271ab79f (diff) | |
download | android_packages_apps_Trebuchet-41d58f7100c7ce658ef9cdaad3352671a55ce456.tar.gz android_packages_apps_Trebuchet-41d58f7100c7ce658ef9cdaad3352671a55ce456.tar.bz2 android_packages_apps_Trebuchet-41d58f7100c7ce658ef9cdaad3352671a55ce456.zip |
Add launcher logging of back button
Bug: 127848641
Test: adb shell setprop log.tag.UserEvent VERBOSE, then hit back
Change-Id: I020738280d2e51a8a192e577baf48c0b092f22f6
(cherry picked from commit df7d00328c907f92419300925ffbdfbb20169422)
5 files changed, 43 insertions, 5 deletions
diff --git a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java index 70739ef23..c579c8a33 100644 --- a/go/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/go/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -85,6 +85,10 @@ public class TouchInteractionService extends Service { // TODO handle assistant } + public void onBackAction(boolean completed, int downX, int downY, boolean isButton, + boolean gestureSwipeLeft) { + } + /** Deprecated methods **/ public void onQuickStep(MotionEvent motionEvent) { } diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto index 5518f09ae..4974dcbdc 100644 --- a/protos/launcher_log.proto +++ b/protos/launcher_log.proto @@ -106,7 +106,7 @@ enum ControlType { RESIZE_HANDLE = 8; VERTICAL_SCROLL = 9; HOME_INTENT = 10; // Deprecated, use enum Command instead - BACK_BUTTON = 11; // Deprecated, use enum Command instead + BACK_BUTTON = 11; QUICK_SCRUB_BUTTON = 12; CLEAR_ALL_BUTTON = 13; CANCEL_TARGET = 14; @@ -114,6 +114,7 @@ enum ControlType { SPLIT_SCREEN_TARGET = 16; REMOTE_ACTION_SHORTCUT = 17; APP_USAGE_SETTINGS = 18; + BACK_GESTURE = 19; } enum TipType { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java index 31d604215..21e98f260 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java @@ -192,7 +192,11 @@ public final class FallbackActivityControllerHelper implements @Override public int getContainerType() { - return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER; + RecentsActivity activity = getCreatedActivity(); + boolean visible = activity != null && activity.isStarted() && activity.hasWindowFocus(); + return visible + ? LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER + : LauncherLogProto.ContainerType.APP; } @Override diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java index 311824f22..87ae0919c 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java @@ -53,6 +53,7 @@ import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.Utilities; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.logging.EventLogArray; +import com.android.launcher3.logging.UserEventDispatcher; import com.android.launcher3.util.LooperExecutor; import com.android.launcher3.util.UiThreadHelper; import com.android.quickstep.SysUINavigationMode.Mode; @@ -141,6 +142,14 @@ public class TouchInteractionService extends Service implements }); } + public void onBackAction(boolean completed, int downX, int downY, boolean isButton, + boolean gestureSwipeLeft) { + final ActivityControlHelper activityControl = + mOverviewComponentObserver.getActivityControlHelper(); + UserEventDispatcher.newInstance(getBaseContext()).logActionBack(completed, downX, downY, + isButton, gestureSwipeLeft, activityControl.getContainerType()); + } + /** Deprecated methods **/ public void onQuickStep(MotionEvent motionEvent) { } diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java index 6ccde626c..c8a4e2a7a 100644 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ b/src/com/android/launcher3/logging/UserEventDispatcher.java @@ -34,7 +34,8 @@ import android.content.SharedPreferences; import android.os.SystemClock; import android.util.Log; import android.view.View; -import android.view.ViewParent; + +import androidx.annotation.Nullable; import com.android.launcher3.DropTarget; import com.android.launcher3.ItemInfo; @@ -54,8 +55,6 @@ import com.android.launcher3.util.ResourceBasedOverride; import java.util.Locale; import java.util.UUID; -import androidx.annotation.Nullable; - /** * Manages the creation of {@link LauncherEvent}. * To debug this class, execute following command before side loading a new apk. @@ -359,6 +358,27 @@ public class UserEventDispatcher implements ResourceBasedOverride { dispatchUserEvent(event, null); } + public void logActionBack(boolean completed, int downX, int downY, boolean isButton, + boolean gestureSwipeLeft, int containerType) { + int actionTouch = isButton ? Action.Touch.TAP : Action.Touch.SWIPE; + Action action = newCommandAction(actionTouch); + action.command = Action.Command.BACK; + action.dir = isButton + ? Action.Direction.NONE + : gestureSwipeLeft + ? Action.Direction.LEFT + : Action.Direction.RIGHT; + Target target = newControlTarget(isButton + ? LauncherLogProto.ControlType.BACK_BUTTON + : LauncherLogProto.ControlType.BACK_GESTURE); + target.spanX = downX; + target.spanY = downY; + target.cardinality = completed ? 1 : 0; + LauncherEvent event = newLauncherEvent(action, target, newContainerTarget(containerType)); + + dispatchUserEvent(event, null); + } + /** * Currently logs following containers: workspace, allapps, widget tray. * @param reason |