diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto index 7c648b6d88..823c821c7d 100644 --- a/protos/launcher_atom.proto +++ b/protos/launcher_atom.proto @@ -121,6 +121,20 @@ message SettingsContainer { } message TaskSwitcherContainer { + /** + * Indicates the current OrientationHandler in use in Overview. + * In fake landscape, the value will be + * {@link com.android.quickstep.orientation.LandscapePagedViewHandler} and in real landscape, + * the value will be {@link com.android.quickstep.orientation.PortraitPagedViewHandler} for + * example. + */ + optional OrientationHandler orientation_handler = 1; + + enum OrientationHandler { + PORTRAIT = 0; + LANDSCAPE = 1; + SEASCAPE = 2; + } } // Container for taskbar. diff --git a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java index 72aaa9000a..0c499b8bc6 100644 --- a/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java +++ b/quickstep/src/com/android/launcher3/QuickstepTransitionManager.java @@ -375,7 +375,7 @@ public class QuickstepTransitionManager implements OnDeviceProfileChangeListener */ protected boolean isLaunchingFromRecents(@NonNull View v, @Nullable RemoteAnimationTarget[] targets) { - return mLauncher.getStateManager().getState().overviewUi + return mLauncher.getStateManager().getState().isRecentsViewVisible && findTaskViewToLaunch(mLauncher.getOverviewPanel(), v, targets) != null; } diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java index 9eabb55897..d49d573456 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java +++ b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.java @@ -190,7 +190,7 @@ public class DesktopVisibilityController { } setBackgroundStateEnabled(state == BACKGROUND_APP); // Desktop visibility tracks overview and background state separately - setOverviewStateEnabled(state != BACKGROUND_APP && state.overviewUi); + setOverviewStateEnabled(state != BACKGROUND_APP && state.isRecentsViewVisible); } private void setOverviewStateEnabled(boolean overviewStateEnabled) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java index d516d873ca..ead1a8a441 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarLauncherStateController.java @@ -669,7 +669,7 @@ public class TaskbarLauncherStateController { } boolean isInOverviewUi() { - return mLauncherState.overviewUi; + return mLauncherState.isRecentsViewVisible; } private void playStateTransitionAnim(AnimatorSet animatorSet, long duration, diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index 2eced74849..14d391ba1c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -71,7 +71,7 @@ public abstract class BaseRecentsViewStateController ADJACENT_PAGE_HORIZONTAL_OFFSET.set(mRecentsView, scaleAndOffset[1]); TASK_SECONDARY_TRANSLATION.set(mRecentsView, 0f); - getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); + getContentAlphaProperty().set(mRecentsView, state.isRecentsViewVisible ? 1f : 0); getTaskModalnessProperty().set(mRecentsView, state.getOverviewModalness()); RECENTS_GRID_PROGRESS.set(mRecentsView, state.displayOverviewTasksAsGrid(mLauncher.getDeviceProfile()) ? 1f : 0f); @@ -109,7 +109,8 @@ public abstract class BaseRecentsViewStateController setter.setFloat(mRecentsView, TASK_SECONDARY_TRANSLATION, 0f, config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR)); - boolean exitingOverview = !FeatureFlags.enableSplitContextually() && !toState.overviewUi; + boolean exitingOverview = + !FeatureFlags.enableSplitContextually() && !toState.isRecentsViewVisible; if (mRecentsView.isSplitSelectionActive() && exitingOverview) { setter.add(mRecentsView.getSplitSelectController().getSplitAnimationController() .createPlaceholderDismissAnim(mLauncher, LAUNCHER_SPLIT_SELECTION_EXIT_HOME, @@ -124,7 +125,8 @@ public abstract class BaseRecentsViewStateController ); } - setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, + setter.setFloat(mRecentsView, getContentAlphaProperty(), + toState.isRecentsViewVisible ? 1 : 0, config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); setter.setFloat( @@ -145,7 +147,7 @@ public abstract class BaseRecentsViewStateController private Interpolator getOverviewInterpolator(LauncherState fromState, LauncherState toState) { return fromState == QUICK_SWITCH_FROM_HOME ? ACCELERATE_DECELERATE - : toState.overviewUi ? INSTANT : FINAL_FRAME; + : toState.isRecentsViewVisible ? INSTANT : FINAL_FRAME; } abstract FloatProperty getTaskModalnessProperty(); diff --git a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java index b1bb198dff..efcc7d31d8 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java +++ b/quickstep/src/com/android/launcher3/uioverrides/QuickstepLauncher.java @@ -1477,4 +1477,9 @@ public class QuickstepLauncher extends Launcher implements RecentsViewContainer } return super.onCreateView(parent, name, context, attrs); } + + @Override + public boolean isRecentsViewVisible() { + return getStateManager().getState().isRecentsViewVisible; + } } diff --git a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index e02ec41aff..235ec7b101 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -67,7 +67,7 @@ public final class RecentsViewStateController extends @Override public void setState(@NonNull LauncherState state) { super.setState(state); - if (state.overviewUi) { + if (state.isRecentsViewVisible) { mRecentsView.updateEmptyMessage(); } else { mRecentsView.resetTaskVisuals(); @@ -76,7 +76,7 @@ public final class RecentsViewStateController extends mRecentsView.setFullscreenProgress(state.getOverviewFullscreenProgress()); // In Overview, we may be layering app surfaces behind Launcher, so we need to notify // DepthController to prevent optimizations which might occlude the layers behind - mLauncher.getDepthController().setHasContentBehindLauncher(state.overviewUi); + mLauncher.getDepthController().setHasContentBehindLauncher(state.isRecentsViewVisible); PendingAnimation builder = new PendingAnimation(state.getTransitionDuration(mLauncher, true)); @@ -89,7 +89,7 @@ public final class RecentsViewStateController extends @NonNull StateAnimationConfig config, @NonNull PendingAnimation builder) { super.setStateWithAnimationInternal(toState, config, builder); - if (toState.overviewUi) { + if (toState.isRecentsViewVisible) { // While animating into recents, update the visible task data as needed builder.addOnFrameCallback(() -> mRecentsView.loadVisibleTaskData(FLAG_UPDATE_ALL)); mRecentsView.updateEmptyMessage(); @@ -107,7 +107,8 @@ public final class RecentsViewStateController extends // In Overview, we may be layering app surfaces behind Launcher, so we need to notify // DepthController to prevent optimizations which might occlude the layers behind builder.addListener(AnimatorListeners.forSuccessCallback(() -> - mLauncher.getDepthController().setHasContentBehindLauncher(toState.overviewUi))); + mLauncher.getDepthController().setHasContentBehindLauncher( + toState.isRecentsViewVisible))); handleSplitSelectionState(toState, builder, /* animate */true); diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java index 7fa121dadb..262564613a 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java @@ -34,7 +34,7 @@ import com.android.quickstep.views.RecentsView; */ public class BackgroundAppState extends OverviewState { - private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI + private static final int STATE_FLAGS = FLAG_DISABLE_RESTORE | FLAG_RECENTS_VIEW_VISIBLE | FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS; public BackgroundAppState(int id) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 3c291e6095..932d241307 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -32,7 +32,7 @@ import com.android.quickstep.views.RecentsView; public class OverviewModalTaskState extends OverviewState { private static final int STATE_FLAGS = - FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE; + FLAG_DISABLE_RESTORE | FLAG_RECENTS_VIEW_VISIBLE | FLAG_WORKSPACE_INACCESSIBLE; public OverviewModalTaskState(int id) { super(id, LAUNCHER_STATE_OVERVIEW, STATE_FLAGS); diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java index d0eef8e3bb..7173298d19 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/states/OverviewState.java @@ -47,7 +47,7 @@ public class OverviewState extends LauncherState { protected static final Rect sTempRect = new Rect(); private static final int STATE_FLAGS = FLAG_WORKSPACE_ICONS_CAN_BE_DRAGGED - | FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE + | FLAG_DISABLE_RESTORE | FLAG_RECENTS_VIEW_VISIBLE | FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS; public OverviewState(int id) { diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java index 3ed2d0bdb8..11e0ed528c 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/NavBarToHomeTouchController.java @@ -118,7 +118,7 @@ public class NavBarToHomeTouchController implements TouchController, if (!cameFromNavBar) { return false; } - if (mStartState.overviewUi || mStartState == ALL_APPS) { + if (mStartState.isRecentsViewVisible || mStartState == ALL_APPS) { return true; } int typeToClose = TYPE_ALL & ~TYPE_ALL_APPS_EDU; @@ -145,7 +145,7 @@ public class NavBarToHomeTouchController implements TouchController, private void initCurrentAnimation() { long accuracy = (long) (getShiftRange() * 2); final PendingAnimation builder = new PendingAnimation(accuracy); - if (mStartState.overviewUi) { + if (mStartState.isRecentsViewVisible) { RecentsView recentsView = mLauncher.getOverviewPanel(); AnimatorControllerWithResistance.createRecentsResistanceFromOverviewAnim(mLauncher, builder); @@ -194,7 +194,7 @@ public class NavBarToHomeTouchController implements TouchController, RecentsView recentsView = mLauncher.getOverviewPanel(); recentsView.switchToScreenshot(null, () -> recentsView.finishRecentsAnimation(true /* toRecents */, null)); - if (mStartState.overviewUi) { + if (mStartState.isRecentsViewVisible) { Runnable onReachedHome = () -> { StateManager.StateListener listener = new StateManager.StateListener<>() { diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java index 28ae3d2ff7..94de1e00d5 100644 --- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java @@ -1474,7 +1474,8 @@ public abstract class AbsSwipeUpHandler interactionHandler.onGestureEnded(0, new PointF())); cmd.removeListener(this); @@ -420,6 +427,33 @@ public class OverviewCommandHelper { return true; } + private & RecentsViewContainer> + void logShowOverviewFrom(int cmdType) { + BaseActivityInterface activityInterface = + mOverviewComponentObserver.getActivityInterface(); + var container = activityInterface.getCreatedContainer(); + if (container != null) { + StatsLogManager.LauncherEvent event; + switch (cmdType) { + case TYPE_SHOW -> event = LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_SHORTCUT; + case TYPE_HIDE -> + event = LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_QUICK_SWITCH; + case TYPE_TOGGLE -> event = LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_3_BUTTON; + default -> { + return; + } + } + + StatsLogManager.newInstance(container.asContext()) + .logger() + .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() + .setTaskSwitcherContainer( + LauncherAtom.TaskSwitcherContainer.getDefaultInstance()) + .build()) + .log(event); + } + } + public void dump(PrintWriter pw) { pw.println("OverviewCommandHelper:"); pw.println(" mPendingCommands=" + mPendingCommands.size()); diff --git a/quickstep/src/com/android/quickstep/RecentsActivity.java b/quickstep/src/com/android/quickstep/RecentsActivity.java index f57f4c8440..97a0b3fd23 100644 --- a/quickstep/src/com/android/quickstep/RecentsActivity.java +++ b/quickstep/src/com/android/quickstep/RecentsActivity.java @@ -33,7 +33,6 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.app.ActivityOptions; -import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; @@ -507,4 +506,9 @@ public final class RecentsActivity extends StatefulActivity implem public TISBindHelper getTISBindHelper() { return mTISBindHelper; } + + @Override + public boolean isRecentsViewVisible() { + return getStateManager().getState().isRecentsViewVisible(); + } } diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java index 644e4f9704..94764a58cc 100644 --- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java +++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsStateController.java @@ -136,7 +136,7 @@ public class FallbackRecentsStateController implements StateHandler { private static final int FLAG_SHOW_AS_GRID = BaseState.getFlag(4); private static final int FLAG_SCRIM = BaseState.getFlag(5); private static final int FLAG_LIVE_TILE = BaseState.getFlag(6); - private static final int FLAG_OVERVIEW_UI = BaseState.getFlag(7); + private static final int FLAG_RECENTS_VIEW_VISIBLE = BaseState.getFlag(7); private static final int FLAG_TASK_THUMBNAIL_SPLASH = BaseState.getFlag(8); public static final RecentsState DEFAULT = new RecentsState(0, FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_SHOW_AS_GRID - | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_OVERVIEW_UI); + | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE); public static final RecentsState MODAL_TASK = new ModalState(1, FLAG_DISABLE_RESTORE | FLAG_CLEAR_ALL_BUTTON | FLAG_OVERVIEW_ACTIONS | FLAG_MODAL - | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_OVERVIEW_UI); + | FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_LIVE_TILE | FLAG_RECENTS_VIEW_VISIBLE); public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2, - FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN | FLAG_OVERVIEW_UI + FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN + | FLAG_RECENTS_VIEW_VISIBLE | FLAG_TASK_THUMBNAIL_SPLASH); public static final RecentsState HOME = new RecentsState(3, 0); public static final RecentsState BG_LAUNCHER = new LauncherState(4, 0); public static final RecentsState OVERVIEW_SPLIT_SELECT = new RecentsState(5, - FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_OVERVIEW_UI | FLAG_CLOSE_POPUPS + FLAG_SHOW_AS_GRID | FLAG_SCRIM | FLAG_RECENTS_VIEW_VISIBLE | FLAG_CLOSE_POPUPS | FLAG_DISABLE_RESTORE); public final int ordinal; @@ -152,8 +152,8 @@ public class RecentsState implements BaseState { /** * True if the state has overview panel visible. */ - public boolean overviewUi() { - return hasFlag(FLAG_OVERVIEW_UI); + public boolean isRecentsViewVisible() { + return hasFlag(FLAG_RECENTS_VIEW_VISIBLE); } private static class ModalState extends RecentsState { diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index 3cae4dcbe4..1d4160d600 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -16,6 +16,10 @@ package com.android.quickstep.logging; +import static android.view.Surface.ROTATION_180; +import static android.view.Surface.ROTATION_270; +import static android.view.Surface.ROTATION_90; + import static androidx.core.util.Preconditions.checkNotNull; import static androidx.core.util.Preconditions.checkState; @@ -26,10 +30,17 @@ import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerC import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.SEARCH_RESULT_CONTAINER; import static com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers.ContainerCase.DEVICE_SEARCH_RESULT_CONTAINER; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_SNAPSHOT; +import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_0; +import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_90; +import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_180; +import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_270; import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__ALLAPPS; 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__RECENTS_ORIENTATION_HANDLER__PORTRAIT; +import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__RECENTS_ORIENTATION_HANDLER__LANDSCAPE; +import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__RECENTS_ORIENTATION_HANDLER__SEASCAPE; import android.content.Context; import android.text.TextUtils; @@ -59,6 +70,7 @@ import com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers; import com.android.launcher3.logging.InstanceId; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.model.data.ItemInfo; +import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.Executors; import com.android.launcher3.util.LogConfig; import com.android.launcher3.views.ActivityContext; @@ -226,10 +238,15 @@ public class StatsLogCompatManager extends StatsLogManager { private int mInputType = SysUiStatsLog.LAUNCHER_UICHANGED__INPUT_TYPE__UNKNOWN; private Optional mFeatures = Optional.empty(); private Optional mPackageName = Optional.empty(); + /** + * Indicates the current rotation of the display. Uses {@link android.view.Surface values.} + */ + private final int mDisplayRotation; StatsCompatLogger(Context context, ActivityContext activityContext) { mContext = context; mActivityContext = Optional.ofNullable(activityContext); + mDisplayRotation = DisplayController.INSTANCE.get(mContext).getInfo().rotation; } @Override @@ -502,7 +519,28 @@ public class StatsLogCompatManager extends StatsLogManager { getSearchAttributes(atomInfo) /* searchAttributes */, getAttributes(atomInfo) /* attributes */, inputType /* input_type */, - atomInfo.getUserType() /* user_type */); + atomInfo.getUserType() /* user_type */, + getDisplayRotation() /* display_rotation */, + getRecentsOrientationHandler(atomInfo) /* recents_orientation_handler */); + } + + private int getDisplayRotation() { + return switch (mDisplayRotation) { + case ROTATION_90 -> LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_90; + case ROTATION_180 -> LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_180; + case ROTATION_270 -> LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_270; + default -> LAUNCHER_UICHANGED__DISPLAY_ROTATION__ROTATION_0; + }; + } + + private int getRecentsOrientationHandler(LauncherAtom.ItemInfo itemInfo) { + var orientationHandler = + itemInfo.getContainerInfo().getTaskSwitcherContainer().getOrientationHandler(); + return switch (orientationHandler) { + case PORTRAIT -> LAUNCHER_UICHANGED__RECENTS_ORIENTATION_HANDLER__PORTRAIT; + case LANDSCAPE -> LAUNCHER_UICHANGED__RECENTS_ORIENTATION_HANDLER__LANDSCAPE; + case SEASCAPE -> LAUNCHER_UICHANGED__RECENTS_ORIENTATION_HANDLER__SEASCAPE; + }; } } diff --git a/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt b/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt index 164010472a..8f8cc6eeb7 100644 --- a/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt +++ b/quickstep/src/com/android/quickstep/orientation/LandscapePagedViewHandler.kt @@ -42,6 +42,7 @@ import com.android.launcher3.Flags import com.android.launcher3.LauncherAnimUtils import com.android.launcher3.R import com.android.launcher3.Utilities +import com.android.launcher3.logger.LauncherAtom.TaskSwitcherContainer import com.android.launcher3.touch.PagedOrientationHandler.ChildBounds import com.android.launcher3.touch.PagedOrientationHandler.Float2DAction import com.android.launcher3.touch.PagedOrientationHandler.Int2DAction @@ -611,6 +612,9 @@ open class LandscapePagedViewHandler : RecentsPagedOrientationHandler { override fun getFloatingTaskPrimaryTranslation(floatingTask: View, dp: DeviceProfile): Float = floatingTask.translationY + override fun getHandlerTypeForLogging(): TaskSwitcherContainer.OrientationHandler = + TaskSwitcherContainer.OrientationHandler.LANDSCAPE + /** * Retrieves split icons position * diff --git a/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.java b/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.java index 1be908be10..f6284d55e6 100644 --- a/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.java +++ b/quickstep/src/com/android/quickstep/orientation/PortraitPagedViewHandler.java @@ -46,9 +46,12 @@ import android.view.View; import android.widget.FrameLayout; import android.widget.LinearLayout; +import androidx.annotation.NonNull; + import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.touch.DefaultPagedViewHandler; import com.android.launcher3.touch.SingleAxisSwipeDetector; import com.android.launcher3.util.SplitConfigurationOptions; @@ -802,4 +805,10 @@ public class PortraitPagedViewHandler extends DefaultPagedViewHandler implements ? floatingTask.getTranslationX() : floatingTask.getTranslationY(); } + + @NonNull + @Override + public LauncherAtom.TaskSwitcherContainer.OrientationHandler getHandlerTypeForLogging() { + return LauncherAtom.TaskSwitcherContainer.OrientationHandler.PORTRAIT; + } } diff --git a/quickstep/src/com/android/quickstep/orientation/RecentsPagedOrientationHandler.kt b/quickstep/src/com/android/quickstep/orientation/RecentsPagedOrientationHandler.kt index 6c82890f73..5bc1be8a19 100644 --- a/quickstep/src/com/android/quickstep/orientation/RecentsPagedOrientationHandler.kt +++ b/quickstep/src/com/android/quickstep/orientation/RecentsPagedOrientationHandler.kt @@ -26,6 +26,7 @@ import android.view.View import android.widget.FrameLayout import android.widget.LinearLayout import com.android.launcher3.DeviceProfile +import com.android.launcher3.logger.LauncherAtom import com.android.launcher3.touch.PagedOrientationHandler import com.android.launcher3.touch.PagedOrientationHandler.Float2DAction import com.android.launcher3.touch.PagedOrientationHandler.Int2DAction @@ -371,6 +372,8 @@ interface RecentsPagedOrientationHandler : PagedOrientationHandler { */ fun getFloatingTaskPrimaryTranslation(floatingTask: View, dp: DeviceProfile): Float + fun getHandlerTypeForLogging(): LauncherAtom.TaskSwitcherContainer.OrientationHandler + companion object { @JvmField val PORTRAIT: RecentsPagedOrientationHandler = PortraitPagedViewHandler() @JvmField val LANDSCAPE: RecentsPagedOrientationHandler = LandscapePagedViewHandler() diff --git a/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt b/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt index 5bebf8c8be..46e4b0c30c 100644 --- a/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt +++ b/quickstep/src/com/android/quickstep/orientation/SeascapePagedViewHandler.kt @@ -32,6 +32,7 @@ import com.android.launcher3.DeviceProfile import com.android.launcher3.Flags import com.android.launcher3.R import com.android.launcher3.Utilities +import com.android.launcher3.logger.LauncherAtom import com.android.launcher3.touch.SingleAxisSwipeDetector import com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT import com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT @@ -395,4 +396,8 @@ class SeascapePagedViewHandler : LandscapePagedViewHandler() { iconView.layoutParams = layoutParams } } + + @Override + override fun getHandlerTypeForLogging(): LauncherAtom.TaskSwitcherContainer.OrientationHandler = + LauncherAtom.TaskSwitcherContainer.OrientationHandler.SEASCAPE } diff --git a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java index 8d1907ff7d..f6bae9b18c 100644 --- a/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/src/com/android/quickstep/views/LauncherRecentsView.java @@ -143,7 +143,7 @@ public class LauncherRecentsView extends RecentsView mContainer.getDisplay().getRotation()); - mOrientationState.setRecentsRotation(rotation); + // Log real orientation change. + if (mOrientationState.setRecentsRotation(rotation)) { + logOrientationChanged(); + } } public void setLayoutRotation(int touchRotation, int displayRotation) { @@ -6301,6 +6311,24 @@ public abstract class RecentsView recentsView = getOverviewPanel(); + var orientationForLogging = + recentsView.getPagedOrientationHandler().getHandlerTypeForLogging(); + itemInfoBuilder.setContainerInfo( + LauncherAtom.ContainerInfo.newBuilder() + .setTaskSwitcherContainer( + LauncherAtom.TaskSwitcherContainer.newBuilder() + .setOrientationHandler(orientationForLogging)) + .build()); + } } diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index 3bdd8635cf..72a3c53c7b 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -83,7 +83,7 @@ public abstract class LauncherState implements BaseState { public static final int FLAG_HAS_SYS_UI_SCRIM = BaseState.getFlag(4); // Flag to inticate that all popups should be closed when this state is enabled. public static final int FLAG_CLOSE_POPUPS = BaseState.getFlag(5); - public static final int FLAG_OVERVIEW_UI = BaseState.getFlag(6); + public static final int FLAG_RECENTS_VIEW_VISIBLE = BaseState.getFlag(6); // Flag indicating that hotseat and its contents are not accessible. public static final int FLAG_HOTSEAT_INACCESSIBLE = BaseState.getFlag(7); @@ -158,14 +158,14 @@ public abstract class LauncherState implements BaseState { /** * True if the state has overview panel visible. */ - public final boolean overviewUi; + public final boolean isRecentsViewVisible; private final int mFlags; public LauncherState(int id, int statsLogOrdinal, int flags) { this.statsLogOrdinal = statsLogOrdinal; this.mFlags = flags; - this.overviewUi = (flags & FLAG_OVERVIEW_UI) != 0; + this.isRecentsViewVisible = (flags & FLAG_RECENTS_VIEW_VISIBLE) != 0; this.ordinal = id; sAllStates[id] = this; } diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 25eeacb189..861631dbed 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -781,7 +781,19 @@ public class StatsLogManager implements ResourceBasedOverride { LAUNCHER_PRIVATE_SPACE_UNLOCK_ANIMATION_BEGIN(1727), @UiEvent(doc = "Private space unlock animation finished") - LAUNCHER_PRIVATE_SPACE_UNLOCK_ANIMATION_END(1728) + LAUNCHER_PRIVATE_SPACE_UNLOCK_ANIMATION_END(1728), + + @UiEvent(doc = "User rotates whilst in Overview / RecentsView") + LAUNCHER_OVERVIEW_ORIENTATION_CHANGED(1762), + + @UiEvent(doc = "User launches Overview from 3 button navigation") + LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_3_BUTTON(1763), + + @UiEvent(doc = "User launches Overview from alt+tab keyboard quick switch") + LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_QUICK_SWITCH(1764), + + @UiEvent(doc = "User launches Overview from meta+tab keyboard shortcut") + LAUNCHER_OVERVIEW_SHOW_OVERVIEW_FROM_KEYBOARD_SHORTCUT(1765), // ADD MORE ; diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index 50f98f297b..3817563b0b 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -411,17 +411,29 @@ public abstract class AbstractStateChangeTouchController mLauncher.getStatsLogManager().logger() .withSrcState(mStartState.statsLogOrdinal) .withDstState(targetState.statsLogOrdinal) - .withContainerInfo(LauncherAtom.ContainerInfo.newBuilder() - .setWorkspace( - LauncherAtom.WorkspaceContainer.newBuilder() - .setPageIndex(mLauncher.getWorkspace().getCurrentPage())) - .build()) + .withContainerInfo(getContainerInfo(targetState)) .log(StatsLogManager.getLauncherAtomEvent(mStartState.statsLogOrdinal, targetState.statsLogOrdinal, mToState.ordinal > mFromState.ordinal ? LAUNCHER_UNKNOWN_SWIPEUP : LAUNCHER_UNKNOWN_SWIPEDOWN)); } + private LauncherAtom.ContainerInfo getContainerInfo(LauncherState targetState) { + if (targetState.isRecentsViewVisible) { + return LauncherAtom.ContainerInfo.newBuilder() + .setTaskSwitcherContainer( + LauncherAtom.TaskSwitcherContainer.getDefaultInstance() + ) + .build(); + } + + return LauncherAtom.ContainerInfo.newBuilder() + .setWorkspace( + LauncherAtom.WorkspaceContainer.newBuilder() + .setPageIndex(mLauncher.getWorkspace().getCurrentPage())) + .build(); + } + protected void clearState() { cancelAnimationControllers(); mGoingBetweenStates = true;