Merge "[DO NOT MERGE] Add component name to launcher home and overview gestures Bug: 168805198" into ub-launcher3-rvc-qpr-dev

This commit is contained in:
Hyunyoung Song 2020-09-26 06:55:11 +00:00 committed by Android (Google) Code Review
commit ab2e43e290
4 changed files with 33 additions and 2 deletions

View File

@ -55,6 +55,7 @@ message ContainerInfo {
SettingsContainer settings_container = 9;
PredictedHotseatContainer predicted_hotseat_container = 10;
TaskSwitcherContainer task_switcher_container = 11;
TaskForegroundContainer task_foreground_container = 12;
}
}
@ -92,8 +93,14 @@ message ShortcutsContainer {
message SettingsContainer {
}
message TaskSwitcherContainer {
}
// Container for tasks in the Overview UI.
// Typically entered using either the overview gesture or overview button.
message TaskSwitcherContainer {}
// Container for tasks from another foreground app, when not on launcher screen.
// Typically home gesture or overview gesture can be triggered from
// this container.
message TaskForegroundContainer {}
enum Attribute {
UNKNOWN = 0;

View File

@ -47,6 +47,7 @@ import android.animation.Animator;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.PointF;
@ -62,12 +63,14 @@ import androidx.annotation.UiThread;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@ -928,12 +931,25 @@ public abstract class BaseSwipeUpHandlerV2<T extends StatefulActivity<?>, Q exte
default:
event = IGNORE;
}
ComponentName componentName = mGestureState.getRunningTask().baseActivity;
StatsLogManager.newInstance(mContext).logger()
.withSrcState(LAUNCHER_STATE_BACKGROUND)
.withDstState(StatsLogManager.containerTypeToAtomState(endTarget.containerType))
.withItemInfo(getItemInfo(componentName))
.log(event);
}
/**
* Builds proto for logging
*/
public WorkspaceItemInfo getItemInfo(ComponentName componentName) {
WorkspaceItemInfo placeholderInfo = new WorkspaceItemInfo();
placeholderInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_TASK;
placeholderInfo.container = LauncherSettings.Favorites.CONTAINER_TASKFOREGROUND;
placeholderInfo.intent = new Intent().setComponent(componentName);
return placeholderInfo;
}
/** Animates to the given progress, where 0 is the current app and 1 is overview. */
@UiThread
private void animateToProgress(float start, float end, long duration, Interpolator interpolator,

View File

@ -164,6 +164,7 @@ public class LauncherSettings {
public static final int CONTAINER_SHORTCUTS = -107;
public static final int CONTAINER_SETTINGS = -108;
public static final int CONTAINER_TASKSWITCHER = -109;
public static final int CONTAINER_TASKFOREGROUND = -110;
public static final String containerToString(int container) {
switch (container) {

View File

@ -24,6 +24,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICT
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SEARCH_RESULTS;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SETTINGS;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_TASKFOREGROUND;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_TASKSWITCHER;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
@ -51,6 +52,7 @@ import com.android.launcher3.logger.LauncherAtom.PredictionContainer;
import com.android.launcher3.logger.LauncherAtom.SearchResultContainer;
import com.android.launcher3.logger.LauncherAtom.SettingsContainer;
import com.android.launcher3.logger.LauncherAtom.ShortcutsContainer;
import com.android.launcher3.logger.LauncherAtom.TaskForegroundContainer;
import com.android.launcher3.logger.LauncherAtom.TaskSwitcherContainer;
import com.android.launcher3.model.ModelWriter;
import com.android.launcher3.util.ContentWriter;
@ -392,6 +394,11 @@ public class ItemInfo {
return ContainerInfo.newBuilder()
.setTaskSwitcherContainer(TaskSwitcherContainer.getDefaultInstance())
.build();
case CONTAINER_TASKFOREGROUND:
return ContainerInfo.newBuilder()
.setTaskForegroundContainer(TaskForegroundContainer.getDefaultInstance())
.build();
}
return ContainerInfo.getDefaultInstance();