Merge "Add metrics sources for split invocation" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e58e123bd7
@@ -15,14 +15,16 @@
|
||||
*/
|
||||
package com.android.launcher3.popup;
|
||||
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.uioverrides.QuickstepLauncher;
|
||||
@@ -70,9 +72,10 @@ public interface QuickstepSystemShortcut {
|
||||
}
|
||||
|
||||
RecentsView recentsView = mTarget.getOverviewPanel();
|
||||
StatsLogManager.EventEnum splitEvent = getLogEventForPosition(mPosition.stagePosition);
|
||||
recentsView.initiateSplitSelect(
|
||||
new SplitSelectSource(mOriginalView, new BitmapDrawable(bitmap), intent,
|
||||
mPosition, mItemInfo.user));
|
||||
mPosition, mItemInfo, splitEvent));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,15 +85,18 @@ public interface QuickstepSystemShortcut {
|
||||
public final Drawable drawable;
|
||||
public final Intent intent;
|
||||
public final SplitPositionOption position;
|
||||
public final UserHandle user;
|
||||
public final ItemInfo mItemInfo;
|
||||
public final StatsLogManager.EventEnum splitEvent;
|
||||
|
||||
public SplitSelectSource(View view, Drawable drawable, Intent intent,
|
||||
SplitPositionOption position, UserHandle user) {
|
||||
SplitPositionOption position, ItemInfo itemInfo,
|
||||
StatsLogManager.EventEnum splitEvent) {
|
||||
this.view = view;
|
||||
this.drawable = drawable;
|
||||
this.intent = intent;
|
||||
this.position = position;
|
||||
this.user = user;
|
||||
this.mItemInfo = itemInfo;
|
||||
this.splitEvent = splitEvent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.UserHandle;
|
||||
import android.util.Pair;
|
||||
import android.view.DragEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.SurfaceControl;
|
||||
@@ -42,7 +43,6 @@ import android.window.SurfaceSyncer;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.logging.InstanceId;
|
||||
import com.android.internal.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.DragSource;
|
||||
@@ -69,6 +69,7 @@ import com.android.launcher3.testing.TestLogging;
|
||||
import com.android.launcher3.testing.shared.TestProtocol;
|
||||
import com.android.launcher3.util.IntSet;
|
||||
import com.android.launcher3.util.ItemInfoMatcher;
|
||||
import com.android.quickstep.util.LogUtils;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
@@ -359,11 +360,11 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im
|
||||
}
|
||||
|
||||
if (clipDescription != null && intent != null) {
|
||||
Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
|
||||
LogUtils.getShellShareableInstanceId();
|
||||
// Need to share the same InstanceId between launcher3 and WM Shell (internal).
|
||||
InstanceId internalInstanceId = new InstanceIdSequence(
|
||||
com.android.launcher3.logging.InstanceId.INSTANCE_ID_MAX).newInstanceId();
|
||||
com.android.launcher3.logging.InstanceId launcherInstanceId =
|
||||
new com.android.launcher3.logging.InstanceId(internalInstanceId.getId());
|
||||
InstanceId internalInstanceId = instanceIds.first;
|
||||
com.android.launcher3.logging.InstanceId launcherInstanceId = instanceIds.second;
|
||||
|
||||
intent.putExtra(ClipDescription.EXTRA_LOGGING_INSTANCE_ID, internalInstanceId);
|
||||
|
||||
|
||||
@@ -15,14 +15,20 @@
|
||||
*/
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;
|
||||
|
||||
import android.content.ClipDescription;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.graphics.Point;
|
||||
import android.os.Bundle;
|
||||
import android.util.Pair;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.internal.logging.InstanceId;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
@@ -47,6 +53,7 @@ import com.android.launcher3.util.ShortcutUtil;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.LogUtils;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.HashMap;
|
||||
@@ -263,8 +270,14 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
AbstractFloatingView.closeAllOpenViews(mTarget);
|
||||
Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
|
||||
LogUtils.getShellShareableInstanceId();
|
||||
mTarget.getStatsLogManager().logger()
|
||||
.withItemInfo(mItemInfo)
|
||||
.withInstanceId(instanceIds.second)
|
||||
.log(getLogEventForPosition(mPosition.stagePosition));
|
||||
|
||||
AbstractFloatingView.closeAllOpenViews(mTarget);
|
||||
if (mItemInfo.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
|
||||
WorkspaceItemInfo workspaceItemInfo = (WorkspaceItemInfo) mItemInfo;
|
||||
SystemUiProxy.INSTANCE.get(mTarget).startShortcut(
|
||||
@@ -272,7 +285,8 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
workspaceItemInfo.getDeepShortcutId(),
|
||||
mPosition.stagePosition,
|
||||
null,
|
||||
workspaceItemInfo.user);
|
||||
workspaceItemInfo.user,
|
||||
instanceIds.first);
|
||||
} else {
|
||||
SystemUiProxy.INSTANCE.get(mTarget).startIntent(
|
||||
mTarget.getSystemService(LauncherApps.class).getMainActivityLaunchIntent(
|
||||
@@ -281,7 +295,8 @@ public class TaskbarPopupController implements TaskbarControllers.LoggableTaskba
|
||||
mItemInfo.user),
|
||||
new Intent(),
|
||||
mPosition.stagePosition,
|
||||
null);
|
||||
null,
|
||||
instanceIds.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,24 +17,29 @@ package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.DEEP_SHORTCUTS;
|
||||
import static com.android.launcher3.accessibility.LauncherAccessibilityDelegate.SHORTCUTS_AND_NOTIFICATIONS;
|
||||
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.LauncherApps;
|
||||
import android.util.Pair;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.internal.logging.InstanceId;
|
||||
import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.LauncherSettings;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.accessibility.BaseAccessibilityDelegate;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.notification.NotificationListener;
|
||||
import com.android.launcher3.util.ShortcutUtil;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.util.LogUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -49,10 +54,12 @@ public class TaskbarShortcutMenuAccessibilityDelegate
|
||||
public static final int MOVE_TO_BOTTOM_OR_RIGHT = R.id.action_move_to_bottom_or_right;
|
||||
|
||||
private final LauncherApps mLauncherApps;
|
||||
private final StatsLogManager mStatsLogManager;
|
||||
|
||||
public TaskbarShortcutMenuAccessibilityDelegate(TaskbarActivityContext context) {
|
||||
super(context);
|
||||
mLauncherApps = context.getSystemService(LauncherApps.class);
|
||||
mStatsLogManager = context.getStatsLogManager();
|
||||
|
||||
mActions.put(DEEP_SHORTCUTS, new LauncherAction(DEEP_SHORTCUTS,
|
||||
R.string.action_deep_shortcut, KeyEvent.KEYCODE_S));
|
||||
@@ -82,7 +89,14 @@ public class TaskbarShortcutMenuAccessibilityDelegate
|
||||
&& (action == MOVE_TO_TOP_OR_LEFT || action == MOVE_TO_BOTTOM_OR_RIGHT)) {
|
||||
WorkspaceItemInfo info = (WorkspaceItemInfo) item;
|
||||
int side = action == MOVE_TO_TOP_OR_LEFT
|
||||
? SPLIT_POSITION_TOP_OR_LEFT : SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
? STAGE_POSITION_TOP_OR_LEFT : STAGE_POSITION_BOTTOM_OR_RIGHT;
|
||||
|
||||
Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
|
||||
LogUtils.getShellShareableInstanceId();
|
||||
mStatsLogManager.logger()
|
||||
.withItemInfo(item)
|
||||
.withInstanceId(instanceIds.second)
|
||||
.log(getLogEventForPosition(side));
|
||||
|
||||
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
|
||||
SystemUiProxy.INSTANCE.get(mContext).startShortcut(
|
||||
@@ -90,14 +104,15 @@ public class TaskbarShortcutMenuAccessibilityDelegate
|
||||
info.getDeepShortcutId(),
|
||||
side,
|
||||
/* bundleOpts= */ null,
|
||||
info.user);
|
||||
info.user,
|
||||
instanceIds.first);
|
||||
} else {
|
||||
SystemUiProxy.INSTANCE.get(mContext).startIntent(
|
||||
mLauncherApps.getMainActivityLaunchIntent(
|
||||
item.getIntent().getComponent(),
|
||||
/* startActivityOptions= */null,
|
||||
item.user),
|
||||
new Intent(), side, null);
|
||||
new Intent(), side, null, instanceIds.first);
|
||||
}
|
||||
return true;
|
||||
} else if (action == DEEP_SHORTCUTS || action == SHORTCUTS_AND_NOTIFICATIONS) {
|
||||
|
||||
@@ -191,7 +191,7 @@ public class QuickstepLauncher extends Launcher {
|
||||
RecentsView overviewPanel = (RecentsView) getOverviewPanel();
|
||||
SplitSelectStateController controller =
|
||||
new SplitSelectStateController(this, mHandler, getStateManager(),
|
||||
getDepthController());
|
||||
getDepthController(), getStatsLogManager());
|
||||
overviewPanel.init(mActionsView, controller);
|
||||
mActionsView.updateDimension(getDeviceProfile(), overviewPanel.getLastComputedTaskSize());
|
||||
mActionsView.updateVerticalMargin(DisplayController.getNavigationMode(this));
|
||||
@@ -898,8 +898,8 @@ public class QuickstepLauncher extends Launcher {
|
||||
outState.putIBinder(PENDING_SPLIT_SELECT_INFO, ObjectWrapper.wrap(
|
||||
new PendingSplitSelectInfo(
|
||||
splitSelectStateController.getInitialTaskId(),
|
||||
splitSelectStateController.getActiveSplitStagePosition()
|
||||
)
|
||||
splitSelectStateController.getActiveSplitStagePosition(),
|
||||
splitSelectStateController.getSplitEvent())
|
||||
));
|
||||
outState.putInt(RUNTIME_STATE, OVERVIEW.ordinal);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
||||
|
||||
SplitSelectStateController controller =
|
||||
new SplitSelectStateController(this, mHandler, getStateManager(),
|
||||
null /* depthController */);
|
||||
/* depthController */ null, getStatsLogManager());
|
||||
mDragLayer.recreateControllers();
|
||||
mFallbackRecentsView.init(mActionsView, controller);
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ import android.window.IOnBackInvokedCallback;
|
||||
|
||||
import androidx.annotation.WorkerThread;
|
||||
|
||||
import com.android.internal.logging.InstanceId;
|
||||
import com.android.launcher3.util.MainThreadInitializedObject;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||
@@ -539,11 +540,11 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
/** Start multiple tasks in split-screen simultaneously. */
|
||||
public void startTasks(int mainTaskId, Bundle mainOptions, int sideTaskId, Bundle sideOptions,
|
||||
@SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
|
||||
RemoteTransitionCompat remoteTransition) {
|
||||
RemoteTransitionCompat remoteTransition, InstanceId instanceId) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSplitScreen.startTasks(mainTaskId, mainOptions, sideTaskId, sideOptions,
|
||||
sidePosition, splitRatio, remoteTransition.getTransition());
|
||||
sidePosition, splitRatio, remoteTransition.getTransition(), instanceId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startTask");
|
||||
}
|
||||
@@ -555,11 +556,11 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
*/
|
||||
public void startTasksWithLegacyTransition(int mainTaskId, Bundle mainOptions, int sideTaskId,
|
||||
Bundle sideOptions, @SplitConfigurationOptions.StagePosition int sidePosition,
|
||||
float splitRatio, RemoteAnimationAdapter adapter) {
|
||||
float splitRatio, RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSplitScreen.startTasksWithLegacyTransition(mainTaskId, mainOptions, sideTaskId,
|
||||
sideOptions, sidePosition, splitRatio, adapter);
|
||||
sideOptions, sidePosition, splitRatio, adapter, instanceId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startTasksWithLegacyTransition");
|
||||
}
|
||||
@@ -569,11 +570,12 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
public void startIntentAndTaskWithLegacyTransition(PendingIntent pendingIntent,
|
||||
Intent fillInIntent, int taskId, Bundle mainOptions, Bundle sideOptions,
|
||||
@SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
|
||||
RemoteAnimationAdapter adapter) {
|
||||
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSplitScreen.startIntentAndTaskWithLegacyTransition(pendingIntent, fillInIntent,
|
||||
taskId, mainOptions, sideOptions, sidePosition, splitRatio, adapter);
|
||||
taskId, mainOptions, sideOptions, sidePosition, splitRatio, adapter,
|
||||
instanceId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startIntentAndTaskWithLegacyTransition");
|
||||
}
|
||||
@@ -583,11 +585,11 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
public void startShortcutAndTaskWithLegacyTransition(ShortcutInfo shortcutInfo, int taskId,
|
||||
Bundle mainOptions, Bundle sideOptions,
|
||||
@SplitConfigurationOptions.StagePosition int sidePosition, float splitRatio,
|
||||
RemoteAnimationAdapter adapter) {
|
||||
RemoteAnimationAdapter adapter, InstanceId instanceId) {
|
||||
if (mSystemUiProxy != null) {
|
||||
try {
|
||||
mSplitScreen.startShortcutAndTaskWithLegacyTransition(shortcutInfo, taskId,
|
||||
mainOptions, sideOptions, sidePosition, splitRatio, adapter);
|
||||
mainOptions, sideOptions, sidePosition, splitRatio, adapter, instanceId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startShortcutAndTaskWithLegacyTransition");
|
||||
}
|
||||
@@ -595,11 +597,11 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
}
|
||||
|
||||
public void startShortcut(String packageName, String shortcutId, int position,
|
||||
Bundle options, UserHandle user) {
|
||||
Bundle options, UserHandle user, InstanceId instanceId) {
|
||||
if (mSplitScreen != null) {
|
||||
try {
|
||||
mSplitScreen.startShortcut(packageName, shortcutId, position, options,
|
||||
user);
|
||||
user, instanceId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startShortcut");
|
||||
}
|
||||
@@ -607,10 +609,10 @@ public class SystemUiProxy implements ISystemUiProxy {
|
||||
}
|
||||
|
||||
public void startIntent(PendingIntent intent, Intent fillInIntent, int position,
|
||||
Bundle options) {
|
||||
Bundle options, InstanceId instanceId) {
|
||||
if (mSplitScreen != null) {
|
||||
try {
|
||||
mSplitScreen.startIntent(intent, fillInIntent, position, options);
|
||||
mSplitScreen.startIntent(intent, fillInIntent, position, options, instanceId);
|
||||
} catch (RemoteException e) {
|
||||
Log.w(TAG, "Failed call startIntent");
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.annotation.Nullable;
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.anim.PendingAnimation;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.popup.QuickstepSystemShortcut;
|
||||
import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions;
|
||||
@@ -213,8 +214,9 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
|
||||
|
||||
@Override
|
||||
public void initiateSplitSelect(TaskView taskView,
|
||||
@SplitConfigurationOptions.StagePosition int stagePosition) {
|
||||
super.initiateSplitSelect(taskView, stagePosition);
|
||||
@SplitConfigurationOptions.StagePosition int stagePosition,
|
||||
StatsLogManager.EventEnum splitEvent) {
|
||||
super.initiateSplitSelect(taskView, stagePosition, splitEvent);
|
||||
mActivity.getStateManager().goToState(OVERVIEW_SPLIT_SELECT);
|
||||
}
|
||||
|
||||
|
||||
34
quickstep/src/com/android/quickstep/util/LogUtils.kt
Normal file
34
quickstep/src/com/android/quickstep/util/LogUtils.kt
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2022 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.quickstep.util
|
||||
|
||||
import android.util.Pair
|
||||
import com.android.internal.logging.InstanceIdSequence
|
||||
import com.android.launcher3.logging.InstanceId
|
||||
|
||||
object LogUtils {
|
||||
/**
|
||||
* @return a [Pair] of two InstanceIds but with different types, one that can be used by framework
|
||||
* (if needing to pass through an intent or such) and one used in Launcher
|
||||
*/
|
||||
@JvmStatic
|
||||
fun getShellShareableInstanceId():
|
||||
Pair<com.android.internal.logging.InstanceId, InstanceId> {
|
||||
val internalInstanceId = InstanceIdSequence(InstanceId.INSTANCE_ID_MAX).newInstanceId()
|
||||
val launcherInstanceId = InstanceId(internalInstanceId.id)
|
||||
return Pair(internalInstanceId, launcherInstanceId)
|
||||
}
|
||||
}
|
||||
@@ -38,12 +38,16 @@ import android.os.IBinder;
|
||||
import android.os.UserHandle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.RemoteAnimationAdapter;
|
||||
import android.view.SurfaceControl;
|
||||
import android.window.TransitionInfo;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.internal.logging.InstanceId;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.shortcuts.ShortcutKey;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.statemanager.StateManager;
|
||||
@@ -74,10 +78,12 @@ public class SplitSelectStateController {
|
||||
|
||||
private final Context mContext;
|
||||
private final Handler mHandler;
|
||||
private StatsLogManager mStatsLogManager;
|
||||
private final SystemUiProxy mSystemUiProxy;
|
||||
private final StateManager mStateManager;
|
||||
private final DepthController mDepthController;
|
||||
private @StagePosition int mStagePosition;
|
||||
private ItemInfo mItemInfo;
|
||||
private Intent mInitialTaskIntent;
|
||||
private int mInitialTaskId = INVALID_TASK_ID;
|
||||
private int mSecondTaskId = INVALID_TASK_ID;
|
||||
@@ -88,11 +94,14 @@ public class SplitSelectStateController {
|
||||
/** If not null, this is the TaskView we want to launch from */
|
||||
@Nullable
|
||||
private GroupedTaskView mLaunchingTaskView;
|
||||
/** Represents where split is intended to be invoked from. */
|
||||
private StatsLogManager.EventEnum mSplitEvent;
|
||||
|
||||
public SplitSelectStateController(Context context, Handler handler, StateManager stateManager,
|
||||
DepthController depthController) {
|
||||
DepthController depthController, StatsLogManager statsLogManager) {
|
||||
mContext = context;
|
||||
mHandler = handler;
|
||||
mStatsLogManager = statsLogManager;
|
||||
mSystemUiProxy = SystemUiProxy.INSTANCE.get(mContext);
|
||||
mStateManager = stateManager;
|
||||
mDepthController = depthController;
|
||||
@@ -101,19 +110,25 @@ public class SplitSelectStateController {
|
||||
/**
|
||||
* To be called after first task selected
|
||||
*/
|
||||
public void setInitialTaskSelect(int taskId, @StagePosition int stagePosition) {
|
||||
public void setInitialTaskSelect(int taskId, @StagePosition int stagePosition,
|
||||
StatsLogManager.EventEnum splitEvent, ItemInfo itemInfo) {
|
||||
mInitialTaskId = taskId;
|
||||
mStagePosition = stagePosition;
|
||||
mInitialTaskIntent = null;
|
||||
mUser = null;
|
||||
setInitialData(stagePosition, splitEvent, itemInfo);
|
||||
}
|
||||
|
||||
public void setInitialTaskSelect(Intent intent, @StagePosition int stagePosition,
|
||||
@Nullable UserHandle user) {
|
||||
@NonNull ItemInfo itemInfo, StatsLogManager.EventEnum splitEvent) {
|
||||
mInitialTaskIntent = intent;
|
||||
mUser = itemInfo.user;
|
||||
mItemInfo = itemInfo;
|
||||
setInitialData(stagePosition, splitEvent, itemInfo);
|
||||
}
|
||||
|
||||
private void setInitialData(@StagePosition int stagePosition,
|
||||
StatsLogManager.EventEnum splitEvent, ItemInfo itemInfo) {
|
||||
mItemInfo = itemInfo;
|
||||
mStagePosition = stagePosition;
|
||||
mInitialTaskId = INVALID_TASK_ID;
|
||||
mUser = user;
|
||||
mSplitEvent = splitEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,8 +152,16 @@ public class SplitSelectStateController {
|
||||
FLAG_MUTABLE, null /* options */, mUser)
|
||||
: PendingIntent.getActivity(mContext, 0, mInitialTaskIntent, FLAG_MUTABLE));
|
||||
|
||||
Pair<InstanceId, com.android.launcher3.logging.InstanceId> instanceIds =
|
||||
LogUtils.getShellShareableInstanceId();
|
||||
launchTasks(mInitialTaskId, pendingIntent, fillInIntent, mSecondTaskId, mStagePosition,
|
||||
callback, false /* freezeTaskList */, DEFAULT_SPLIT_RATIO);
|
||||
callback, false /* freezeTaskList */, DEFAULT_SPLIT_RATIO,
|
||||
instanceIds.first);
|
||||
|
||||
mStatsLogManager.logger()
|
||||
.withItemInfo(mItemInfo)
|
||||
.withInstanceId(instanceIds.second)
|
||||
.log(mSplitEvent);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,7 +197,7 @@ public class SplitSelectStateController {
|
||||
public void launchTasks(int taskId1, int taskId2, @StagePosition int stagePosition,
|
||||
Consumer<Boolean> callback, boolean freezeTaskList, float splitRatio) {
|
||||
launchTasks(taskId1, null /* taskPendingIntent */, null /* fillInIntent */, taskId2,
|
||||
stagePosition, callback, freezeTaskList, splitRatio);
|
||||
stagePosition, callback, freezeTaskList, splitRatio, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,10 +206,14 @@ public class SplitSelectStateController {
|
||||
* fill in intent with a taskId2 are set.
|
||||
* @param taskPendingIntent is null when split is initiated from Overview
|
||||
* @param stagePosition representing location of task1
|
||||
* @param shellInstanceId loggingId to be used by shell, will be non-null for actions that create
|
||||
* a split instance, null for cases that bring existing instaces to the
|
||||
* foreground (quickswitch, launching previous pairs from overview)
|
||||
*/
|
||||
public void launchTasks(int taskId1, @Nullable PendingIntent taskPendingIntent,
|
||||
@Nullable Intent fillInIntent, int taskId2, @StagePosition int stagePosition,
|
||||
Consumer<Boolean> callback, boolean freezeTaskList, float splitRatio) {
|
||||
Consumer<Boolean> callback, boolean freezeTaskList, float splitRatio,
|
||||
@Nullable InstanceId shellInstanceId) {
|
||||
TestLogging.recordEvent(
|
||||
TestProtocol.SEQUENCE_MAIN, "launchSplitTasks");
|
||||
// Assume initial task is for top/left part of screen
|
||||
@@ -200,7 +227,8 @@ public class SplitSelectStateController {
|
||||
mSystemUiProxy.startTasks(taskIds[0], null /* mainOptions */, taskIds[1],
|
||||
null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT, splitRatio,
|
||||
new RemoteTransitionCompat(animationRunner, MAIN_EXECUTOR,
|
||||
ActivityThread.currentActivityThread().getApplicationThread()));
|
||||
ActivityThread.currentActivityThread().getApplicationThread()),
|
||||
shellInstanceId);
|
||||
// TODO(b/237635859): handle intent/shortcut + task with shell transition
|
||||
} else {
|
||||
RemoteSplitLaunchAnimationRunner animationRunner =
|
||||
@@ -218,18 +246,18 @@ public class SplitSelectStateController {
|
||||
if (taskPendingIntent == null) {
|
||||
mSystemUiProxy.startTasksWithLegacyTransition(taskIds[0], mainOpts.toBundle(),
|
||||
taskIds[1], null /* sideOptions */, STAGE_POSITION_BOTTOM_OR_RIGHT,
|
||||
splitRatio, adapter);
|
||||
splitRatio, adapter, shellInstanceId);
|
||||
} else {
|
||||
final ShortcutInfo shortcutInfo = getShortcutInfo(mInitialTaskIntent,
|
||||
taskPendingIntent.getCreatorUserHandle());
|
||||
if (shortcutInfo != null) {
|
||||
mSystemUiProxy.startShortcutAndTaskWithLegacyTransition(shortcutInfo, taskId2,
|
||||
mainOpts.toBundle(), null /* sideOptions */, stagePosition, splitRatio,
|
||||
adapter);
|
||||
adapter, shellInstanceId);
|
||||
} else {
|
||||
mSystemUiProxy.startIntentAndTaskWithLegacyTransition(taskPendingIntent,
|
||||
fillInIntent, taskId2, mainOpts.toBundle(), null /* sideOptions */,
|
||||
stagePosition, splitRatio, adapter);
|
||||
stagePosition, splitRatio, adapter, shellInstanceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -239,6 +267,10 @@ public class SplitSelectStateController {
|
||||
return mStagePosition;
|
||||
}
|
||||
|
||||
public StatsLogManager.EventEnum getSplitEvent() {
|
||||
return mSplitEvent;
|
||||
}
|
||||
|
||||
public void setRecentsAnimationRunning(boolean running) {
|
||||
this.mRecentsAnimationRunning = running;
|
||||
}
|
||||
@@ -358,6 +390,8 @@ public class SplitSelectStateController {
|
||||
mStagePosition = SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
|
||||
mRecentsAnimationRunning = false;
|
||||
mLaunchingTaskView = null;
|
||||
mItemInfo = null;
|
||||
mSplitEvent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,6 +33,7 @@ import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.AbstractFloatingView;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.popup.QuickstepSystemShortcut;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||
@@ -94,7 +95,7 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
if (recoveryData.getStagedTaskId() == taskId) {
|
||||
initiateSplitSelect(
|
||||
getTaskViewByTaskId(recoveryData.getStagedTaskId()),
|
||||
recoveryData.getStagePosition()
|
||||
recoveryData.getStagePosition(), recoveryData.getSource()
|
||||
);
|
||||
mActivity.finishSplitSelectRecovery();
|
||||
}
|
||||
@@ -104,7 +105,6 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
|
||||
setLayoutRotation(Surface.ROTATION_0, Surface.ROTATION_0);
|
||||
}
|
||||
|
||||
@@ -192,8 +192,9 @@ public class LauncherRecentsView extends RecentsView<QuickstepLauncher, Launcher
|
||||
|
||||
@Override
|
||||
public void initiateSplitSelect(TaskView taskView,
|
||||
@SplitConfigurationOptions.StagePosition int stagePosition) {
|
||||
super.initiateSplitSelect(taskView, stagePosition);
|
||||
@SplitConfigurationOptions.StagePosition int stagePosition,
|
||||
StatsLogManager.EventEnum splitEvent) {
|
||||
super.initiateSplitSelect(taskView, stagePosition, splitEvent);
|
||||
mActivity.getStateManager().goToState(LauncherState.OVERVIEW_SPLIT_SELECT);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.anim.Interpolators.OVERSHOOT_0_85;
|
||||
import static com.android.launcher3.anim.Interpolators.clampToProgress;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_OVERVIEW_ACTIONS_SPLIT;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
|
||||
@@ -134,6 +135,7 @@ import com.android.launcher3.anim.SpringProperty;
|
||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.icons.cache.HandlerRunnable;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.popup.QuickstepSystemShortcut;
|
||||
import com.android.launcher3.statehandlers.DepthController;
|
||||
import com.android.launcher3.statemanager.BaseState;
|
||||
@@ -4150,16 +4152,21 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Primarily used by overview actions to initiate split from focused task, logs the source
|
||||
* of split invocation as such.
|
||||
*/
|
||||
public void initiateSplitSelect(TaskView taskView) {
|
||||
int defaultSplitPosition = mOrientationHandler
|
||||
.getDefaultSplitPosition(mActivity.getDeviceProfile());
|
||||
initiateSplitSelect(taskView, defaultSplitPosition);
|
||||
initiateSplitSelect(taskView, defaultSplitPosition, LAUNCHER_OVERVIEW_ACTIONS_SPLIT);
|
||||
}
|
||||
|
||||
public void initiateSplitSelect(TaskView taskView, @StagePosition int stagePosition) {
|
||||
public void initiateSplitSelect(TaskView taskView, @StagePosition int stagePosition,
|
||||
StatsLogManager.EventEnum splitEvent) {
|
||||
mSplitHiddenTaskView = taskView;
|
||||
mSplitSelectStateController.setInitialTaskSelect(taskView.getTask().key.id,
|
||||
stagePosition);
|
||||
stagePosition, splitEvent, taskView.getItemInfo());
|
||||
mSplitHiddenTaskViewIndex = indexOfChild(taskView);
|
||||
if (ENABLE_QUICKSTEP_LIVE_TILE.get()) {
|
||||
finishRecentsAnimation(true /* toRecents */, false /* shouldPip */,
|
||||
@@ -4170,7 +4177,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
public void initiateSplitSelect(QuickstepSystemShortcut.SplitSelectSource splitSelectSource) {
|
||||
mSplitSelectSource = splitSelectSource;
|
||||
mSplitSelectStateController.setInitialTaskSelect(splitSelectSource.intent,
|
||||
splitSelectSource.position.stagePosition, splitSelectSource.user);
|
||||
splitSelectSource.position.stagePosition, splitSelectSource.mItemInfo,
|
||||
splitSelectSource.splitEvent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,6 +32,7 @@ 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;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.STAGE_POSITION_UNDEFINED;
|
||||
import static com.android.launcher3.util.SplitConfigurationOptions.getLogEventForPosition;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
@@ -1496,7 +1497,8 @@ public class TaskView extends FrameLayout implements Reusable {
|
||||
}
|
||||
|
||||
public void initiateSplitSelect(SplitPositionOption splitPositionOption) {
|
||||
getRecentsView().initiateSplitSelect(this, splitPositionOption.stagePosition);
|
||||
getRecentsView().initiateSplitSelect(this, splitPositionOption.stagePosition,
|
||||
getLogEventForPosition(splitPositionOption.stagePosition));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -593,6 +593,12 @@ public class StatsLogManager implements ResourceBasedOverride {
|
||||
|
||||
@UiEvent(doc = "User tapped on Share app system shortcut.")
|
||||
LAUNCHER_SYSTEM_SHORTCUT_APP_SHARE_TAP(1075),
|
||||
|
||||
@UiEvent(doc = "User has invoked split to right half from an app icon menu")
|
||||
LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM(1199),
|
||||
|
||||
@UiEvent(doc = "User has invoked split to left half from an app icon menu")
|
||||
LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP(1200)
|
||||
;
|
||||
|
||||
// ADD MORE
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.StagePosition;
|
||||
|
||||
/**
|
||||
@@ -28,10 +29,13 @@ public class PendingSplitSelectInfo {
|
||||
|
||||
private final int mStagedTaskId;
|
||||
private final int mStagePosition;
|
||||
private final StatsLogManager.EventEnum mSource;
|
||||
|
||||
public PendingSplitSelectInfo(int stagedTaskId, int stagePosition) {
|
||||
public PendingSplitSelectInfo(int stagedTaskId, int stagePosition,
|
||||
StatsLogManager.EventEnum source) {
|
||||
this.mStagedTaskId = stagedTaskId;
|
||||
this.mStagePosition = stagePosition;
|
||||
this.mSource = source;
|
||||
}
|
||||
|
||||
public int getStagedTaskId() {
|
||||
@@ -41,4 +45,8 @@ public class PendingSplitSelectInfo {
|
||||
public @StagePosition int getStagePosition() {
|
||||
return mStagePosition;
|
||||
}
|
||||
|
||||
public StatsLogManager.EventEnum getSource() {
|
||||
return mSource;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,12 +16,17 @@
|
||||
|
||||
package com.android.launcher3.util;
|
||||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM;
|
||||
|
||||
import static java.lang.annotation.RetentionPolicy.SOURCE;
|
||||
|
||||
import android.graphics.Rect;
|
||||
|
||||
import androidx.annotation.IntDef;
|
||||
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
|
||||
public final class SplitConfigurationOptions {
|
||||
@@ -170,4 +175,10 @@ public final class SplitConfigurationOptions {
|
||||
@StageType
|
||||
public int stageType = STAGE_TYPE_UNDEFINED;
|
||||
}
|
||||
|
||||
public static StatsLogManager.EventEnum getLogEventForPosition(@StagePosition int position) {
|
||||
return position == STAGE_POSITION_TOP_OR_LEFT
|
||||
? LAUNCHER_APP_ICON_MENU_SPLIT_LEFT_TOP
|
||||
: LAUNCHER_APP_ICON_MENU_SPLIT_RIGHT_BOTTOM;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user