From 30cc32411771d1dcc1a98d370c94c60200b71207 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 16 Nov 2022 15:51:10 -0800 Subject: [PATCH] Check NPE and log error condition for enableBlockingTimeout in test harness. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../quickstep/QuickstepTestInformationHandler.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java index 65614ba966..713b01654c 100644 --- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -179,9 +179,15 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { 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(