Merge "Log tap on app info within task menu." into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot 2020-06-04 19:09:05 +00:00 committed by Android (Google) Code Review
commit 7a41d1e909
3 changed files with 17 additions and 4 deletions

View File

@ -37,6 +37,7 @@ import android.view.View;
import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R; import com.android.launcher3.R;
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logging.StatsLogManager.LauncherEvent; import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.model.WellbeingModel;
import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo;
@ -71,7 +72,16 @@ public interface TaskShortcutFactory {
static WorkspaceItemInfo dummyInfo(TaskView view) { static WorkspaceItemInfo dummyInfo(TaskView view) {
Task task = view.getTask(); Task task = view.getTask();
WorkspaceItemInfo dummyInfo = new WorkspaceItemInfo(); WorkspaceItemInfo dummyInfo = new WorkspaceItemInfo(){
/**
* Helps to log events as {@link LauncherAtom.Task}
* instead of {@link LauncherAtom.ItemInfo}.
*/
@Override
public LauncherAtom.ItemInfo buildProto() {
return view.buildProto();
}
};
dummyInfo.intent = new Intent(); dummyInfo.intent = new Intent();
ComponentName component = task.getTopComponent(); ComponentName component = task.getTopComponent();
dummyInfo.getIntent().setComponent(component); dummyInfo.getIntent().setComponent(component);

View File

@ -223,7 +223,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
setOutlineProvider(mOutlineProvider); setOutlineProvider(mOutlineProvider);
} }
/** Builds proto for logging */ /**
* Builds proto for logging
*/
public LauncherAtom.ItemInfo buildProto() { public LauncherAtom.ItemInfo buildProto() {
ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(getTask().key); ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(getTask().key);
LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder(); LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder();

View File

@ -29,6 +29,7 @@ import com.android.launcher3.util.PackageUserKey;
import com.android.launcher3.widget.WidgetsBottomSheet; import com.android.launcher3.widget.WidgetsBottomSheet;
import java.util.List; import java.util.List;
/** /**
* Represents a system shortcut for a given app. The shortcut should have a label and icon, and an * Represents a system shortcut for a given app. The shortcut should have a label and icon, and an
* onClickListener that depends on the item that the shortcut services. * onClickListener that depends on the item that the shortcut services.
@ -142,8 +143,8 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite
mTarget.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP, mTarget.getUserEventDispatcher().logActionOnControl(Action.Touch.TAP,
ControlType.APPINFO_TARGET, view); ControlType.APPINFO_TARGET, view);
// TODO(thiruram): Fix missing container info when item is inside folder. // TODO(thiruram): Fix missing container info when item is inside folder.
mTarget.getStatsLogManager().log(LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP, mTarget.getStatsLogManager()
mItemInfo.buildProto()); .log(LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP, mItemInfo.buildProto());
} }
} }