diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2018-05-16 21:40:11 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-05-16 21:40:11 +0000 |
commit | 3c25046da850a3dba52b461afdf6bd288c857228 (patch) | |
tree | fb63f2a3eae6ea14d75b2cb504f4709193db17dc /quickstep | |
parent | 27289bbe409643a0e673350304a28da20f0e1644 (diff) | |
parent | d0788021f9f6d74f49bf5553debf60e5d48895cb (diff) | |
download | android_packages_apps_Trebuchet-3c25046da850a3dba52b461afdf6bd288c857228.tar.gz android_packages_apps_Trebuchet-3c25046da850a3dba52b461afdf6bd288c857228.tar.bz2 android_packages_apps_Trebuchet-3c25046da850a3dba52b461afdf6bd288c857228.zip |
Merge "Logging Square button presses opening Recents" into ub-launcher3-edmonton
Diffstat (limited to 'quickstep')
3 files changed, 36 insertions, 5 deletions
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java index f9dcee05b..ae0affee0 100644 --- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java +++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java @@ -48,6 +48,7 @@ import com.android.launcher3.allapps.AllAppsTransitionController; import com.android.launcher3.allapps.DiscoveryBounce; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.dragndrop.DragLayer; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.quickstep.util.LayoutUtils; import com.android.quickstep.util.RemoteAnimationProvider; @@ -99,7 +100,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { RecentsView getVisibleRecentsView(); @UiThread - boolean switchToRecentsIfVisible(); + boolean switchToRecentsIfVisible(boolean fromRecentsButton); Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target); @@ -120,6 +121,11 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { */ LongSwipeHelper getLongSwipeController(T activity, RemoteAnimationTargetSet targetSet); + /** + * Used for containerType in {@link com.android.launcher3.logging.UserEventDispatcher} + */ + int getContainerType(); + class LauncherActivityControllerHelper implements ActivityControlHelper<Launcher> { @Override @@ -277,9 +283,15 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Override - public boolean switchToRecentsIfVisible() { + public boolean switchToRecentsIfVisible(boolean fromRecentsButton) { Launcher launcher = getVisibleLaucher(); if (launcher != null) { + if (fromRecentsButton) { + launcher.getUserEventDispatcher().logActionCommand( + LauncherLogProto.Action.Command.RECENTS_BUTTON, + getContainerType(), + LauncherLogProto.ContainerType.TASKSWITCHER); + } launcher.getStateManager().goToState(OVERVIEW); return true; } @@ -319,6 +331,13 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { public AlphaProperty getAlphaProperty(Launcher activity) { return activity.getDragLayer().getAlphaProperty(DragLayer.ALPHA_INDEX_SWIPE_UP); } + + @Override + public int getContainerType() { + final Launcher launcher = getVisibleLaucher(); + return launcher != null ? launcher.getStateManager().getState().containerType + : LauncherLogProto.ContainerType.APP; + } } class FallbackActivityControllerHelper implements ActivityControlHelper<RecentsActivity> { @@ -457,7 +476,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { } @Override - public boolean switchToRecentsIfVisible() { + public boolean switchToRecentsIfVisible(boolean fromRecentsButton) { return false; } @@ -495,6 +514,10 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> { return activity.getDragLayer().getAlphaProperty(0); } + @Override + public int getContainerType() { + return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER; + } } interface LayoutListener { diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index 81a73fc65..7b2932383 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -52,6 +52,8 @@ import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.logging.UserEventDispatcher; +import com.android.launcher3.userevent.nano.LauncherLogProto.Action; +import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.ActivityControlHelper.ActivityInitListener; import com.android.quickstep.ActivityControlHelper.AnimationFactory; import com.android.quickstep.ActivityControlHelper.FallbackActivityControllerHelper; @@ -224,6 +226,7 @@ public class OverviewCommandHelper { private T mActivity; private RecentsView mRecentsView; private final long mToggleClickedTime = SystemClock.uptimeMillis(); + private boolean mUserEventLogged; public RecentsActivityCommand() { mHelper = getActivityControlHelper(); @@ -241,7 +244,7 @@ public class OverviewCommandHelper { if (!handleCommand(elapsedTime)) { // Start overview - if (!mHelper.switchToRecentsIfVisible()) { + if (!mHelper.switchToRecentsIfVisible(true)) { mListener = mHelper.createActivityInitListener(this::onActivityReady); mListener.registerAndStartActivity(overviewIntent, this::createWindowAnimation, mContext, mMainThreadExecutor.getHandler(), RECENTS_LAUNCH_DURATION); @@ -284,6 +287,11 @@ public class OverviewCommandHelper { mActivity = activity; mRecentsView = mActivity.getOverviewPanel(); mRecentsView.setRunningTaskIconScaledDown(true /* isScaledDown */, false /* animate */); + if (!mUserEventLogged) { + activity.getUserEventDispatcher().logActionCommand(Action.Command.RECENTS_BUTTON, + mHelper.getContainerType(), ContainerType.TASKSWITCHER); + mUserEventLogged = true; + } return false; } diff --git a/quickstep/src/com/android/quickstep/QuickScrubController.java b/quickstep/src/com/android/quickstep/QuickScrubController.java index 5ddd904df..28b06fb2d 100644 --- a/quickstep/src/com/android/quickstep/QuickScrubController.java +++ b/quickstep/src/com/android/quickstep/QuickScrubController.java @@ -133,7 +133,7 @@ public class QuickScrubController implements OnAlarmListener { */ private void breakOutOfQuickScrub() { if (mRecentsView.getChildCount() == 0 || mActivityControlHelper == null - || !mActivityControlHelper.switchToRecentsIfVisible()) { + || !mActivityControlHelper.switchToRecentsIfVisible(false)) { mActivity.onBackPressed(); } } |