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

Commit b641ac2a authored by Samuel Fufa's avatar Samuel Fufa
Browse files

Log Hotseat onboarding user actions

+ Resolve notifiaciton dot scale issue

Bug: 147336566
Bug: 148232056
Change-Id: I0120dc183a876fda38f4682425697378c7be20f3
parent 47a73672
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -120,6 +120,8 @@ enum ControlType {
  BACK_GESTURE = 19;
  UNDO = 20;
  DISMISS_PREDICTION = 21;
  HYBRID_HOTSEAT_ACCEPTED = 22;
  HYBRID_HOTSEAT_CANCELED = 23;
}

enum TipType {
@@ -129,6 +131,7 @@ enum TipType {
  QUICK_SCRUB_TEXT = 3;
  PREDICTION_TEXT = 4;
  DWB_TOAST = 5;
  HYBRID_HOTSEAT = 6;
}

// Used to define the action component of the LauncherEvent.
+28 −0
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@
 */
package com.android.launcher3.hybridhotseat;

import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.HYBRID_HOTSEAT_CANCELED;

import android.animation.PropertyValuesHolder;
import android.content.Context;
import android.content.res.Configuration;
@@ -32,6 +35,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.WorkspaceItemInfo;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.uioverrides.PredictedAppIcon;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.views.AbstractSlideInView;
@@ -95,6 +99,7 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
        handleClose(true);
        mHotseatEduController.migrate();
        mHotseatEduController.finishOnboarding();
        logUserAction(true);
        Toast.makeText(mLauncher, R.string.hotseat_items_migrated, Toast.LENGTH_LONG).show();
    }

@@ -102,6 +107,7 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
        if (mHotseatEduController == null) return;
        Toast.makeText(getContext(), R.string.hotseat_no_migration, Toast.LENGTH_LONG).show();
        mHotseatEduController.finishOnboarding();
        logUserAction(false);
        handleClose(true);
    }

@@ -133,7 +139,28 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
                mLauncher.getDeviceProfile().hotseatBarSizePx + insets.bottom;
    }


    private void logUserAction(boolean migrated) {
        LauncherLogProto.Action action = new LauncherLogProto.Action();
        LauncherLogProto.Target target = new LauncherLogProto.Target();
        action.type = LauncherLogProto.Action.Type.TOUCH;
        action.touch = LauncherLogProto.Action.Touch.TAP;
        target.containerType = LauncherLogProto.ContainerType.TIP;
        target.tipType = LauncherLogProto.TipType.HYBRID_HOTSEAT;
        target.controlType = migrated ? LauncherLogProto.ControlType.HYBRID_HOTSEAT_ACCEPTED
                : HYBRID_HOTSEAT_CANCELED;
        LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
        UserEventDispatcher.newInstance(getContext()).dispatchUserEvent(event, null);
    }

    private void logOnBoardingSeen() {
        LauncherLogProto.Action action = new LauncherLogProto.Action();
        LauncherLogProto.Target target = new LauncherLogProto.Target();
        action.type = LauncherLogProto.Action.Type.TIP;
        target.containerType = LauncherLogProto.ContainerType.TIP;
        target.tipType = LauncherLogProto.TipType.HYBRID_HOTSEAT;
        LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target);
        UserEventDispatcher.newInstance(getContext()).dispatchUserEvent(event, null);
    }
    private void animateOpen() {
        if (mIsOpen || mOpenCloseAnimator.isRunning()) {
            return;
@@ -165,6 +192,7 @@ public class HotseatEduDialog extends AbstractSlideInView implements Insettable
            return;
        }
        mLauncher.getDragLayer().addView(this);
        logOnBoardingSeen();
        animateOpen();
        for (int i = 0; i < mLauncher.getDeviceProfile().inv.numHotseatIcons; i++) {
            WorkspaceItemInfo info = predictions.get(i);
+1 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public class PredictedAppIcon extends DoubleShadowBubbleTextView {
        mIsDrawingDot = true;
        int count = canvas.save();
        canvas.translate(-getWidth() * RING_EFFECT_RATIO, -getHeight() * RING_EFFECT_RATIO);
        canvas.scale(1 + 2 * RING_EFFECT_RATIO, 1 + 2 * RING_EFFECT_RATIO);
        super.drawDotIfNecessary(canvas);
        canvas.restoreToCount(count);
        mIsDrawingDot = false;
+3 −3
Original line number Diff line number Diff line
@@ -67,13 +67,13 @@
    <string  name="back_gesture_tutorial_close_button_content_description" translatable="false">Close</string>

    <!-- Hotseat migration notification title -->
    <string translatable="false" name="hotseat_migrate_prompt_title">Get suggested apps on the home screen</string>
    <string translatable="false" name="hotseat_migrate_prompt_title">Easily access your most-used apps</string>
    <!-- Hotseat migration notification content -->
    <string translatable="false" name="hotseat_migrate_prompt_content">Tap to set up</string>
    <string translatable="false" name="hotseat_migrate_prompt_content">Pixel suggests your favorite apps based on your routines. Tap to learn more.</string>
    <!-- Hotseat migration wizard title -->
    <string translatable="false" name="hotseat_migrate_title">Suggested apps replace the bottom row of apps</string>
    <!-- Hotseat migration wizard message -->
    <string translatable="false" name="hotseat_migrate_message">To pin a favorite app, drag it over a suggested app. To hide a suggested app, touch &amp; hold it.</string>
    <string translatable="false" name="hotseat_migrate_message">Your current apps will move to the last screen. To pin or block a suggested app, drag it off the bottom row.</string>
    <!-- Toast message user sees after opting into fully predicted hybrid hotseat -->
    <string translatable="false" name="hotseat_items_migrated">Bottom row of apps moved to last screen</string>
    <!-- Toast message user sees after opting into fully predicted hybrid hotseat -->
+6 −4
Original line number Diff line number Diff line
@@ -49,8 +49,9 @@ public class FileLogTest {
    @After
    public void tearDown() {
        // Clear existing logs
        new File(mTempDir, "log-0").delete();
        new File(mTempDir, "log-1").delete();
        for (int i = 0; i < FileLog.LOG_DAYS; i++) {
            new File(mTempDir, "log-" + i).delete();
        }
        mTempDir.delete();

        mTestActive = false;
@@ -89,8 +90,9 @@ public class FileLogTest {

        Calendar threeDaysAgo = Calendar.getInstance();
        threeDaysAgo.add(Calendar.HOUR, -72);
        new File(mTempDir, "log-0").setLastModified(threeDaysAgo.getTimeInMillis());
        new File(mTempDir, "log-1").setLastModified(threeDaysAgo.getTimeInMillis());
        for (int i = 0; i < FileLog.LOG_DAYS; i++) {
            new File(mTempDir, "log-" + i).setLastModified(threeDaysAgo.getTimeInMillis());
        }

        FileLog.print("Testing", "abracadabra", new Exception("cat! cat!"));
        writer = new StringWriter();
Loading