From 067faf3bbe993a498faf449bdc66360ae344b6c6 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 3 Nov 2021 11:17:44 -0700 Subject: [PATCH] Add some logging for taskbar recreation Bug: 201305599 Test: Manual Change-Id: I437fe3226657ebe7b5507146fbe5e7f32e2e2fce --- .../launcher3/taskbar/TaskbarActivityContext.java | 8 ++++++++ .../com/android/launcher3/taskbar/TaskbarManager.java | 11 +++++++++++ .../android/quickstep/TouchInteractionService.java | 7 +++++++ src/com/android/launcher3/testing/TestProtocol.java | 1 + 4 files changed, 27 insertions(+) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index 72d9d5b0b1..5bc454ec89 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -20,6 +20,7 @@ import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_M import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; +import static com.android.launcher3.testing.TestProtocol.TASKBAR_WINDOW_CRASH; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED; import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_QUICK_SETTINGS_EXPANDED; import static com.android.systemui.shared.system.WindowManagerWrapper.ITYPE_BOTTOM_TAPPABLE_ELEMENT; @@ -60,6 +61,7 @@ import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.touch.ItemClickHandler; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.SettingsCache; @@ -200,6 +202,9 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ updateSysuiStateFlags(sharedState.sysuiStateFlags, true /* fromInit */); mWindowManager.addView(mDragLayer, mWindowLayoutParams); + if (TestProtocol.sDebugTracing) { + Log.e(TASKBAR_WINDOW_CRASH, "Adding taskbar window"); + } } public boolean isThreeButtonNav() { @@ -330,6 +335,9 @@ public class TaskbarActivityContext extends ContextThemeWrapper implements Activ setUIController(TaskbarUIController.DEFAULT); mControllers.onDestroy(); mWindowManager.removeViewImmediate(mDragLayer); + if (TestProtocol.sDebugTracing) { + Log.e(TASKBAR_WINDOW_CRASH, "Removing taskbar window"); + } } public void updateSysuiStateFlags(int systemUiStateFlags, boolean fromInit) { diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 089c265209..53feaad9e6 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -17,6 +17,8 @@ package com.android.launcher3.taskbar; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL; + +import static com.android.launcher3.testing.TestProtocol.TASKBAR_WINDOW_CRASH; import static com.android.launcher3.util.DisplayController.CHANGE_ACTIVE_SCREEN; import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY; import static com.android.launcher3.util.DisplayController.CHANGE_SUPPORTED_BOUNDS; @@ -29,6 +31,7 @@ import android.content.res.Configuration; import android.hardware.display.DisplayManager; import android.net.Uri; import android.provider.Settings; +import android.util.Log; import android.view.Display; import androidx.annotation.NonNull; @@ -39,6 +42,7 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.statemanager.StatefulActivity; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.DisplayController.Info; import com.android.launcher3.util.SettingsCache; @@ -203,6 +207,10 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen } private void recreateTaskbar() { + if (TestProtocol.sDebugTracing) { + Log.e(TASKBAR_WINDOW_CRASH, "Recreating taskbar: mTaskbarActivityContext=" + + mTaskbarActivityContext); + } destroyExistingTaskbar(); DeviceProfile dp = @@ -225,6 +233,9 @@ public class TaskbarManager implements DisplayController.DisplayInfoChangeListen mTaskbarActivityContext.setUIController( createTaskbarUIControllerForActivity(mActivity)); } + if (TestProtocol.sDebugTracing) { + Log.e(TASKBAR_WINDOW_CRASH, "Finished recreating taskbar"); + } } public void onSystemUiFlagsChanged(int systemUiStateFlags) { diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index ecc4b2b07d..b56c1b7efa 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -22,6 +22,7 @@ import static android.view.MotionEvent.ACTION_UP; import static com.android.launcher3.config.FeatureFlags.ASSISTANT_GIVES_LAUNCHER_FOCUS; import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE; +import static com.android.launcher3.testing.TestProtocol.TASKBAR_WINDOW_CRASH; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; import static com.android.quickstep.GestureState.DEFAULT_STATE; import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS; @@ -350,6 +351,9 @@ public class TouchInteractionService extends Service @Override public void onCreate() { super.onCreate(); + if (TestProtocol.sDebugTracing) { + Log.e(TASKBAR_WINDOW_CRASH, "TIS created"); + } // Initialize anything here that is needed in direct boot mode. // Everything else should be initialized in onUserUnlocked() below. mMainChoreographer = Choreographer.getInstance(); @@ -511,6 +515,9 @@ public class TouchInteractionService extends Service @Override public void onDestroy() { Log.d(TAG, "Touch service destroyed: user=" + getUserId()); + if (TestProtocol.sDebugTracing) { + Log.e(TASKBAR_WINDOW_CRASH, "TIS destroyed"); + } sIsInitialized = false; if (mDeviceState.isUserUnlocked()) { mInputConsumer.unregisterInputConsumer(); diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 5bf0342fcc..5e8da67a38 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -119,6 +119,7 @@ public final class TestProtocol { public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation"; public static final String PERMANENT_DIAG_TAG = "TaplTarget"; + public static final String TASKBAR_WINDOW_CRASH = "b/201305599"; public static final String TASK_VIEW_ID_CRASH = "b/195430732"; public static final String NO_DROP_TARGET = "b/195031154"; public static final String NULL_INT_SET = "b/200572078";