Add debug logs for testPromiseIcon_addedFromEligibleSession

Bug: 202985412
Test: PromiseIconUiTest
Change-Id: I160b9229bebe07015575f8184ac2d53bcbf2bad0
diff --git a/src/com/android/launcher3/SessionCommitReceiver.java b/src/com/android/launcher3/SessionCommitReceiver.java
index 558538c..b81637f 100644
--- a/src/com/android/launcher3/SessionCommitReceiver.java
+++ b/src/com/android/launcher3/SessionCommitReceiver.java
@@ -24,12 +24,14 @@
 import android.content.pm.PackageManager;
 import android.os.UserHandle;
 import android.text.TextUtils;
+import android.util.Log;
 
 import androidx.annotation.WorkerThread;
 
 import com.android.launcher3.logging.FileLog;
 import com.android.launcher3.model.ItemInstallQueue;
 import com.android.launcher3.pm.InstallSessionHelper;
+import com.android.launcher3.testing.TestProtocol;
 import com.android.launcher3.util.Executors;
 
 /**
@@ -51,6 +53,9 @@
     private static void processIntent(Context context, Intent intent) {
         if (!isEnabled(context)) {
             // User has decided to not add icons on homescreen.
+            if (TestProtocol.sDebugTracing) {
+                Log.d(TestProtocol.MISSING_PROMISE_ICON, LOG + " not enabled");
+            }
             return;
         }
 
@@ -59,6 +64,9 @@
         if (!PackageInstaller.ACTION_SESSION_COMMITTED.equals(intent.getAction())
                 || info == null || user == null) {
             // Invalid intent.
+            if (TestProtocol.sDebugTracing) {
+                Log.d(TestProtocol.MISSING_PROMISE_ICON, LOG + " invalid intent");
+            }
             return;
         }
 
@@ -68,6 +76,15 @@
                 || info.getInstallReason() != PackageManager.INSTALL_REASON_USER
                 || packageInstallerCompat.promiseIconAddedForId(info.getSessionId())) {
             packageInstallerCompat.removePromiseIconId(info.getSessionId());
+            if (TestProtocol.sDebugTracing) {
+                int id = info.getSessionId();
+                Log.d(TestProtocol.MISSING_PROMISE_ICON, LOG
+                        + ", TextUtils.isEmpty=" + TextUtils.isEmpty(info.getAppPackageName())
+                        + ", info.getInstallReason()=" + info.getInstallReason()
+                        + ", INSTALL_REASON_USER=" + PackageManager.INSTALL_REASON_USER
+                        + ", icon added=" + packageInstallerCompat.promiseIconAddedForId(id)
+                );
+            }
             return;
         }