Merge "Change logged hotseat values for beta" into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot
2020-04-14 16:27:30 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 7 deletions
@@ -33,6 +33,7 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Workspace;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.UserEventDispatcher;
@@ -153,6 +154,12 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
private void logUserAction(boolean migrated, int pageIndex) {
LauncherLogProto.Action action = new LauncherLogProto.Action();
LauncherLogProto.Target target = new LauncherLogProto.Target();
int hotseatItemsCount = mLauncher.getHotseat().getShortcutsAndWidgets().getChildCount();
// -1 to exclude smart space
int workspaceItemCount = mLauncher.getWorkspace().getScreenWithId(
Workspace.FIRST_SCREEN_ID).getShortcutsAndWidgets().getChildCount() - 1;
action.type = LauncherLogProto.Action.Type.TOUCH;
action.touch = LauncherLogProto.Action.Touch.TAP;
target.containerType = LauncherLogProto.ContainerType.TIP;
@@ -162,7 +169,7 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
target.rank = MIGRATION_EXPERIMENT_IDENTIFIER;
// encoding migration type on pageIndex
target.pageIndex = pageIndex;
target.cardinality = HotseatPredictionController.MAX_ITEMS_FOR_MIGRATION;
target.cardinality = (workspaceItemCount * 1000) + hotseatItemsCount;
LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
UserEventDispatcher.newInstance(getContext()).dispatchUserEvent(event, null);
}
@@ -95,9 +95,6 @@ public class HotseatPredictionController implements DragController.DragListener,
private static final String TAG = "PredictiveHotseat";
private static final boolean DEBUG = false;
public static final int MAX_ITEMS_FOR_MIGRATION = DeviceConfig.getInt(
DeviceFlag.NAMESPACE_LAUNCHER, "max_homepage_items_for_migration", 5);
//TODO: replace this with AppTargetEvent.ACTION_UNPIN (b/144119543)
private static final int APPTARGET_ACTION_UNPIN = 4;
@@ -642,6 +639,9 @@ public class HotseatPredictionController implements DragController.DragListener,
if (isReady()) return;
int hotseatItemsCount = mHotseat.getShortcutsAndWidgets().getChildCount();
int maxItems = DeviceConfig.getInt(
DeviceFlag.NAMESPACE_LAUNCHER, "max_homepage_items_for_migration", 5);
// -1 to exclude smart space
int workspaceItemCount = mLauncher.getWorkspace().getScreenWithId(
Workspace.FIRST_SCREEN_ID).getShortcutsAndWidgets().getChildCount() - 1;
@@ -650,7 +650,7 @@ public class HotseatPredictionController implements DragController.DragListener,
// open spots in their hotseat and have more than maxItems in their hotseat + workspace
if (hotseatItemsCount == mHotSeatItemsCount && workspaceItemCount + hotseatItemsCount
> MAX_ITEMS_FOR_MIGRATION) {
> maxItems) {
mLauncher.getSharedPrefs().edit().putBoolean(HotseatEduController.KEY_HOTSEAT_EDU_SEEN,
true).apply();
@@ -662,8 +662,8 @@ public class HotseatPredictionController implements DragController.DragListener,
// temporarily encode details in log target (go/hotseat_migration)
target.rank = 2;
target.cardinality = MAX_ITEMS_FOR_MIGRATION;
target.pageIndex = (workspaceItemCount * 1000) + hotseatItemsCount;
target.cardinality = (workspaceItemCount * 1000) + hotseatItemsCount;
target.pageIndex = maxItems;
LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
UserEventDispatcher.newInstance(mLauncher).dispatchUserEvent(event, null);