Add new log events for widgets. am: 4ff5ee3a8f
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14425539 Change-Id: I6045a4bdcd8f6471188f3cba34eaf3a9e758d5cb
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.launcher3.uioverrides;
|
package com.android.launcher3.uioverrides;
|
||||||
|
|
||||||
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
|
||||||
|
|
||||||
import android.app.ActivityOptions;
|
import android.app.ActivityOptions;
|
||||||
import android.app.ActivityTaskManager;
|
import android.app.ActivityTaskManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
@@ -26,6 +28,7 @@ import android.view.View;
|
|||||||
import android.widget.RemoteViews;
|
import android.widget.RemoteViews;
|
||||||
|
|
||||||
import com.android.launcher3.Utilities;
|
import com.android.launcher3.Utilities;
|
||||||
|
import com.android.launcher3.logging.StatsLogManager;
|
||||||
import com.android.launcher3.model.data.ItemInfo;
|
import com.android.launcher3.model.data.ItemInfo;
|
||||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
import com.android.launcher3.util.ActivityOptionsWrapper;
|
||||||
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
||||||
@@ -72,9 +75,24 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
|
|||||||
mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options);
|
mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options);
|
||||||
}
|
}
|
||||||
options = Pair.create(options.first, activityOptions.options);
|
options = Pair.create(options.first, activityOptions.options);
|
||||||
|
if (pendingIntent.isActivity()) {
|
||||||
|
logAppLaunch(itemInfo);
|
||||||
|
}
|
||||||
return RemoteViews.startPendingIntent(hostView, pendingIntent, options);
|
return RemoteViews.startPendingIntent(hostView, pendingIntent, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Logs that the app was launched from the widget.
|
||||||
|
* @param itemInfo the widget info.
|
||||||
|
*/
|
||||||
|
private void logAppLaunch(Object itemInfo) {
|
||||||
|
StatsLogManager.StatsLogger logger = mLauncher.getStatsLogManager().logger();
|
||||||
|
if (itemInfo instanceof ItemInfo) {
|
||||||
|
logger.withItemInfo((ItemInfo) itemInfo);
|
||||||
|
}
|
||||||
|
logger.log(LAUNCHER_APP_LAUNCH_TAP);
|
||||||
|
}
|
||||||
|
|
||||||
private LauncherAppWidgetHostView findHostViewAncestor(View v) {
|
private LauncherAppWidgetHostView findHostViewAncestor(View v) {
|
||||||
while (v != null) {
|
while (v != null) {
|
||||||
if (v instanceof LauncherAppWidgetHostView) return (LauncherAppWidgetHostView) v;
|
if (v instanceof LauncherAppWidgetHostView) return (LauncherAppWidgetHostView) v;
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import static android.appwidget.AppWidgetHostView.getDefaultPaddingForWidget;
|
|||||||
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_HEIGHT;
|
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_HEIGHT;
|
||||||
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_WIDTH;
|
import static com.android.launcher3.LauncherAnimUtils.LAYOUT_WIDTH;
|
||||||
import static com.android.launcher3.Utilities.ATLEAST_S;
|
import static com.android.launcher3.Utilities.ATLEAST_S;
|
||||||
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_RESIZE_COMPLETED;
|
||||||
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_RESIZE_STARTED;
|
||||||
import static com.android.launcher3.views.BaseDragLayer.LAYOUT_X;
|
import static com.android.launcher3.views.BaseDragLayer.LAYOUT_X;
|
||||||
import static com.android.launcher3.views.BaseDragLayer.LAYOUT_Y;
|
import static com.android.launcher3.views.BaseDragLayer.LAYOUT_Y;
|
||||||
|
|
||||||
@@ -31,6 +33,10 @@ import android.widget.ImageView;
|
|||||||
|
|
||||||
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
|
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
|
||||||
import com.android.launcher3.dragndrop.DragLayer;
|
import com.android.launcher3.dragndrop.DragLayer;
|
||||||
|
import com.android.launcher3.logging.InstanceId;
|
||||||
|
import com.android.launcher3.logging.InstanceIdSequence;
|
||||||
|
import com.android.launcher3.model.data.ItemInfo;
|
||||||
|
import com.android.launcher3.util.PendingRequestArgs;
|
||||||
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
||||||
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
|
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
|
||||||
|
|
||||||
@@ -96,6 +102,8 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
|||||||
private final IntRange mDeltaYRange = new IntRange();
|
private final IntRange mDeltaYRange = new IntRange();
|
||||||
private final IntRange mBaselineY = new IntRange();
|
private final IntRange mBaselineY = new IntRange();
|
||||||
|
|
||||||
|
private final InstanceId logInstanceId = new InstanceIdSequence().newInstanceId();
|
||||||
|
|
||||||
private boolean mLeftBorderActive;
|
private boolean mLeftBorderActive;
|
||||||
private boolean mRightBorderActive;
|
private boolean mRightBorderActive;
|
||||||
private boolean mTopBorderActive;
|
private boolean mTopBorderActive;
|
||||||
@@ -222,12 +230,21 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
|||||||
mReconfigureButton = (ImageButton) findViewById(R.id.widget_reconfigure_button);
|
mReconfigureButton = (ImageButton) findViewById(R.id.widget_reconfigure_button);
|
||||||
if (info.isReconfigurable()) {
|
if (info.isReconfigurable()) {
|
||||||
mReconfigureButton.setVisibility(VISIBLE);
|
mReconfigureButton.setVisibility(VISIBLE);
|
||||||
mReconfigureButton.setOnClickListener(view -> mLauncher
|
mReconfigureButton.setOnClickListener(view -> {
|
||||||
|
mLauncher.setWaitingForResult(
|
||||||
|
PendingRequestArgs.forWidgetInfo(
|
||||||
|
mWidgetView.getAppWidgetId(),
|
||||||
|
// Widget add handler is null since we're reconfiguring an existing
|
||||||
|
// widget.
|
||||||
|
/* widgetHandler= */ null,
|
||||||
|
(ItemInfo) mWidgetView.getTag()));
|
||||||
|
mLauncher
|
||||||
.getAppWidgetHost()
|
.getAppWidgetHost()
|
||||||
.startConfigActivity(
|
.startConfigActivity(
|
||||||
mLauncher,
|
mLauncher,
|
||||||
mWidgetView.getAppWidgetId(),
|
mWidgetView.getAppWidgetId(),
|
||||||
Launcher.REQUEST_RECONFIGURE_APPWIDGET));
|
Launcher.REQUEST_RECONFIGURE_APPWIDGET);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we create the resize frame, we first mark all cells as unoccupied. The appropriate
|
// When we create the resize frame, we first mark all cells as unoccupied. The appropriate
|
||||||
@@ -235,6 +252,12 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
|||||||
// frame is dismissed.
|
// frame is dismissed.
|
||||||
mCellLayout.markCellsAsUnoccupiedForView(mWidgetView);
|
mCellLayout.markCellsAsUnoccupiedForView(mWidgetView);
|
||||||
|
|
||||||
|
mLauncher.getStatsLogManager()
|
||||||
|
.logger()
|
||||||
|
.withInstanceId(logInstanceId)
|
||||||
|
.withItemInfo((ItemInfo) mWidgetView.getTag())
|
||||||
|
.log(LAUNCHER_WIDGET_RESIZE_STARTED);
|
||||||
|
|
||||||
setOnKeyListener(this);
|
setOnKeyListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,6 +505,11 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
|
|||||||
|
|
||||||
// We are done with resizing the widget. Save the widget size & position to LauncherModel
|
// We are done with resizing the widget. Save the widget size & position to LauncherModel
|
||||||
resizeWidgetIfNeeded(true);
|
resizeWidgetIfNeeded(true);
|
||||||
|
mLauncher.getStatsLogManager()
|
||||||
|
.logger()
|
||||||
|
.withInstanceId(logInstanceId)
|
||||||
|
.withItemInfo((ItemInfo) mWidgetView.getTag())
|
||||||
|
.log(LAUNCHER_WIDGET_RESIZE_COMPLETED);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onTouchUp() {
|
private void onTouchUp() {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
|||||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_EXIT;
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_EXIT;
|
||||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME;
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME;
|
||||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP;
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP;
|
||||||
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_RECONFIGURED;
|
||||||
import static com.android.launcher3.model.ItemInstallQueue.FLAG_ACTIVITY_PAUSED;
|
import static com.android.launcher3.model.ItemInstallQueue.FLAG_ACTIVITY_PAUSED;
|
||||||
import static com.android.launcher3.model.ItemInstallQueue.FLAG_DRAG_AND_DROP;
|
import static com.android.launcher3.model.ItemInstallQueue.FLAG_DRAG_AND_DROP;
|
||||||
import static com.android.launcher3.model.ItemInstallQueue.FLAG_LOADER_RUNNING;
|
import static com.android.launcher3.model.ItemInstallQueue.FLAG_LOADER_RUNNING;
|
||||||
@@ -683,6 +684,7 @@ public class Launcher extends StatefulActivity<LauncherState> implements Launche
|
|||||||
completeAddAppWidget(appWidgetId, info, null, null);
|
completeAddAppWidget(appWidgetId, info, null, null);
|
||||||
break;
|
break;
|
||||||
case REQUEST_RECONFIGURE_APPWIDGET:
|
case REQUEST_RECONFIGURE_APPWIDGET:
|
||||||
|
mStatsLogManager.logger().withItemInfo(info).log(LAUNCHER_WIDGET_RECONFIGURED);
|
||||||
completeRestoreAppWidget(appWidgetId, LauncherAppWidgetInfo.RESTORE_COMPLETED);
|
completeRestoreAppWidget(appWidgetId, LauncherAppWidgetInfo.RESTORE_COMPLETED);
|
||||||
break;
|
break;
|
||||||
case REQUEST_BIND_PENDING_APPWIDGET: {
|
case REQUEST_BIND_PENDING_APPWIDGET: {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ import com.android.launcher3.model.data.ItemInfo;
|
|||||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||||
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
|
||||||
import com.android.launcher3.util.PackageManagerHelper;
|
import com.android.launcher3.util.PackageManagerHelper;
|
||||||
|
import com.android.launcher3.util.PendingRequestArgs;
|
||||||
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
|
import com.android.launcher3.widget.LauncherAppWidgetProviderInfo;
|
||||||
|
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
@@ -267,6 +268,8 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
|||||||
if (mCurrentAccessibilityAction == RECONFIGURE) {
|
if (mCurrentAccessibilityAction == RECONFIGURE) {
|
||||||
int widgetId = getReconfigurableWidgetId(view);
|
int widgetId = getReconfigurableWidgetId(view);
|
||||||
if (widgetId != INVALID_APPWIDGET_ID) {
|
if (widgetId != INVALID_APPWIDGET_ID) {
|
||||||
|
mLauncher.setWaitingForResult(
|
||||||
|
PendingRequestArgs.forWidgetInfo(widgetId, null, info));
|
||||||
mLauncher.getAppWidgetHost().startConfigActivity(mLauncher, widgetId,
|
mLauncher.getAppWidgetHost().startConfigActivity(mLauncher, widgetId,
|
||||||
REQUEST_RECONFIGURE_APPWIDGET);
|
REQUEST_RECONFIGURE_APPWIDGET);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ public class StatsLogManager implements ResourceBasedOverride {
|
|||||||
@UiEvent(doc = "User tapped or long pressed on widget tray icon inside launcher settings.")
|
@UiEvent(doc = "User tapped or long pressed on widget tray icon inside launcher settings.")
|
||||||
LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS(464),
|
LAUNCHER_WIDGETSTRAY_BUTTON_TAP_OR_LONGPRESS(464),
|
||||||
|
|
||||||
|
@UiEvent(doc = "User expanded the list of widgets for a single app in the widget picker.")
|
||||||
|
LAUNCHER_WIDGETSTRAY_APP_EXPANDED(818),
|
||||||
|
|
||||||
|
@UiEvent(doc = "User searched for a widget in the widget picker.")
|
||||||
|
LAUNCHER_WIDGETSTRAY_SEARCHED(819),
|
||||||
|
|
||||||
@UiEvent(doc = "A dragged item is dropped on 'Remove' button in the target bar")
|
@UiEvent(doc = "A dragged item is dropped on 'Remove' button in the target bar")
|
||||||
LAUNCHER_ITEM_DROPPED_ON_REMOVE(465),
|
LAUNCHER_ITEM_DROPPED_ON_REMOVE(465),
|
||||||
|
|
||||||
@@ -458,7 +464,16 @@ public class StatsLogManager implements ResourceBasedOverride {
|
|||||||
LAUNCHER_OVERVIEW_SHARING_TAP_MORE_TO_SHARE_URL(777),
|
LAUNCHER_OVERVIEW_SHARING_TAP_MORE_TO_SHARE_URL(777),
|
||||||
|
|
||||||
@UiEvent(doc = "User taps the More button to share an image")
|
@UiEvent(doc = "User taps the More button to share an image")
|
||||||
LAUNCHER_OVERVIEW_SHARING_TAP_MORE_TO_SHARE_IMAGE(778)
|
LAUNCHER_OVERVIEW_SHARING_TAP_MORE_TO_SHARE_IMAGE(778),
|
||||||
|
|
||||||
|
@UiEvent(doc = "User started resizing a widget on their home screen.")
|
||||||
|
LAUNCHER_WIDGET_RESIZE_STARTED(820),
|
||||||
|
|
||||||
|
@UiEvent(doc = "User finished resizing a widget on their home screen.")
|
||||||
|
LAUNCHER_WIDGET_RESIZE_COMPLETED(824),
|
||||||
|
|
||||||
|
@UiEvent(doc = "User reconfigured a widget on their home screen.")
|
||||||
|
LAUNCHER_WIDGET_RECONFIGURED(821)
|
||||||
;
|
;
|
||||||
|
|
||||||
// ADD MORE
|
// ADD MORE
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
package com.android.launcher3.widget.picker;
|
package com.android.launcher3.widget.picker;
|
||||||
|
|
||||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
|
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
|
||||||
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_SEARCHED;
|
||||||
import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL;
|
import static com.android.launcher3.testing.TestProtocol.NORMAL_STATE_ORDINAL;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
@@ -448,6 +449,7 @@ public class WidgetsFullSheet extends BaseWidgetSheet
|
|||||||
if (mIsInSearchMode) return;
|
if (mIsInSearchMode) return;
|
||||||
setViewVisibilityBasedOnSearch(/*isInSearchMode= */ true);
|
setViewVisibilityBasedOnSearch(/*isInSearchMode= */ true);
|
||||||
attachScrollbarToRecyclerView(mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView);
|
attachScrollbarToRecyclerView(mAdapters.get(AdapterHolder.SEARCH).mWidgetsRecyclerView);
|
||||||
|
mActivityContext.getStatsLogManager().logger().log(LAUNCHER_WIDGETSTRAY_SEARCHED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.launcher3.widget.picker;
|
package com.android.launcher3.widget.picker;
|
||||||
|
|
||||||
|
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_APP_EXPANDED;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -33,6 +35,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||||||
import androidx.recyclerview.widget.RecyclerView.Adapter;
|
import androidx.recyclerview.widget.RecyclerView.Adapter;
|
||||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
|
||||||
|
|
||||||
|
import com.android.launcher3.Launcher;
|
||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.WidgetPreviewLoader;
|
import com.android.launcher3.WidgetPreviewLoader;
|
||||||
import com.android.launcher3.icons.IconCache;
|
import com.android.launcher3.icons.IconCache;
|
||||||
@@ -76,6 +79,7 @@ public class WidgetsListAdapter extends Adapter<ViewHolder> implements OnHeaderC
|
|||||||
private static final int VIEW_TYPE_WIDGETS_HEADER = R.id.view_type_widgets_header;
|
private static final int VIEW_TYPE_WIDGETS_HEADER = R.id.view_type_widgets_header;
|
||||||
private static final int VIEW_TYPE_WIDGETS_SEARCH_HEADER = R.id.view_type_widgets_search_header;
|
private static final int VIEW_TYPE_WIDGETS_SEARCH_HEADER = R.id.view_type_widgets_search_header;
|
||||||
|
|
||||||
|
private final Launcher mLauncher;
|
||||||
private final WidgetsDiffReporter mDiffReporter;
|
private final WidgetsDiffReporter mDiffReporter;
|
||||||
private final SparseArray<ViewHolderBinder> mViewHolderBinders = new SparseArray<>();
|
private final SparseArray<ViewHolderBinder> mViewHolderBinders = new SparseArray<>();
|
||||||
private final WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
|
private final WidgetsListTableViewHolderBinder mWidgetsListTableViewHolderBinder;
|
||||||
@@ -97,6 +101,7 @@ public class WidgetsListAdapter extends Adapter<ViewHolder> implements OnHeaderC
|
|||||||
public WidgetsListAdapter(Context context, LayoutInflater layoutInflater,
|
public WidgetsListAdapter(Context context, LayoutInflater layoutInflater,
|
||||||
WidgetPreviewLoader widgetPreviewLoader, IconCache iconCache,
|
WidgetPreviewLoader widgetPreviewLoader, IconCache iconCache,
|
||||||
OnClickListener iconClickListener, OnLongClickListener iconLongClickListener) {
|
OnClickListener iconClickListener, OnLongClickListener iconLongClickListener) {
|
||||||
|
mLauncher = Launcher.getLauncher(context);
|
||||||
mDiffReporter = new WidgetsDiffReporter(iconCache, this);
|
mDiffReporter = new WidgetsDiffReporter(iconCache, this);
|
||||||
mWidgetsListTableViewHolderBinder = new WidgetsListTableViewHolderBinder(context,
|
mWidgetsListTableViewHolderBinder = new WidgetsListTableViewHolderBinder(context,
|
||||||
layoutInflater, iconClickListener, iconLongClickListener,
|
layoutInflater, iconClickListener, iconLongClickListener,
|
||||||
@@ -271,6 +276,7 @@ public class WidgetsListAdapter extends Adapter<ViewHolder> implements OnHeaderC
|
|||||||
// Scroll the layout manager to the header position to keep it anchored to the same
|
// Scroll the layout manager to the header position to keep it anchored to the same
|
||||||
// position.
|
// position.
|
||||||
scrollToPositionAndMaintainOffset(getSelectedHeaderPosition());
|
scrollToPositionAndMaintainOffset(getSelectedHeaderPosition());
|
||||||
|
mLauncher.getStatsLogManager().logger().log(LAUNCHER_WIDGETSTRAY_APP_EXPANDED);
|
||||||
} else if (packageUserKey.equals(mWidgetsContentVisiblePackageUserKey)) {
|
} else if (packageUserKey.equals(mWidgetsContentVisiblePackageUserKey)) {
|
||||||
OptionalInt previouslySelectedPosition = getSelectedHeaderPosition();
|
OptionalInt previouslySelectedPosition = getSelectedHeaderPosition();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user