Merge "Changing event check implementation from logcat to TestProtocol" into ub-launcher3-rvc-dev
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
index a35e13a..c1a585e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java
@@ -23,6 +23,7 @@
import static com.android.launcher3.anim.Interpolators.DEACCEL_3;
import static com.android.launcher3.config.FeatureFlags.ENABLE_ALL_APPS_EDU;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
import static com.android.launcher3.touch.AbstractStateChangeTouchController.SUCCESS_TRANSITION_PROGRESS;
import static com.android.quickstep.views.RecentsView.ADJACENT_PAGE_OFFSET;
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
@@ -44,6 +45,7 @@
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
@@ -246,5 +248,9 @@
startContainerType,
mEndState.containerType,
mLauncher.getWorkspace().getCurrentPage());
+ mLauncher.getStatsLogManager().logger()
+ .withSrcState(StatsLogManager.containerTypeToAtomState(mStartState.containerType))
+ .withDstState(StatsLogManager.containerTypeToAtomState(mEndState.containerType))
+ .log(LAUNCHER_HOME_GESTURE);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
index da304e5..1b439d1 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
@@ -28,6 +28,10 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.scrollInterpolatorForVelocity;
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
+import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
+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.logging.StatsLogManager.getLauncherAtomEvent;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE;
@@ -61,6 +65,7 @@
import com.android.launcher3.anim.PendingAnimation;
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.touch.BaseSwipeDetector;
import com.android.launcher3.touch.BothAxesSwipeDetector;
@@ -429,6 +434,13 @@
mStartState.containerType,
targetState.containerType,
mLauncher.getWorkspace().getCurrentPage());
+ mLauncher.getStatsLogManager().logger()
+ .withSrcState(LAUNCHER_STATE_HOME)
+ .withDstState(StatsLogManager.containerTypeToAtomState(targetState.containerType))
+ .log(getLauncherAtomEvent(mStartState.containerType, targetState.containerType,
+ targetState.ordinal > mStartState.ordinal
+ ? LAUNCHER_UNKNOWN_SWIPEUP
+ : LAUNCHER_UNKNOWN_SWIPEDOWN));
mLauncher.getStateManager().goToState(targetState, false, this::clearState);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
index e825c5f..413a813 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandlerV2.java
@@ -22,6 +22,12 @@
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_1_2;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.config.FeatureFlags.UNSTABLE_SPRINGS;
+import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_GESTURE;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_LEFT;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_QUICKSWITCH_RIGHT;
import static com.android.launcher3.util.DefaultDisplay.getSingleFrameMs;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static com.android.quickstep.GestureState.GestureEndTarget.HOME;
@@ -62,6 +68,7 @@
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
+import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
@@ -275,8 +282,7 @@
if (mActivity == activity) {
return true;
}
- mTaskViewSimulator.setLayoutRotation(mDeviceState.getCurrentActiveRotation(),
- mDeviceState.getDisplayRotation());
+
if (mActivity != null) {
// The launcher may have been recreated as a result of device rotation.
int oldState = mStateCallback.getState() & ~LAUNCHER_UI_STATES;
@@ -329,6 +335,7 @@
if (mStateCallback.hasStates(STATE_HANDLER_INVALIDATED)) {
return;
}
+ mTaskViewSimulator.setRecentsConfiguration(mActivity.getResources().getConfiguration());
// If we've already ended the gesture and are going home, don't prepare recents UI,
// as that will set the state as BACKGROUND_APP, overriding the animation to NORMAL.
@@ -891,6 +898,27 @@
ContainerType.NAVBAR, ContainerType.APP,
endTarget.containerType,
pageIndex);
+ StatsLogManager.EventEnum event;
+ switch (endTarget) {
+ case HOME:
+ event = LAUNCHER_HOME_GESTURE;
+ break;
+ case RECENTS:
+ event = LAUNCHER_OVERVIEW_GESTURE;
+ break;
+ case LAST_TASK:
+ case NEW_TASK:
+ event = (mLogDirection == Direction.LEFT)
+ ? LAUNCHER_QUICKSWITCH_LEFT
+ : LAUNCHER_QUICKSWITCH_RIGHT;
+ break;
+ default:
+ event = IGNORE;
+ }
+ StatsLogManager.newInstance(mContext).logger()
+ .withSrcState(LAUNCHER_STATE_BACKGROUND)
+ .withDstState(StatsLogManager.containerTypeToAtomState(endTarget.containerType))
+ .log(event);
}
/** Animates to the given progress, where 0 is the current app and 1 is overview. */
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
index ed07062..01936e4 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
@@ -66,7 +66,7 @@
}
}
RecentsOrientedState orientedState = taskView.getRecentsView().getPagedViewOrientedState();
- boolean canLauncherRotate = orientedState.canLauncherRotate();
+ boolean canLauncherRotate = orientedState.canRecentsActivityRotate();
boolean isInLandscape = orientedState.getTouchRotation() != ROTATION_0;
// Add overview actions to the menu when in in-place rotate landscape mode.
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
index 4440a04..d972c0f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
@@ -15,6 +15,9 @@
*/
package com.android.quickstep.inputconsumers;
+import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
+
import android.content.Context;
import android.content.Intent;
import android.graphics.PointF;
@@ -22,9 +25,10 @@
import com.android.launcher3.BaseActivity;
import com.android.launcher3.BaseDraggingActivity;
-import com.android.launcher3.logging.StatsLogUtils;
+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;
@@ -40,11 +44,13 @@
private final Context mContext;
private final InputMonitorCompat mInputMonitor;
private final TriggerSwipeUpTouchTracker mTriggerSwipeUpTracker;
+ private final GestureState mGestureState;
public OverviewWithoutFocusInputConsumer(Context context,
RecentsAnimationDeviceState deviceState, GestureState gestureState,
InputMonitorCompat inputMonitor, boolean disableHorizontalSwipe) {
mContext = context;
+ mGestureState = gestureState;
mInputMonitor = inputMonitor;
mTriggerSwipeUpTracker = new TriggerSwipeUpTouchTracker(context, disableHorizontalSwipe,
deviceState.getNavBarPosition(), this::onInterceptTouch, this);
@@ -81,10 +87,21 @@
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 = StatsLogUtils.getContainerTypeFromState(activity.getCurrentState());
+ int containerType = (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);
+ activity.getStatsLogManager().logger()
+ .withSrcState(LAUNCHER_STATE_HOME)
+ .withDstState(LAUNCHER_STATE_HOME)
+ .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
+ .setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setPageIndex(-1))
+ .build())
+ .log(LAUNCHER_HOME_GESTURE);
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
index 32da52e..46013d3 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/TaskViewSimulator.java
@@ -22,6 +22,7 @@
import android.animation.TimeInterpolator;
import android.content.Context;
+import android.content.res.Configuration;
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.PointF;
@@ -125,6 +126,14 @@
}
/**
+ * @see com.android.quickstep.views.RecentsView#onConfigurationChanged(Configuration)
+ */
+ public void setRecentsConfiguration(Configuration configuration) {
+ mOrientationState.setActivityConfiguration(configuration);
+ mLayoutValid = false;
+ }
+
+ /**
* @see com.android.quickstep.views.RecentsView#FULLSCREEN_PROGRESS
*/
public float getFullScreenScale() {
@@ -205,7 +214,8 @@
public void applyWindowToHomeRotation(Matrix matrix) {
mMatrix.postTranslate(mDp.windowX, mDp.windowY);
postDisplayRotation(deltaRotation(
- mOrientationState.getLauncherRotation(), mOrientationState.getDisplayRotation()),
+ mOrientationState.getRecentsActivityRotation(),
+ mOrientationState.getDisplayRotation()),
mDp.widthPx, mDp.heightPx, matrix);
matrix.postTranslate(-mRunningTargetWindowPosition.x, -mRunningTargetWindowPosition.y);
}
@@ -226,7 +236,7 @@
mPositionHelper.updateThumbnailMatrix(
mThumbnailPosition, mThumbnailData,
mTaskRect.width(), mTaskRect.height(),
- mDp, mOrientationState.getLauncherRotation());
+ mDp, mOrientationState.getRecentsActivityRotation());
mPositionHelper.getMatrix().invert(mInversePositionMatrix);
PagedOrientationHandler poh = mOrientationState.getOrientationHandler();
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index e0aaa85..68b8975 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -59,6 +59,7 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Configuration;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.PointF;
@@ -393,6 +394,7 @@
mActivity = BaseActivity.fromContext(context);
mOrientationState = new RecentsOrientedState(
context, mSizeStrategy, this::animateRecentsRotationInPlace);
+ mOrientationState.setActivityConfiguration(context.getResources().getConfiguration());
mFastFlingVelocity = getResources()
.getDimensionPixelSize(R.dimen.recents_fast_fling_velocity);
@@ -1063,7 +1065,7 @@
}
private void animateRecentsRotationInPlace(int newRotation) {
- if (mOrientationState.canLauncherRotate()) {
+ if (mOrientationState.canRecentsActivityRotate()) {
// Let system take care of the rotation
return;
}
@@ -1646,29 +1648,41 @@
}
}
+ @Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig);
+ if (mOrientationState.setActivityConfiguration(newConfig)) {
+ updateOrientationHandler();
+ }
+ }
+
public void setLayoutRotation(int touchRotation, int displayRotation) {
if (mOrientationState.update(touchRotation, displayRotation)) {
- mOrientationHandler = mOrientationState.getOrientationHandler();
- mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
- setLayoutDirection(mIsRtl
- ? View.LAYOUT_DIRECTION_RTL
- : View.LAYOUT_DIRECTION_LTR);
- mClearAllButton.setLayoutDirection(mIsRtl
- ? View.LAYOUT_DIRECTION_LTR
- : View.LAYOUT_DIRECTION_RTL);
- mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());
- mActivity.getDragLayer().recreateControllers();
- boolean isInLandscape = mOrientationState.getTouchRotation() != 0
- || mOrientationState.getLauncherRotation() != ROTATION_0;
- mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
- !mOrientationState.canLauncherRotate() && isInLandscape);
- resetPaddingFromTaskSize();
- requestLayout();
- // Reapply the current page to update page scrolls.
- setCurrentPage(mCurrentPage);
+ updateOrientationHandler();
}
}
+ private void updateOrientationHandler() {
+ mOrientationHandler = mOrientationState.getOrientationHandler();
+ mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
+ setLayoutDirection(mIsRtl
+ ? View.LAYOUT_DIRECTION_RTL
+ : View.LAYOUT_DIRECTION_LTR);
+ mClearAllButton.setLayoutDirection(mIsRtl
+ ? View.LAYOUT_DIRECTION_LTR
+ : View.LAYOUT_DIRECTION_RTL);
+ mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());
+ mActivity.getDragLayer().recreateControllers();
+ boolean isInLandscape = mOrientationState.getTouchRotation() != 0
+ || mOrientationState.getRecentsActivityRotation() != ROTATION_0;
+ mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
+ !mOrientationState.canRecentsActivityRotate() && isInLandscape);
+ resetPaddingFromTaskSize();
+ requestLayout();
+ // Reapply the current page to update page scrolls.
+ setCurrentPage(mCurrentPage);
+ }
+
public RecentsOrientedState getPagedViewOrientedState() {
return mOrientationState;
}
@@ -2239,7 +2253,7 @@
getCurrentPageTaskView().setModalness(modalness);
}
// Only show actions view when it's modal for in-place landscape mode.
- boolean inPlaceLandscape = !mOrientationState.canLauncherRotate()
+ boolean inPlaceLandscape = !mOrientationState.canRecentsActivityRotate()
&& mOrientationState.getTouchRotation() != ROTATION_0;
mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION, modalness < 1 && inPlaceLandscape);
}
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index d605317..2034801 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -23,7 +23,6 @@
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__BACKGROUND;
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__HOME;
import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__OVERVIEW;
-import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__SRC_STATE__HOME;
import android.content.Context;
import android.util.Log;
@@ -179,8 +178,8 @@
private InstanceId mInstanceId = DEFAULT_INSTANCE_ID;
private OptionalInt mRank = OptionalInt.empty();
private Optional<ContainerInfo> mContainerInfo = Optional.empty();
- private int mSrcState = LAUNCHER_UICHANGED__SRC_STATE__HOME;
- private int mDstState = LAUNCHER_UICHANGED__DST_STATE__BACKGROUND;
+ private int mSrcState = LAUNCHER_STATE_UNSPECIFIED;
+ private int mDstState = LAUNCHER_STATE_UNSPECIFIED;
private Optional<FromState> mFromState = Optional.empty();
private Optional<ToState> mToState = Optional.empty();
private Optional<String> mEditText = Optional.empty();
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index cefab1b..ae19d73 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -58,21 +58,6 @@
}
/**
- * Gets the scale that should be applied to the TaskView so that it matches the target
- * TODO: Remove this method
- */
- public static float getTaskScale(RecentsOrientedState orientedState,
- float srcWidth, float srcHeight, float targetWidth, float targetHeight) {
- if (orientedState == null
- || orientedState.isHomeRotationAllowed()
- || orientedState.isDisplayPhoneNatural()) {
- return srcWidth / targetWidth;
- } else {
- return srcHeight / targetHeight;
- }
- }
-
- /**
* Recursively sets view and all children enabled/disabled.
* @param view Top most parent view to change.
* @param enabled True = enable, False = disable.
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 90ee18f..b9953cb 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -33,6 +33,7 @@
import android.content.ContentResolver;
import android.content.Context;
import android.content.SharedPreferences;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Matrix;
@@ -47,6 +48,7 @@
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
@@ -56,6 +58,7 @@
import com.android.launcher3.util.WindowBounds;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.SysUINavigationMode;
+import com.android.systemui.shared.system.ConfigurationCompat;
import java.lang.annotation.Retention;
import java.util.function.IntConsumer;
@@ -87,7 +90,7 @@
private @SurfaceRotation int mTouchRotation = ROTATION_0;
private @SurfaceRotation int mDisplayRotation = ROTATION_0;
- private @SurfaceRotation int mLauncherRotation = ROTATION_0;
+ private @SurfaceRotation int mRecentsActivityRotation = ROTATION_0;
// Launcher activity supports multiple orientation, but fallback activity does not
private static final int FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_ACTIVITY = 1 << 0;
@@ -130,6 +133,8 @@
private int mFlags;
private int mPreviousRotation = ROTATION_0;
+ @Nullable private Configuration mActivityConfiguration;
+
/**
* @param rotationChangeListener Callback for receiving rotation events when rotation watcher
* is enabled
@@ -165,6 +170,15 @@
}
/**
+ * Sets the configuration for the recents activity, which could affect the activity's rotation
+ * @see #update(int, int)
+ */
+ public boolean setActivityConfiguration(Configuration activityConfiguration) {
+ mActivityConfiguration = activityConfiguration;
+ return update(mTouchRotation, mDisplayRotation);
+ }
+
+ /**
* Sets if the host is in multi-window mode
*/
public void setMultiWindowMode(boolean isMultiWindow) {
@@ -188,23 +202,19 @@
*/
public boolean update(
@SurfaceRotation int touchRotation, @SurfaceRotation int displayRotation) {
- if (!isMultipleOrientationSupportedByDevice()) {
- return false;
- }
-
- int launcherRotation = inferLauncherRotation(displayRotation);
+ int recentsActivityRotation = inferRecentsActivityRotation(displayRotation);
if (mDisplayRotation == displayRotation
&& mTouchRotation == touchRotation
- && mLauncherRotation == launcherRotation) {
+ && mRecentsActivityRotation == recentsActivityRotation) {
return false;
}
- mLauncherRotation = launcherRotation;
+ mRecentsActivityRotation = recentsActivityRotation;
mDisplayRotation = displayRotation;
mTouchRotation = touchRotation;
mPreviousRotation = touchRotation;
- if (mLauncherRotation == mTouchRotation || canLauncherRotate()) {
+ if (mRecentsActivityRotation == mTouchRotation || canRecentsActivityRotate()) {
mOrientationHandler = PagedOrientationHandler.PORTRAIT;
if (DEBUG) {
Log.d(TAG, "current RecentsOrientedState: " + this);
@@ -226,9 +236,11 @@
}
@SurfaceRotation
- private int inferLauncherRotation(@SurfaceRotation int displayRotation) {
- if (!isMultipleOrientationSupportedByDevice() || isHomeRotationAllowed()) {
- return displayRotation;
+ private int inferRecentsActivityRotation(@SurfaceRotation int displayRotation) {
+ if (isRecentsActivityRotationAllowed()) {
+ return mActivityConfiguration == null
+ ? displayRotation
+ : ConfigurationCompat.getWindowConfigurationRotation(mActivityConfiguration);
} else {
return ROTATION_0;
}
@@ -236,7 +248,8 @@
private void setFlag(int mask, boolean enabled) {
boolean wasRotationEnabled = !TestProtocol.sDisableSensorRotation
- && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
+ && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED
+ && !canRecentsActivityRotate();
if (enabled) {
mFlags |= mask;
} else {
@@ -244,7 +257,8 @@
}
boolean isRotationEnabled = !TestProtocol.sDisableSensorRotation
- && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED;
+ && (mFlags & VALUE_ROTATION_WATCHER_ENABLED) == VALUE_ROTATION_WATCHER_ENABLED
+ && !canRecentsActivityRotate();
if (wasRotationEnabled != isRotationEnabled) {
UI_HELPER_EXECUTOR.execute(() -> {
if (isRotationEnabled) {
@@ -324,8 +338,8 @@
}
@SurfaceRotation
- public int getLauncherRotation() {
- return mLauncherRotation;
+ public int getRecentsActivityRotation() {
+ return mRecentsActivityRotation;
}
public boolean isMultipleOrientationSupportedByDevice() {
@@ -333,14 +347,19 @@
== MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE;
}
- public boolean isHomeRotationAllowed() {
- return (mFlags & (FLAG_HOME_ROTATION_ALLOWED_IN_PREFS | FLAG_MULTIWINDOW_ROTATION_ALLOWED))
- != 0 ||
- (mFlags & FLAG_HOME_ROTATION_FORCE_ENABLED_FOR_TESTING) != 0;
+ public boolean isRecentsActivityRotationAllowed() {
+ return ((mFlags & MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE)
+ == MASK_MULTIPLE_ORIENTATION_SUPPORTED_BY_DEVICE)
+ || (mFlags & (FLAG_HOME_ROTATION_ALLOWED_IN_PREFS
+ | FLAG_MULTIWINDOW_ROTATION_ALLOWED
+ | FLAG_HOME_ROTATION_FORCE_ENABLED_FOR_TESTING)) != 0;
}
- public boolean canLauncherRotate() {
- return (mFlags & FLAG_SYSTEM_ROTATION_ALLOWED) != 0 && isHomeRotationAllowed();
+ /**
+ * Returns true if the activity can rotate, if allowed by system rotation settings
+ */
+ public boolean canRecentsActivityRotate() {
+ return (mFlags & FLAG_SYSTEM_ROTATION_ALLOWED) != 0 && isRecentsActivityRotationAllowed();
}
/**
@@ -508,8 +527,8 @@
extractObjectNameAndAddress(mOrientationHandler.toString())
+ " mDisplayRotation=" + mDisplayRotation
+ " mTouchRotation=" + mTouchRotation
- + " mLauncherRotation=" + mLauncherRotation
- + " mHomeRotation=" + isHomeRotationAllowed()
+ + " mRecentsActivityRotation=" + mRecentsActivityRotation
+ + " isRecentsActivityRotationAllowed=" + isRecentsActivityRotationAllowed()
+ " mSystemRotation=" + systemRotationOn
+ " mFlags=" + mFlags
+ "]";
@@ -521,7 +540,8 @@
public DeviceProfile getLauncherDeviceProfile() {
InvariantDeviceProfile idp = InvariantDeviceProfile.INSTANCE.get(mContext);
// TODO also check the natural orientation is landscape or portrait
- return (mLauncherRotation == ROTATION_90 || mLauncherRotation == ROTATION_270)
+ return (mRecentsActivityRotation == ROTATION_90
+ || mRecentsActivityRotation == ROTATION_270)
? idp.landscapeProfile
: idp.portraitProfile;
}
diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java
index 7d80d81..310c306 100644
--- a/src/com/android/launcher3/BaseActivity.java
+++ b/src/com/android/launcher3/BaseActivity.java
@@ -37,8 +37,6 @@
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.logging.StatsLogManager;
-import com.android.launcher3.logging.StatsLogUtils;
-import com.android.launcher3.logging.StatsLogUtils.LogStateProvider;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.SystemUiController;
@@ -52,7 +50,7 @@
/**
* Launcher BaseActivity
*/
-public abstract class BaseActivity extends Activity implements LogStateProvider, ActivityContext {
+public abstract class BaseActivity extends Activity implements ActivityContext {
private static final String TAG = "BaseActivity";
@@ -146,13 +144,11 @@
return mDeviceProfile;
}
- public int getCurrentState() { return StatsLogUtils.LAUNCHER_STATE_BACKGROUND; }
-
public void modifyUserEvent(LauncherLogProto.LauncherEvent event) {}
public final StatsLogManager getStatsLogManager() {
if (mStatsLogManager == null) {
- mStatsLogManager = StatsLogManager.newInstance(this, this);
+ mStatsLogManager = StatsLogManager.newInstance(this);
}
return mStatsLogManager;
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 7fc64ea..0970dae 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -38,6 +38,10 @@
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.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.popup.SystemShortcut.APP_INFO;
import static com.android.launcher3.popup.SystemShortcut.INSTALL;
import static com.android.launcher3.popup.SystemShortcut.WIDGETS;
@@ -110,8 +114,9 @@
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.keyboard.CustomActionsPopup;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
+import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logging.FileLog;
-import com.android.launcher3.logging.StatsLogUtils;
+import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.model.BgDataModel.Callbacks;
@@ -920,13 +925,32 @@
private void logStopAndResume(int command) {
+ int pageIndex = mWorkspace.isOverlayShown() ? -1 : mWorkspace.getCurrentPage();
int containerType = mStateManager.getState().containerType;
+
+ StatsLogManager.EventEnum event;
+ StatsLogManager.StatsLogger logger = getStatsLogManager().logger();
+ if (command == Action.Command.RESUME) {
+ logger.withSrcState(LAUNCHER_STATE_BACKGROUND)
+ .withDstState(containerTypeToAtomState(mStateManager.getState().containerType));
+ event = LAUNCHER_ONRESUME;
+ } else { /* command == Action.Command.STOP */
+ logger.withSrcState(containerTypeToAtomState(mStateManager.getState().containerType))
+ .withDstState(LAUNCHER_STATE_BACKGROUND);
+ event = LAUNCHER_ONSTOP;
+ }
+
if (containerType == ContainerType.WORKSPACE && mWorkspace != null) {
getUserEventDispatcher().logActionCommand(command,
- containerType, -1, mWorkspace.isOverlayShown() ? -1 : 0);
+ containerType, -1, pageIndex);
+ logger.withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
+ .setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setPageIndex(pageIndex)).build());
} else {
getUserEventDispatcher().logActionCommand(command, containerType, -1);
}
+ logger.log(event);
}
private void scheduleDeferredCheck() {
@@ -1836,16 +1860,6 @@
}
@Override
- public int getCurrentState() {
- if (mStateManager.getState() == LauncherState.ALL_APPS) {
- return StatsLogUtils.LAUNCHER_STATE_ALLAPPS;
- } else if (mStateManager.getState() == OVERVIEW) {
- return StatsLogUtils.LAUNCHER_STATE_OVERVIEW;
- }
- return StatsLogUtils.LAUNCHER_STATE_HOME;
- }
-
- @Override
public boolean startActivitySafely(View v, Intent intent, ItemInfo item,
@Nullable String sourceContainer) {
if (!hasBeenResumed()) {
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index a8dca12..1441e0b 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -28,6 +28,9 @@
import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
+import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPELEFT;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPERIGHT;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -79,6 +82,7 @@
import com.android.launcher3.graphics.DragPreviewProvider;
import com.android.launcher3.graphics.PreloadIconDrawable;
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;
@@ -999,6 +1003,15 @@
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)
+ .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
+ .setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setPageIndex(0))
+ .build())
+ .log(LAUNCHER_SWIPELEFT);
}
mOverlayShown = true;
// Not announcing the overlay page for accessibility since it announces itself.
@@ -1008,6 +1021,15 @@
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);
}
} else if (Float.compare(mOverlayTranslation, 0f) != 0) {
// When arriving to 0 overscroll from non-zero overscroll, announce page for
@@ -1099,9 +1121,20 @@
protected void notifyPageSwitchListener(int prevPage) {
super.notifyPageSwitchListener(prevPage);
if (prevPage != mCurrentPage) {
- int swipeDirection = (prevPage < mCurrentPage) ? Action.Direction.RIGHT : Action.Direction.LEFT;
+ 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)
+ .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
+ .setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setPageIndex(prevPage)).build())
+ .log(event);
}
}
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index 3edfa8d..8e23b65 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -15,6 +15,12 @@
*/
package com.android.launcher3.logging;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_CLOSE_DOWN;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_OPEN_UP;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_GESTURE;
+
import android.content.Context;
import androidx.annotation.Nullable;
@@ -23,8 +29,8 @@
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.logging.StatsLogUtils.LogStateProvider;
import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.userevent.LauncherLogProto;
import com.android.launcher3.util.ResourceBasedOverride;
/**
@@ -35,6 +41,54 @@
*/
public class StatsLogManager implements ResourceBasedOverride {
+ public static final int LAUNCHER_STATE_UNSPECIFIED = 0;
+ public static final int LAUNCHER_STATE_BACKGROUND = 1;
+ public static final int LAUNCHER_STATE_HOME = 2;
+ public static final int LAUNCHER_STATE_OVERVIEW = 3;
+ public static final int LAUNCHER_STATE_ALLAPPS = 4;
+ 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 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()) {
+ return LAUNCHER_HOME_GESTURE;
+ } else if (startContainerType != LauncherLogProto.ContainerType.TASKSWITCHER.getNumber()
+ && targetContainerType == LauncherLogProto.ContainerType.TASKSWITCHER.getNumber()) {
+ return LAUNCHER_OVERVIEW_GESTURE;
+ } else if (startContainerType != LauncherLogProto.ContainerType.ALLAPPS.getNumber()
+ && targetContainerType == LauncherLogProto.ContainerType.ALLAPPS.getNumber()) {
+ return LAUNCHER_ALLAPPS_OPEN_UP;
+ } else if (startContainerType == LauncherLogProto.ContainerType.ALLAPPS.getNumber()
+ && targetContainerType != LauncherLogProto.ContainerType.ALLAPPS.getNumber()) {
+ return LAUNCHER_ALLAPPS_CLOSE_DOWN;
+ }
+ return fallbackEvent; // TODO fix
+ }
+
public interface EventEnum {
int getId();
}
@@ -164,6 +218,44 @@
@UiEvent(doc = "App launch ranking logged for hotseat predictions)")
LAUNCHER_HOTSEAT_RANKED(553),
+ @UiEvent(doc = "Launcher is now in background. e.g., Screen off event")
+ LAUNCHER_ONSTOP(562),
+
+ @UiEvent(doc = "Launcher is now in foreground. e.g., Screen on event, back button")
+ LAUNCHER_ONRESUME(563),
+
+ @UiEvent(doc = "User swipes or fling in LEFT direction on workspace.")
+ LAUNCHER_SWIPELEFT(564),
+
+ @UiEvent(doc = "User swipes or fling in RIGHT direction on workspace.")
+ LAUNCHER_SWIPERIGHT(565),
+
+ @UiEvent(doc = "User swipes or fling in UP direction in unknown way.")
+ LAUNCHER_UNKNOWN_SWIPEUP(566),
+
+ @UiEvent(doc = "User swipes or fling in DOWN direction in unknown way.")
+ LAUNCHER_UNKNOWN_SWIPEDOWN(567),
+
+ @UiEvent(doc = "User swipes or fling in UP direction to open apps drawer.")
+ LAUNCHER_ALLAPPS_OPEN_UP(568),
+
+ @UiEvent(doc = "User swipes or fling in DOWN direction to close apps drawer.")
+ LAUNCHER_ALLAPPS_CLOSE_DOWN(569),
+
+ @UiEvent(doc = "User swipes or fling in UP direction and hold from the bottom bazel area")
+ LAUNCHER_OVERVIEW_GESTURE(570),
+
+ @UiEvent(doc = "User swipes or fling in LEFT direction on the bottom bazel area.")
+ LAUNCHER_QUICKSWITCH_LEFT(571),
+
+ @UiEvent(doc = "User swipes or fling in RIGHT direction on the bottom bazel area.")
+ LAUNCHER_QUICKSWITCH_RIGHT(572),
+
+ @UiEvent(doc = "User swipes or fling in DOWN direction on the bottom bazel area.")
+ LAUNCHER_SWIPEDOWN_NAVBAR(573),
+
+ @UiEvent(doc = "User swipes or fling in UP direction from bottom bazel area.")
+ LAUNCHER_HOME_GESTURE(574),
@UiEvent(doc = "User's workspace layout information is snapshot in the background.")
LAUNCHER_WORKSPACE_SNAPSHOT(579),
@@ -184,6 +276,7 @@
LAUNCHER_SELECT_MODE_ITEM(584);
// ADD MORE
+
private final int mId;
LauncherEvent(int id) {
@@ -301,19 +394,12 @@
};
}
- protected LogStateProvider mStateProvider;
-
/**
* Creates a new instance of {@link StatsLogManager} based on provided context.
*/
public static StatsLogManager newInstance(Context context) {
- return newInstance(context, null);
- }
-
- 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;
}
diff --git a/src/com/android/launcher3/logging/StatsLogUtils.java b/src/com/android/launcher3/logging/StatsLogUtils.java
index 10d88e5..a5cc7ea 100644
--- a/src/com/android/launcher3/logging/StatsLogUtils.java
+++ b/src/com/android/launcher3/logging/StatsLogUtils.java
@@ -6,28 +6,13 @@
import androidx.annotation.Nullable;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import java.util.ArrayList;
-import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.DEFAULT_CONTAINERTYPE;
-
public class StatsLogUtils {
-
- // Defined in android.stats.launcher.nano
- // As they cannot be linked in this file, defining again.
- public final static int LAUNCHER_STATE_BACKGROUND = 0;
- public final static int LAUNCHER_STATE_HOME = 1;
- public final static int LAUNCHER_STATE_OVERVIEW = 2;
- public final static int LAUNCHER_STATE_ALLAPPS = 3;
-
private final static int MAXIMUM_VIEW_HIERARCHY_LEVEL = 5;
- public interface LogStateProvider {
- int getCurrentState();
- }
-
/**
* Implemented by containers to provide a container source for a given child.
*/
@@ -61,20 +46,4 @@
}
return null;
}
-
- public static int getContainerTypeFromState(int state) {
- int containerType = DEFAULT_CONTAINERTYPE;
- switch (state) {
- case StatsLogUtils.LAUNCHER_STATE_ALLAPPS:
- containerType = ContainerType.ALLAPPS;
- break;
- case StatsLogUtils.LAUNCHER_STATE_HOME:
- containerType = ContainerType.WORKSPACE;
- break;
- case StatsLogUtils.LAUNCHER_STATE_OVERVIEW:
- containerType = ContainerType.OVERVIEW;
- break;
- }
- return containerType;
- }
}
diff --git a/src/com/android/launcher3/states/SpringLoadedState.java b/src/com/android/launcher3/states/SpringLoadedState.java
index f0e0557..2a4f887 100644
--- a/src/com/android/launcher3/states/SpringLoadedState.java
+++ b/src/com/android/launcher3/states/SpringLoadedState.java
@@ -35,7 +35,7 @@
| FLAG_HIDE_BACK_BUTTON;
public SpringLoadedState(int id) {
- super(id, ContainerType.OVERVIEW, STATE_FLAGS);
+ super(id, ContainerType.WORKSPACE, STATE_FLAGS);
}
@Override
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 171c5ee..3c78b08 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -21,6 +21,8 @@
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.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;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_ATOMIC_OVERVIEW_SCALE;
import static com.android.launcher3.states.StateAnimationConfig.PLAY_NON_ATOMIC;
@@ -42,12 +44,14 @@
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
+import com.android.launcher3.logger.LauncherAtom;
+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;
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;
@@ -298,11 +302,11 @@
public boolean onDrag(float displacement, MotionEvent ev) {
if (!mIsLogContainerSet) {
if (mStartState == ALL_APPS) {
- mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS;
+ mStartContainerType = ContainerType.ALLAPPS;
} else if (mStartState == NORMAL) {
mStartContainerType = getLogContainerTypeForNormalState(ev);
} else if (mStartState == OVERVIEW) {
- mStartContainerType = LauncherLogProto.ContainerType.TASKSWITCHER;
+ mStartContainerType = ContainerType.TASKSWITCHER;
}
mIsLogContainerSet = true;
}
@@ -559,10 +563,22 @@
// Transition complete. log the action
mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
getDirectionForLog(), mDetector.getDownX(), mDetector.getDownY(),
- mStartContainerType,
- mStartState.containerType,
+ 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))
+ .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
+ .setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setPageIndex(mLauncher.getWorkspace().getCurrentPage()))
+ .build())
+ .log(StatsLogManager.getLauncherAtomEvent(mStartState.containerType,
+ targetState.containerType, mToState.ordinal > mFromState.ordinal
+ ? LAUNCHER_UNKNOWN_SWIPEUP
+ : LAUNCHER_UNKNOWN_SWIPEDOWN));
}
protected void clearState() {