mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Add new log events for widgets.
Design doc: go/widgets-logging Bug: 185778648 Test: manual Change-Id: Ia3c6edb87766a33e77865e9461e7101a1df864c1
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
|
||||
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.app.PendingIntent;
|
||||
@@ -26,6 +28,7 @@ import android.view.View;
|
||||
import android.widget.RemoteViews;
|
||||
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.logging.StatsLogManager;
|
||||
import com.android.launcher3.model.data.ItemInfo;
|
||||
import com.android.launcher3.util.ActivityOptionsWrapper;
|
||||
import com.android.launcher3.widget.LauncherAppWidgetHostView;
|
||||
@@ -72,9 +75,24 @@ class QuickstepInteractionHandler implements RemoteViews.InteractionHandler {
|
||||
mLauncher.addLaunchCookie((ItemInfo) itemInfo, activityOptions.options);
|
||||
}
|
||||
options = Pair.create(options.first, activityOptions.options);
|
||||
if (pendingIntent.isActivity()) {
|
||||
logAppLaunch(itemInfo);
|
||||
}
|
||||
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) {
|
||||
while (v != null) {
|
||||
if (v instanceof LauncherAppWidgetHostView) return (LauncherAppWidgetHostView) v;
|
||||
|
||||
Reference in New Issue
Block a user