mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 18:06:48 +00:00
Add logs for taskbar and overview split action
Log: - Taskbar app launch (also from foldeR) - Taskbar app drag (also from folder) - Taskbar folder open - Long press to hide taskbar - Long press to show taskbar - Overview Split screen action Also add support for ActivityContext to overwrite/add to LauncherAtom.ItemInfo, which TaskbarActivityContext does to change HotseatContainer and PredictedHotseatContainer to TaskBarContainer Test: enable logcat locally Bug: 193009817 Change-Id: Ia82c846a727fecb8cbfd0a069c8af1276083bf83
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
package com.android.launcher3.taskbar;
|
||||
|
||||
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_HIDE;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASKBAR_LONGPRESS_SHOW;
|
||||
import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_IN_APP;
|
||||
import static com.android.launcher3.taskbar.TaskbarViewController.ALPHA_INDEX_HOME;
|
||||
|
||||
@@ -36,7 +38,10 @@ import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorListeners;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.InstanceIdSequence;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.util.MultiValueAlpha;
|
||||
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
|
||||
import com.android.launcher3.util.OnboardingPrefs;
|
||||
@@ -262,6 +267,11 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
@Override
|
||||
protected void onStashedInAppChanged() {
|
||||
onStashedInAppChanged(mLauncher.getDeviceProfile());
|
||||
if (mControllers.taskbarStashController.isStashedInApp()) {
|
||||
mContext.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_LONGPRESS_HIDE);
|
||||
} else {
|
||||
mContext.getStatsLogManager().logger().log(LAUNCHER_TASKBAR_LONGPRESS_SHOW);
|
||||
}
|
||||
}
|
||||
|
||||
private void onStashedInAppChanged(DeviceProfile deviceProfile) {
|
||||
@@ -306,6 +316,12 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
mControllers.taskbarEduController.hideEdu();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskbarIconLaunched(WorkspaceItemInfo item) {
|
||||
InstanceId instanceId = new InstanceIdSequence().newInstanceId();
|
||||
mLauncher.logAppLaunch(mContext.getStatsLogManager(), item, instanceId);
|
||||
}
|
||||
|
||||
private final class TaskBarRecentsAnimationListener implements RecentsAnimationListener {
|
||||
private final RecentsAnimationCallbacks mCallbacks;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
|
||||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN;
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_BOTTOM_TAPPABLE_ELEMENT;
|
||||
import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_EXTRA_NAVIGATION_BAR;
|
||||
|
||||
@@ -52,6 +53,7 @@ import com.android.launcher3.LauncherSettings.Favorites;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.folder.Folder;
|
||||
import com.android.launcher3.folder.FolderIcon;
|
||||
import com.android.launcher3.logger.LauncherAtom;
|
||||
import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.launcher3.taskbar.contextual.RotationButtonController;
|
||||
@@ -229,6 +231,60 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change from hotseat/predicted hotseat to taskbar container.
|
||||
*/
|
||||
@Override
|
||||
public void applyOverwritesToLogItem(LauncherAtom.ItemInfo.Builder itemInfoBuilder) {
|
||||
if (!itemInfoBuilder.hasContainerInfo()) {
|
||||
return;
|
||||
}
|
||||
LauncherAtom.ContainerInfo oldContainer = itemInfoBuilder.getContainerInfo();
|
||||
|
||||
if (oldContainer.hasPredictedHotseatContainer()) {
|
||||
LauncherAtom.PredictedHotseatContainer predictedHotseat =
|
||||
oldContainer.getPredictedHotseatContainer();
|
||||
LauncherAtom.TaskBarContainer.Builder taskbarBuilder =
|
||||
LauncherAtom.TaskBarContainer.newBuilder();
|
||||
|
||||
if (predictedHotseat.hasIndex()) {
|
||||
taskbarBuilder.setIndex(predictedHotseat.getIndex());
|
||||
}
|
||||
if (predictedHotseat.hasCardinality()) {
|
||||
taskbarBuilder.setCardinality(predictedHotseat.getCardinality());
|
||||
}
|
||||
|
||||
itemInfoBuilder.setContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
|
||||
.setTaskBarContainer(taskbarBuilder));
|
||||
} else if (oldContainer.hasHotseat()) {
|
||||
LauncherAtom.HotseatContainer hotseat = oldContainer.getHotseat();
|
||||
LauncherAtom.TaskBarContainer.Builder taskbarBuilder =
|
||||
LauncherAtom.TaskBarContainer.newBuilder();
|
||||
|
||||
if (hotseat.hasIndex()) {
|
||||
taskbarBuilder.setIndex(hotseat.getIndex());
|
||||
}
|
||||
|
||||
itemInfoBuilder.setContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
|
||||
.setTaskBarContainer(taskbarBuilder));
|
||||
} else if (oldContainer.hasFolder() && oldContainer.getFolder().hasHotseat()) {
|
||||
LauncherAtom.FolderContainer.Builder folderBuilder = oldContainer.getFolder()
|
||||
.toBuilder();
|
||||
LauncherAtom.HotseatContainer hotseat = folderBuilder.getHotseat();
|
||||
LauncherAtom.TaskBarContainer.Builder taskbarBuilder =
|
||||
LauncherAtom.TaskBarContainer.newBuilder();
|
||||
|
||||
if (hotseat.hasIndex()) {
|
||||
taskbarBuilder.setIndex(hotseat.getIndex());
|
||||
}
|
||||
|
||||
folderBuilder.setTaskbar(taskbarBuilder);
|
||||
folderBuilder.clearHotseat();
|
||||
itemInfoBuilder.setContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
|
||||
.setFolder(folderBuilder));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a new data-source for this taskbar instance
|
||||
*/
|
||||
@@ -326,6 +382,7 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
|
||||
getDragLayer().post(() -> {
|
||||
folder.animateOpen();
|
||||
getStatsLogManager().logger().withItemInfo(folder.mInfo).log(LAUNCHER_FOLDER_OPEN);
|
||||
|
||||
folder.iterateOverItems((itemInfo, itemView) -> {
|
||||
mControllers.taskbarViewController
|
||||
@@ -363,6 +420,8 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ
|
||||
getSystemService(LauncherApps.class).startMainActivity(
|
||||
intent.getComponent(), info.user, intent.getSourceBounds(), null);
|
||||
}
|
||||
|
||||
mControllers.uiController.onTaskbarIconLaunched(info);
|
||||
} catch (NullPointerException | ActivityNotFoundException | SecurityException e) {
|
||||
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT)
|
||||
.show();
|
||||
|
||||
@@ -34,6 +34,8 @@ import android.view.View;
|
||||
|
||||
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;
|
||||
@@ -48,6 +50,7 @@ import com.android.launcher3.dragndrop.DragView;
|
||||
import com.android.launcher3.dragndrop.DraggableView;
|
||||
import com.android.launcher3.graphics.DragPreviewProvider;
|
||||
import com.android.launcher3.icons.FastBitmapDrawable;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
import com.android.systemui.shared.recents.model.Task;
|
||||
@@ -284,10 +287,22 @@ public class TaskbarDragController extends DragController<TaskbarActivityContext
|
||||
}
|
||||
|
||||
if (clipDescription != null && intent != null) {
|
||||
// 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());
|
||||
|
||||
intent.putExtra(ClipDescription.EXTRA_LOGGING_INSTANCE_ID, internalInstanceId);
|
||||
|
||||
ClipData clipData = new ClipData(clipDescription, new ClipData.Item(intent));
|
||||
if (btv.startDragAndDrop(clipData, shadowBuilder, null /* localState */,
|
||||
View.DRAG_FLAG_GLOBAL | View.DRAG_FLAG_OPAQUE)) {
|
||||
onSystemDragStarted();
|
||||
|
||||
mActivity.getStatsLogManager().logger().withItemInfo(mDragObject.dragInfo)
|
||||
.withInstanceId(launcherInstanceId)
|
||||
.log(StatsLogManager.LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.android.launcher3.taskbar;
|
||||
import android.graphics.Rect;
|
||||
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.model.data.WorkspaceItemInfo;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -43,4 +44,6 @@ public class TaskbarUIController {
|
||||
public Stream<ItemInfoWithIcon> getAppIconsForEdu() {
|
||||
return Stream.empty();
|
||||
}
|
||||
|
||||
public void onTaskbarIconLaunched(WorkspaceItemInfo item) { }
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.appprediction.PredictionRowView;
|
||||
import com.android.launcher3.hybridhotseat.HotseatPredictionController;
|
||||
import com.android.launcher3.logging.InstanceId;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
|
||||
import com.android.launcher3.model.BgDataModel.FixedContainerItems;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
@@ -104,7 +105,8 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void logAppLaunch(ItemInfo info, InstanceId instanceId) {
|
||||
public void logAppLaunch(StatsLogManager statsLogManager, ItemInfo info,
|
||||
InstanceId instanceId) {
|
||||
// If the app launch is from any of the surfaces in AllApps then add the InstanceId from
|
||||
// LiveSearchManager to recreate the AllApps session on the server side.
|
||||
if (mAllAppsSessionLogId != null && ALL_APPS.equals(
|
||||
@@ -112,8 +114,7 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
|
||||
instanceId = mAllAppsSessionLogId;
|
||||
}
|
||||
|
||||
StatsLogger logger = getStatsLogManager()
|
||||
.logger().withItemInfo(info).withInstanceId(instanceId);
|
||||
StatsLogger logger = statsLogManager.logger().withItemInfo(info).withInstanceId(instanceId);
|
||||
|
||||
if (mAllAppsPredictions != null
|
||||
&& (info.itemType == ITEM_TYPE_APPLICATION
|
||||
|
||||
@@ -56,6 +56,7 @@ import com.android.launcher3.model.data.FolderInfo;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.util.Executors;
|
||||
import com.android.launcher3.util.LogConfig;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
|
||||
import com.android.systemui.shared.system.SysUiStatsLog;
|
||||
|
||||
@@ -97,7 +98,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
|
||||
@Override
|
||||
protected StatsLogger createLogger() {
|
||||
return new StatsCompatLogger(mContext);
|
||||
return new StatsCompatLogger(mContext, mActivityContext);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +142,8 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
|
||||
private static final ItemInfo DEFAULT_ITEM_INFO = new ItemInfo();
|
||||
|
||||
private Context mContext;
|
||||
private final Context mContext;
|
||||
private final Optional<ActivityContext> mActivityContext;
|
||||
private ItemInfo mItemInfo = DEFAULT_ITEM_INFO;
|
||||
private InstanceId mInstanceId = DEFAULT_INSTANCE_ID;
|
||||
private OptionalInt mRank = OptionalInt.empty();
|
||||
@@ -154,8 +156,9 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
private SliceItem mSliceItem;
|
||||
private LauncherAtom.Slice mSlice;
|
||||
|
||||
StatsCompatLogger(Context context) {
|
||||
StatsCompatLogger(Context context, ActivityContext activityContext) {
|
||||
mContext = context;
|
||||
mActivityContext = Optional.ofNullable(activityContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -307,6 +310,9 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
mRank.ifPresent(itemInfoBuilder::setRank);
|
||||
mContainerInfo.ifPresent(itemInfoBuilder::setContainerInfo);
|
||||
|
||||
mActivityContext.ifPresent(activityContext ->
|
||||
activityContext.applyOverwritesToLogItem(itemInfoBuilder));
|
||||
|
||||
if (mFromState.isPresent() || mToState.isPresent() || mEditText.isPresent()) {
|
||||
FolderIcon.Builder folderIconBuilder = itemInfoBuilder
|
||||
.getFolderIcon()
|
||||
|
||||
Reference in New Issue
Block a user