From 1823bdba6e900b2c0eb3d864cd822452b244db16 Mon Sep 17 00:00:00 2001 From: Schneider Victor-tulias Date: Wed, 6 Apr 2022 14:24:20 -0700 Subject: [PATCH] Add logging to debug incorrect taskbar states caught by flaky tests. - Various TAPL tasts are flaking because the taskbar is present when navigating home. Several TAPL taskbar tests are also flaking because the taskbar is missing when opening an app. Adding logging to catch when FLAG_IN_APP is being set and why it isn't being applied. Bug: 227657604 Bug: 225205246 Test: manual Change-Id: Ia976bb0a6c7764e571fab3ac98ee21ff22ef7674 --- .../launcher3/taskbar/TaskbarStashController.java | 14 ++++++++++++++ .../android/launcher3/testing/TestProtocol.java | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java index 06107b8904..7079cd507c 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarStashController.java @@ -28,10 +28,12 @@ import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.annotation.Nullable; import android.content.SharedPreferences; +import android.util.Log; import android.view.ViewConfiguration; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Utilities; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.quickstep.AnimatedFloat; import com.android.quickstep.SystemUiProxy; @@ -556,6 +558,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba * unstashed. */ public void updateStateForFlag(int flag, boolean enabled) { + if (flag == FLAG_IN_APP && TestProtocol.sDebugTracing) { + Log.d(TestProtocol.TASKBAR_IN_APP_STATE, String.format( + "setting flag FLAG_IN_APP to: %b", enabled), new Exception()); + } if (enabled) { mState |= flag; } else { @@ -653,6 +659,14 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba } boolean isStashed = mStashCondition.test(flags); if (mIsStashed != isStashed) { + if (TestProtocol.sDebugTracing) { + Log.d(TestProtocol.TASKBAR_IN_APP_STATE, String.format( + "setState: mIsStashed=%b, isStashed=%b, duration=%d, start=:%b", + mIsStashed, + isStashed, + duration, + start)); + } mIsStashed = isStashed; // This sets mAnimator. diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index faf5817795..e8fd2ffd09 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -136,6 +136,6 @@ public final class TestProtocol { public static final String NO_DROP_TARGET = "b/195031154"; public static final String NULL_INT_SET = "b/200572078"; public static final String MISSING_PROMISE_ICON = "b/202985412"; - public static final String BAD_STATE = "b/223498680"; + public static final String TASKBAR_IN_APP_STATE = "b/227657604"; }