Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5d145f3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents ba45b670 40846c6a
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Insettable;
import com.android.launcher3.Insettable;
import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.R;
import com.android.launcher3.Workspace;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.logging.UserEventDispatcher;
@@ -153,6 +154,12 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
    private void logUserAction(boolean migrated, int pageIndex) {
    private void logUserAction(boolean migrated, int pageIndex) {
        LauncherLogProto.Action action = new LauncherLogProto.Action();
        LauncherLogProto.Action action = new LauncherLogProto.Action();
        LauncherLogProto.Target target = new LauncherLogProto.Target();
        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.type = LauncherLogProto.Action.Type.TOUCH;
        action.touch = LauncherLogProto.Action.Touch.TAP;
        action.touch = LauncherLogProto.Action.Touch.TAP;
        target.containerType = LauncherLogProto.ContainerType.TIP;
        target.containerType = LauncherLogProto.ContainerType.TIP;
@@ -162,7 +169,7 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
        target.rank = MIGRATION_EXPERIMENT_IDENTIFIER;
        target.rank = MIGRATION_EXPERIMENT_IDENTIFIER;
        // encoding migration type on pageIndex
        // encoding migration type on pageIndex
        target.pageIndex = pageIndex;
        target.pageIndex = pageIndex;
        target.cardinality = HotseatPredictionController.MAX_ITEMS_FOR_MIGRATION;
        target.cardinality = (workspaceItemCount * 1000) + hotseatItemsCount;
        LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
        LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
        UserEventDispatcher.newInstance(getContext()).dispatchUserEvent(event, null);
        UserEventDispatcher.newInstance(getContext()).dispatchUserEvent(event, null);
    }
    }
+6 −6
Original line number Original line Diff line number Diff line
@@ -95,9 +95,6 @@ public class HotseatPredictionController implements DragController.DragListener,
    private static final String TAG = "PredictiveHotseat";
    private static final String TAG = "PredictiveHotseat";
    private static final boolean DEBUG = false;
    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)
    //TODO: replace this with AppTargetEvent.ACTION_UNPIN (b/144119543)
    private static final int APPTARGET_ACTION_UNPIN = 4;
    private static final int APPTARGET_ACTION_UNPIN = 4;


@@ -642,6 +639,9 @@ public class HotseatPredictionController implements DragController.DragListener,
        if (isReady()) return;
        if (isReady()) return;
        int hotseatItemsCount = mHotseat.getShortcutsAndWidgets().getChildCount();
        int hotseatItemsCount = mHotseat.getShortcutsAndWidgets().getChildCount();


        int maxItems = DeviceConfig.getInt(
                DeviceFlag.NAMESPACE_LAUNCHER, "max_homepage_items_for_migration", 5);

        // -1 to exclude smart space
        // -1 to exclude smart space
        int workspaceItemCount = mLauncher.getWorkspace().getScreenWithId(
        int workspaceItemCount = mLauncher.getWorkspace().getScreenWithId(
                Workspace.FIRST_SCREEN_ID).getShortcutsAndWidgets().getChildCount() - 1;
                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
        // open spots in their hotseat and have more than maxItems in their hotseat + workspace


        if (hotseatItemsCount == mHotSeatItemsCount && workspaceItemCount + hotseatItemsCount
        if (hotseatItemsCount == mHotSeatItemsCount && workspaceItemCount + hotseatItemsCount
                > MAX_ITEMS_FOR_MIGRATION) {
                > maxItems) {
            mLauncher.getSharedPrefs().edit().putBoolean(HotseatEduController.KEY_HOTSEAT_EDU_SEEN,
            mLauncher.getSharedPrefs().edit().putBoolean(HotseatEduController.KEY_HOTSEAT_EDU_SEEN,
                    true).apply();
                    true).apply();


@@ -662,8 +662,8 @@ public class HotseatPredictionController implements DragController.DragListener,


            // temporarily encode details in log target (go/hotseat_migration)
            // temporarily encode details in log target (go/hotseat_migration)
            target.rank = 2;
            target.rank = 2;
            target.cardinality = MAX_ITEMS_FOR_MIGRATION;
            target.cardinality = (workspaceItemCount * 1000) + hotseatItemsCount;
            target.pageIndex = (workspaceItemCount * 1000) + hotseatItemsCount;
            target.pageIndex = maxItems;
            LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
            LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
            UserEventDispatcher.newInstance(mLauncher).dispatchUserEvent(event, null);
            UserEventDispatcher.newInstance(mLauncher).dispatchUserEvent(event, null);