Add debugging logs to understand why taskbar root layout would be null
Add debugging logs to understand why taskbar root layout would be null.
Flag: EXEMPT not adding new behavior
Bug: 382378283
Test: Manual
Change-Id: I1140360274667a6c3766f03e1f5f1592c09e13e1
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index 21c8255..b069846 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -89,6 +89,8 @@
public class TaskbarManager {
private static final String TAG = "TaskbarManager";
private static final boolean DEBUG = false;
+ // TODO(b/382378283) remove all logs with this tag
+ public static final String NULL_TASKBAR_ROOT_LAYOUT_TAG = "b/382378283";
/**
* All the configurations which do not initiate taskbar recreation.
@@ -151,6 +153,20 @@
private class RecreationListener implements DisplayController.DisplayInfoChangeListener {
@Override
public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) {
+
+ if ((flags & CHANGE_DENSITY) != 0) {
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG, "Display density changed");
+ }
+ if ((flags & CHANGE_NAVIGATION_MODE) != 0) {
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG, "Navigation mode changed");
+ }
+ if ((flags & CHANGE_DESKTOP_MODE) != 0) {
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG, "Desktop mode changed");
+ }
+ if ((flags & CHANGE_TASKBAR_PINNING) != 0) {
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG, "Taskbar pinning changed");
+ }
+
if ((flags & (CHANGE_DENSITY | CHANGE_NAVIGATION_MODE | CHANGE_DESKTOP_MODE
| CHANGE_TASKBAR_PINNING)) != 0) {
recreateTaskbar();
@@ -547,9 +563,14 @@
if (enableTaskbarNoRecreate()) {
addTaskbarRootViewToWindow(displayId);
FrameLayout taskbarRootLayout = getTaskbarRootLayoutForDisplay(displayId);
- taskbarRootLayout.removeAllViews();
- taskbarRootLayout.addView(taskbar.getDragLayer());
- taskbar.notifyUpdateLayoutParams();
+ if (taskbarRootLayout != null) {
+ taskbarRootLayout.removeAllViews();
+ taskbarRootLayout.addView(taskbar.getDragLayer());
+ taskbar.notifyUpdateLayoutParams();
+ } else {
+ Log.e(NULL_TASKBAR_ROOT_LAYOUT_TAG,
+ "taskbarRootLayout is null for displayId=" + displayId);
+ }
}
} finally {
Trace.endSection();
@@ -755,6 +776,8 @@
private void addTaskbarRootViewToWindow(int displayId) {
TaskbarActivityContext taskbar = getTaskbarForDisplay(displayId);
if (!enableTaskbarNoRecreate() || taskbar == null) {
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG,
+ "addTaskbarRootViewToWindow - taskbar null | displayId=" + displayId);
return;
}
@@ -762,6 +785,10 @@
mWindowManager.addView(getTaskbarRootLayoutForDisplay(displayId),
taskbar.getWindowLayoutParams());
mAddedRootLayouts.put(displayId, true);
+ } else {
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG,
+ "addTaskbarRootViewToWindow - root layout already added | displayId="
+ + displayId);
}
}
@@ -854,6 +881,7 @@
}
};
addTaskbarRootLayoutToMap(displayId, newTaskbarRootLayout);
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG, "created new root layout - displayId=" + displayId);
}
private boolean isDefaultDisplay(int displayId) {
@@ -867,7 +895,14 @@
* @return The taskbar root layout {@link FrameLayout} for a given display or {@code null}.
*/
private FrameLayout getTaskbarRootLayoutForDisplay(int displayId) {
- return mRootLayouts.get(displayId);
+ FrameLayout frameLayout = mRootLayouts.get(displayId);
+ if (frameLayout != null) {
+ return frameLayout;
+ } else {
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG,
+ "getTaskbarRootLayoutForDisplay == null | displayId=" + displayId);
+ return null;
+ }
}
/**
@@ -880,6 +915,8 @@
if (!mRootLayouts.contains(displayId) && rootLayout != null) {
mRootLayouts.put(displayId, rootLayout);
}
+
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG, "mRootLayouts.size()=" + mRootLayouts.size());
}
/**
@@ -892,6 +929,8 @@
mAddedRootLayouts.delete(displayId);
mRootLayouts.delete(displayId);
}
+
+ Log.d(NULL_TASKBAR_ROOT_LAYOUT_TAG, "mRootLayouts.size()=" + mRootLayouts.size());
}
private int getDefaultDisplayId() {