Check NPE and log error condition for enableBlockingTimeout in test harness.

Similar to enableTransientTaskbar changes in
ag/Ifa929dca18437ae101cf3290feda4209790604d2

This method differs from enableManualTaskbarStashing in that we call it during setup/teardown and so in these cases TaskbarActivityContext
being null may be valid. For instance, as part of the teardown,
taskbar may have already been destroyed so enabling blocking timeout
may be a moot point — adding logs can help verify that assumption.

Bug: 259337908
Bug: 257549303
Test: TaplTestsTaskbar
Change-Id: I2eeb02573670a503687ca7aa364d14f3124cd0ef
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index 65614ba..713b016 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -179,9 +179,15 @@
 
     private void enableBlockingTimeout(
             TouchInteractionService.TISBinder tisBinder, boolean enable) {
-        // Allow null-pointer to catch illegal states.
-        tisBinder.getTaskbarManager().getCurrentActivityContext().enableBlockingTimeoutDuringTests(
-                enable);
+        TaskbarActivityContext context = tisBinder.getTaskbarManager().getCurrentActivityContext();
+        if (context == null) {
+            if (TestProtocol.sDebugTracing) {
+                Log.d(NPE_TRANSIENT_TASKBAR, "enableBlockingTimeout: enable=" + enable,
+                        new Exception());
+            }
+        } else {
+            context.enableBlockingTimeoutDuringTests(enable);
+        }
     }
 
     private void enableTransientTaskbar(