Merge "Log result of notification pending intent launch" into tm-dev am: b6e4780466 am: 3a2df837f0

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17451463

Change-Id: If0a64d3a6883d7376e7ab30349faaa5a7519b1d0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
index 6fe92fa..87ca942 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarter.java
@@ -489,7 +489,7 @@
             ExpandableNotificationRow row,
             boolean animate,
             boolean isActivityIntent) {
-        mLogger.logStartNotificationIntent(entry.getKey(), intent);
+        mLogger.logStartNotificationIntent(entry.getKey());
         try {
             Runnable onFinishAnimationCallback = animate
                     ? () -> mLaunchEventsEmitter.notifyFinishLaunchNotifActivity(entry)
@@ -513,8 +513,10 @@
                                 mKeyguardStateController.isShowing(),
                                 eventTime)
                                 : getActivityOptions(mCentralSurfaces.getDisplayId(), adapter);
-                        return intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
+                        int result = intent.sendAndReturnResult(mContext, 0, fillInIntent, null,
                                 null, null, options);
+                        mLogger.logSendPendingIntent(entry.getKey(), intent, result);
+                        return result;
                     });
         } catch (PendingIntent.CanceledException e) {
             // the stack trace isn't very helpful here.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt
index d118747..2fbe520 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarNotificationActivityStarterLogger.kt
@@ -32,7 +32,7 @@
         buffer.log(TAG, DEBUG, {
             str1 = key
         }, {
-            "(1/4) onNotificationClicked: $str1"
+            "(1/5) onNotificationClicked: $str1"
         })
     }
 
@@ -40,7 +40,7 @@
         buffer.log(TAG, DEBUG, {
             str1 = key
         }, {
-            "(2/4) handleNotificationClickAfterKeyguardDismissed: $str1"
+            "(2/5) handleNotificationClickAfterKeyguardDismissed: $str1"
         })
     }
 
@@ -48,16 +48,25 @@
         buffer.log(TAG, DEBUG, {
             str1 = key
         }, {
-            "(3/4) handleNotificationClickAfterPanelCollapsed: $str1"
+            "(3/5) handleNotificationClickAfterPanelCollapsed: $str1"
         })
     }
 
-    fun logStartNotificationIntent(key: String, pendingIntent: PendingIntent) {
+    fun logStartNotificationIntent(key: String) {
+        buffer.log(TAG, INFO, {
+            str1 = key
+        }, {
+            "(4/5) startNotificationIntent: $str1"
+        })
+    }
+
+    fun logSendPendingIntent(key: String, pendingIntent: PendingIntent, result: Int) {
         buffer.log(TAG, INFO, {
             str1 = key
             str2 = pendingIntent.intent.toString()
+            int1 = result
         }, {
-            "(4/4) Starting $str2 for notification $str1"
+            "(5/5) Started intent $str2 for notification $str1 with result code $int1"
         })
     }