Log split metrics through individual sessions
* Now we log the original source of the first selected app as soon as the user selects it (previously we only did when user selected second app) * We log the item info for the second app to determine second surface. * Added new metrics to log after user has started a split session and ended a split session * We log different cancellation reasons (cancel button, home gesture, general other app interruptions, etc). * One KI/Bug: When the second app is selected via taskbar in overview, the container will say hotseat because we are using Launcher's logger and not Taskbar's. Taskbar's logger manually overwrites the container in TaskbarActivityContext, we may be able to make something hacky that can allow us to overwrite, but that'll have to be a separate change Bug: 322551862 Test: Logged metrics manually with event and itemInfo Change-Id: I177623fd00ce62acf2d4ee983b58561d8c946d59
This commit is contained in:
1 parent
9ac91ffa63
commit
5a9d4af170
17 files changed
+182
-62
No files matched your search
@@ -162,10 +162,10 @@ public class AppPairsController {
|
||||
|
||||
@Nullable Task foundTask2 = foundTasks[1];
|
||||
if (foundTask2 != null) {
|
||||
mSplitSelectStateController.setSecondTask(foundTask2);
|
||||
mSplitSelectStateController.setSecondTask(foundTask2, app2);
|
||||
} else {
|
||||
mSplitSelectStateController.setSecondTask(
|
||||
app2.intent, app2.user);
|
||||
app2.intent, app2.user, app2);
|
||||
}
|
||||
|
||||
mSplitSelectStateController.setLaunchingIconView(appPairIcon);
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.android.launcher3.Utilities
|
||||
import com.android.launcher3.anim.PendingAnimation
|
||||
import com.android.launcher3.apppairs.AppPairIcon
|
||||
import com.android.launcher3.config.FeatureFlags
|
||||
import com.android.launcher3.logging.StatsLogManager.EventEnum
|
||||
import com.android.launcher3.statehandlers.DepthController
|
||||
import com.android.launcher3.statemanager.StateManager
|
||||
import com.android.launcher3.statemanager.StatefulActivity
|
||||
@@ -213,17 +214,21 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
}
|
||||
|
||||
/** Does not play any animation if user is not currently in split selection state. */
|
||||
fun playPlaceholderDismissAnim(launcher: StatefulActivity<*>) {
|
||||
fun playPlaceholderDismissAnim(launcher: StatefulActivity<*>, splitDismissEvent: EventEnum) {
|
||||
if (!splitSelectStateController.isSplitSelectActive) {
|
||||
return
|
||||
}
|
||||
|
||||
val anim = createPlaceholderDismissAnim(launcher)
|
||||
val anim = createPlaceholderDismissAnim(launcher, splitDismissEvent)
|
||||
anim.start()
|
||||
}
|
||||
|
||||
/** Returns [AnimatorSet] which slides initial split placeholder view offscreen. */
|
||||
fun createPlaceholderDismissAnim(launcher: StatefulActivity<*>) : AnimatorSet {
|
||||
/**
|
||||
* Returns [AnimatorSet] which slides initial split placeholder view offscreen and logs an event
|
||||
* for why split is being dismissed
|
||||
*/
|
||||
fun createPlaceholderDismissAnim(launcher: StatefulActivity<*>,
|
||||
splitDismissEvent: EventEnum) : AnimatorSet {
|
||||
val animatorSet = AnimatorSet()
|
||||
val recentsView : RecentsView<*, *> = launcher.getOverviewPanel()
|
||||
val floatingTask: FloatingTaskView = splitSelectStateController.firstFloatingTaskView
|
||||
@@ -260,6 +265,7 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
splitSelectStateController.splitInstructionsView)
|
||||
}
|
||||
})
|
||||
splitSelectStateController.logExitReason(splitDismissEvent)
|
||||
return animatorSet
|
||||
}
|
||||
|
||||
|
||||
@@ -87,6 +87,7 @@ class SplitSelectDataHolder(
|
||||
@StagePosition
|
||||
private var initialStagePosition: Int = STAGE_POSITION_UNDEFINED
|
||||
private var itemInfo: ItemInfo? = null
|
||||
private var secondItemInfo: ItemInfo? = null
|
||||
private var splitEvent: EventEnum? = null
|
||||
|
||||
private var initialTaskId: Int = INVALID_TASK_ID
|
||||
@@ -144,8 +145,9 @@ class SplitSelectDataHolder(
|
||||
* To be called as soon as user selects the second task (even if animations aren't complete)
|
||||
* @param taskId The second task that will be launched.
|
||||
*/
|
||||
fun setSecondTask(taskId: Int) {
|
||||
fun setSecondTask(taskId: Int, itemInfo: ItemInfo) {
|
||||
secondTaskId = taskId
|
||||
secondItemInfo = itemInfo
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,9 +155,10 @@ class SplitSelectDataHolder(
|
||||
* @param intent The second intent that will be launched.
|
||||
* @param user The user of that intent.
|
||||
*/
|
||||
fun setSecondTask(intent: Intent, user: UserHandle) {
|
||||
fun setSecondTask(intent: Intent, user: UserHandle, itemInfo: ItemInfo) {
|
||||
secondIntent = intent
|
||||
secondUser = user
|
||||
secondItemInfo = itemInfo
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,9 +166,10 @@ class SplitSelectDataHolder(
|
||||
* Sets [secondUser] from that of the pendingIntent
|
||||
* @param pendingIntent The second PendingIntent that will be launched.
|
||||
*/
|
||||
fun setSecondTask(pendingIntent: PendingIntent) {
|
||||
fun setSecondTask(pendingIntent: PendingIntent, itemInfo: ItemInfo) {
|
||||
secondPendingIntent = pendingIntent
|
||||
secondUser = pendingIntent.creatorUserHandle
|
||||
secondItemInfo = itemInfo
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -173,8 +177,8 @@ class SplitSelectDataHolder(
|
||||
* an extra intent from their RemoteResponse.
|
||||
* See [android.widget.RemoteViews.RemoteResponse.getLaunchOptions].first
|
||||
*/
|
||||
fun setSecondWidget(pendingIntent: PendingIntent, widgetIntent: Intent?) {
|
||||
setSecondTask(pendingIntent)
|
||||
fun setSecondWidget(pendingIntent: PendingIntent, widgetIntent: Intent?, itemInfo: ItemInfo) {
|
||||
setSecondTask(pendingIntent, itemInfo)
|
||||
widgetSecondIntent = widgetIntent
|
||||
}
|
||||
|
||||
@@ -407,6 +411,10 @@ class SplitSelectDataHolder(
|
||||
return itemInfo
|
||||
}
|
||||
|
||||
fun getSecondItemInfo(): ItemInfo? {
|
||||
return secondItemInfo
|
||||
}
|
||||
|
||||
private fun isSecondTaskIntentSet(): Boolean {
|
||||
return secondTaskId != INVALID_TASK_ID || secondIntent != null
|
||||
|| secondPendingIntent != null
|
||||
|
||||
@@ -19,6 +19,10 @@ package com.android.quickstep.util;
|
||||
import static com.android.launcher3.Utilities.postAsyncCallback;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_DESKTOP_MODE_SPLIT_LEFT_TOP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_DESKTOP_MODE_SPLIT_RIGHT_BOTTOM;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTED_SECOND_APP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_COMPLETE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_HOME;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_INITIATED;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
@@ -151,6 +155,11 @@ public class SplitSelectStateController {
|
||||
private SplitInstructionsView mSplitInstructionsView;
|
||||
|
||||
private final List<SplitSelectionListener> mSplitSelectionListeners = new ArrayList<>();
|
||||
/**
|
||||
* Tracks metrics from when first app is selected to split launch or cancellation. This also
|
||||
* gets passed over to shell when attempting to invoke split.
|
||||
*/
|
||||
private Pair<InstanceId, com.android.launcher3.logging.InstanceId> mSessionInstanceIds;
|
||||
|
||||
private final BackPressHandler mSplitBackHandler = new BackPressHandler() {
|
||||
@Override
|
||||
@@ -162,7 +171,8 @@ public class SplitSelectStateController {
|
||||
public void onBackInvoked() {
|
||||
// When exiting from split selection, leave current context to go to
|
||||
// homescreen as well
|
||||
getSplitAnimationController().playPlaceholderDismissAnim(mContext);
|
||||
getSplitAnimationController().playPlaceholderDismissAnim(mContext,
|
||||
LAUNCHER_SPLIT_SELECTION_EXIT_HOME);
|
||||
if (mActivityBackCallback != null) {
|
||||
mActivityBackCallback.run();
|
||||
}
|
||||
@@ -203,6 +213,7 @@ public class SplitSelectStateController {
|
||||
int alreadyRunningTask) {
|
||||
mSplitSelectDataHolder.setInitialTaskSelect(intent, stagePosition, itemInfo, splitEvent,
|
||||
alreadyRunningTask);
|
||||
createAndLogInstanceIdsForSession();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -213,6 +224,7 @@ public class SplitSelectStateController {
|
||||
@StagePosition int stagePosition, @NonNull ItemInfo itemInfo,
|
||||
StatsLogManager.EventEnum splitEvent) {
|
||||
mSplitSelectDataHolder.setInitialTaskSelect(info, stagePosition, itemInfo, splitEvent);
|
||||
createAndLogInstanceIdsForSession();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,14 +342,12 @@ public class SplitSelectStateController {
|
||||
*/
|
||||
public void launchSplitTasks(@PersistentSnapPosition int snapPosition,
|
||||
@Nullable Consumer<Boolean> callback) {
|
||||
Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
|
||||
LogUtils.getShellShareableInstanceId();
|
||||
launchTasks(callback, false /* freezeTaskList */, snapPosition, instanceIds.first);
|
||||
launchTasks(callback, false /* freezeTaskList */, snapPosition, mSessionInstanceIds.first);
|
||||
|
||||
mStatsLogManager.logger()
|
||||
.withItemInfo(mSplitSelectDataHolder.getItemInfo())
|
||||
.withInstanceId(instanceIds.second)
|
||||
.log(mSplitSelectDataHolder.getSplitEvent());
|
||||
.withItemInfo(mSplitSelectDataHolder.getSecondItemInfo())
|
||||
.withInstanceId(mSessionInstanceIds.second)
|
||||
.log(LAUNCHER_SPLIT_SELECTED_SECOND_APP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,12 +373,27 @@ public class SplitSelectStateController {
|
||||
launchSplitTasks(SNAP_TO_50_50, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to log an event when user exists split selection when the second app **IS NOT** selected.
|
||||
* This must be called before playing any exit animations since most animations will call
|
||||
* {@link #resetState()} which removes {@link #mSessionInstanceIds}.
|
||||
*/
|
||||
public void logExitReason(StatsLogManager.EventEnum splitExitEvent) {
|
||||
StatsLogManager.StatsLogger logger = mStatsLogManager.logger();
|
||||
if (mSessionInstanceIds != null) {
|
||||
logger.withInstanceId(mSessionInstanceIds.second);
|
||||
} else {
|
||||
Log.w(TAG, "Missing session instanceIds");
|
||||
}
|
||||
logger.log(splitExitEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called as soon as user selects the second task (even if animations aren't complete)
|
||||
* @param task The second task that will be launched.
|
||||
*/
|
||||
public void setSecondTask(Task task) {
|
||||
mSplitSelectDataHolder.setSecondTask(task.key.id);
|
||||
public void setSecondTask(Task task, ItemInfo itemInfo) {
|
||||
mSplitSelectDataHolder.setSecondTask(task.key.id, itemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -376,20 +401,20 @@ public class SplitSelectStateController {
|
||||
* @param intent The second intent that will be launched.
|
||||
* @param user The user of that intent.
|
||||
*/
|
||||
public void setSecondTask(Intent intent, UserHandle user) {
|
||||
mSplitSelectDataHolder.setSecondTask(intent, user);
|
||||
public void setSecondTask(Intent intent, UserHandle user, ItemInfo itemInfo) {
|
||||
mSplitSelectDataHolder.setSecondTask(intent, user, itemInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* To be called as soon as user selects the second app (even if animations aren't complete)
|
||||
* @param pendingIntent The second PendingIntent that will be launched.
|
||||
*/
|
||||
public void setSecondTask(PendingIntent pendingIntent) {
|
||||
mSplitSelectDataHolder.setSecondTask(pendingIntent);
|
||||
public void setSecondTask(PendingIntent pendingIntent, ItemInfo itemInfo) {
|
||||
mSplitSelectDataHolder.setSecondTask(pendingIntent, itemInfo);
|
||||
}
|
||||
|
||||
public void setSecondWidget(PendingIntent pendingIntent, Intent widgetIntent) {
|
||||
mSplitSelectDataHolder.setSecondWidget(pendingIntent, widgetIntent);
|
||||
mSplitSelectDataHolder.setSecondWidget(pendingIntent, widgetIntent, null /*itemInfo*/);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -578,7 +603,7 @@ public class SplitSelectStateController {
|
||||
final RemoteTransition remoteTransition = new RemoteTransition(animationRunner,
|
||||
ActivityThread.currentActivityThread().getApplicationThread(),
|
||||
"LaunchAppFullscreen");
|
||||
InstanceId instanceId = LogUtils.getShellShareableInstanceId().first;
|
||||
InstanceId instanceId = mSessionInstanceIds.first;
|
||||
if (TaskAnimationManager.ENABLE_SHELL_TRANSITIONS) {
|
||||
switch (launchData.getSplitLaunchType()) {
|
||||
case SPLIT_SINGLE_TASK_FULLSCREEN -> mSystemUiProxy.startTasks(firstTaskId,
|
||||
@@ -630,6 +655,26 @@ public class SplitSelectStateController {
|
||||
ActivityThread.currentActivityThread().getApplicationThread());
|
||||
}
|
||||
|
||||
/**
|
||||
* Will initialize {@link #mSessionInstanceIds} if null and log the first split event from
|
||||
* {@link #mSplitSelectDataHolder}
|
||||
*/
|
||||
private void createAndLogInstanceIdsForSession() {
|
||||
if (mSessionInstanceIds != null) {
|
||||
Log.w(TAG, "SessionIds should be null");
|
||||
}
|
||||
// Log separately the start of the session and then the first app selected
|
||||
mSessionInstanceIds = LogUtils.getShellShareableInstanceId();
|
||||
mStatsLogManager.logger()
|
||||
.withInstanceId(mSessionInstanceIds.second)
|
||||
.log(LAUNCHER_SPLIT_SELECTION_INITIATED);
|
||||
|
||||
mStatsLogManager.logger()
|
||||
.withItemInfo(mSplitSelectDataHolder.getItemInfo())
|
||||
.withInstanceId(mSessionInstanceIds.second)
|
||||
.log(mSplitSelectDataHolder.getSplitEvent());
|
||||
}
|
||||
|
||||
public @StagePosition int getActiveSplitStagePosition() {
|
||||
return mSplitSelectDataHolder.getInitialStagePosition();
|
||||
}
|
||||
@@ -804,6 +849,13 @@ public class SplitSelectStateController {
|
||||
mFirstFloatingTaskView = null;
|
||||
mSplitInstructionsView = null;
|
||||
mLaunchingFirstAppFullscreen = false;
|
||||
|
||||
if (mSessionInstanceIds != null) {
|
||||
mStatsLogManager.logger()
|
||||
.withInstanceId(mSessionInstanceIds.second)
|
||||
.log(LAUNCHER_SPLIT_SELECTION_COMPLETE);
|
||||
}
|
||||
mSessionInstanceIds = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
import com.android.launcher3.icons.IconCache;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.PackageItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.quickstep.views.FloatingTaskView;
|
||||
@@ -134,7 +135,7 @@ public class SplitToWorkspaceController {
|
||||
return false;
|
||||
}
|
||||
|
||||
mController.setSecondTask(intent, user);
|
||||
mController.setSecondTask(intent, user, (ItemInfo) tag);
|
||||
|
||||
startWorkspaceAnimation(view, null /*bitmap*/, bitmapInfo.newIcon(mLauncher));
|
||||
return true;
|
||||
|
||||
@@ -25,6 +25,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_MODAL_TASK;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW_SPLIT_SELECT;
|
||||
import static com.android.launcher3.LauncherState.SPRING_LOADED;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_HOME;
|
||||
import static com.android.quickstep.views.DesktopTaskView.isDesktopModeSupported;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
@@ -92,7 +93,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
stateManager.goToState(NORMAL, animated);
|
||||
if (FeatureFlags.enableSplitContextually()) {
|
||||
mSplitSelectStateController.getSplitAnimationController()
|
||||
.playPlaceholderDismissAnim(mActivity);
|
||||
.playPlaceholderDismissAnim(mActivity, LAUNCHER_SPLIT_SELECTION_EXIT_HOME);
|
||||
}
|
||||
AbstractFloatingView.closeAllOpenViews(mActivity, animated);
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.desktop.DesktopRecentsTransitionController;
|
||||
import com.android.launcher3.icons.cache.HandlerRunnable;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.statemanager.BaseState;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
@@ -4793,7 +4794,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
* false otherwise
|
||||
*/
|
||||
public boolean confirmSplitSelect(TaskView containerTaskView, Task task, Drawable drawable,
|
||||
View secondView, @Nullable Bitmap thumbnail, Intent intent, UserHandle user) {
|
||||
View secondView, @Nullable Bitmap thumbnail, Intent intent, UserHandle user,
|
||||
ItemInfo itemInfo) {
|
||||
if (canLaunchFullscreenTask()) {
|
||||
return false;
|
||||
}
|
||||
@@ -4812,9 +4814,9 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
+ ") is not dockable / does not support splitscreen"));
|
||||
return true;
|
||||
}
|
||||
mSplitSelectStateController.setSecondTask(task);
|
||||
mSplitSelectStateController.setSecondTask(task, itemInfo);
|
||||
} else {
|
||||
mSplitSelectStateController.setSecondTask(intent, user);
|
||||
mSplitSelectStateController.setSecondTask(intent, user, itemInfo);
|
||||
}
|
||||
|
||||
RectF secondTaskStartingBounds = new RectF();
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package com.android.quickstep.views;
|
||||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.content.Context;
|
||||
@@ -39,6 +41,7 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.statemanager.StatefulActivity;
|
||||
import com.android.quickstep.util.SplitSelectStateController;
|
||||
|
||||
/**
|
||||
* A rounded rectangular component containing a single TextView.
|
||||
@@ -130,8 +133,11 @@ public class SplitInstructionsView extends LinearLayout {
|
||||
}
|
||||
|
||||
private void exitSplitSelection() {
|
||||
((RecentsView) mLauncher.getOverviewPanel()).getSplitSelectController()
|
||||
.getSplitAnimationController().playPlaceholderDismissAnim(mLauncher);
|
||||
SplitSelectStateController splitSelectController =
|
||||
((RecentsView) mLauncher.getOverviewPanel()).getSplitSelectController();
|
||||
|
||||
splitSelectController.getSplitAnimationController().playPlaceholderDismissAnim(mLauncher,
|
||||
LAUNCHER_SPLIT_SELECTION_EXIT_CANCEL_BUTTON);
|
||||
mLauncher.getStateManager().goToState(LauncherState.NORMAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -835,7 +835,7 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
return getRecentsView().confirmSplitSelect(this, container.getTask(),
|
||||
container.getIconView().getDrawable(), container.getThumbnailView(),
|
||||
container.getThumbnailView().getThumbnail(), /* intent */ null,
|
||||
/* user */ null);
|
||||
/* user */ null, container.getItemInfo());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user