Log tap on dot-notifications on both app icon and deep shortcuts.

Bug: 157765763
Sample Log: https://paste.googleplex.com/6354213825150976
Screencast: http://go/recall/-/fuZYA4w9pUEvRlF811dY61/ecVIR0vyJ2thQwLbUL64Ar

Change-Id: I6e1ed381d551044a1ad94b72b3f431223a888a72
This commit is contained in:
thiruram
2020-06-01 17:17:24 -07:00
committed by Thiru Ramasamy
parent 488044fc2e
commit 3cb5592c84
3 changed files with 14 additions and 3 deletions

View File

@@ -16,6 +16,8 @@
package com.android.launcher3.notification;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_NOTIFICATION_LAUNCH_TAP;
import android.app.ActivityOptions;
import android.app.Notification;
import android.app.PendingIntent;
@@ -32,6 +34,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.dot.DotInfo;
import com.android.launcher3.graphics.IconPalette;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.util.PackageUserKey;
/**
@@ -51,6 +54,7 @@ public class NotificationInfo implements View.OnClickListener {
public final boolean autoCancel;
public final boolean dismissable;
private final ItemInfo mItemInfo;
private Drawable mIconDrawable;
private int mIconColor;
private boolean mIsIconLarge;
@@ -58,7 +62,8 @@ public class NotificationInfo implements View.OnClickListener {
/**
* Extracts the data that we need from the StatusBarNotification.
*/
public NotificationInfo(Context context, StatusBarNotification statusBarNotification) {
public NotificationInfo(Context context, StatusBarNotification statusBarNotification,
ItemInfo itemInfo) {
packageUserKey = PackageUserKey.fromNotification(statusBarNotification);
notificationKey = statusBarNotification.getKey();
Notification notification = statusBarNotification.getNotification();
@@ -88,6 +93,7 @@ public class NotificationInfo implements View.OnClickListener {
intent = notification.contentIntent;
autoCancel = (notification.flags & Notification.FLAG_AUTO_CANCEL) != 0;
dismissable = (notification.flags & Notification.FLAG_ONGOING_EVENT) == 0;
this.mItemInfo = itemInfo;
}
@Override
@@ -101,6 +107,8 @@ public class NotificationInfo implements View.OnClickListener {
try {
intent.send(null, 0, null, null, null, null, activityOptions);
launcher.getUserEventDispatcher().logNotificationLaunch(view, intent);
launcher.getStatsLogManager()
.log(LAUNCHER_NOTIFICATION_LAUNCH_TAP, mItemInfo.buildProto());
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}