[CD Taskbar] Fix rendering taskbar on CD after reboot
- Use mWindowContexts instead of mTaskbars to recreate taskbars as taskbars are not always created - example when user is locked, taskbars are not created until after user unlocks. - Create device profiles for connected displays when user unlocks in case those weren't created when display was added. Bug: 405327859 Flag: com.android.window.flags.enable_taskbar_connected_displays Test: m Change-Id: I8d63a7f2b3d8ab95b246010c2fc6295cae22a343
This commit is contained in:
@@ -494,6 +494,7 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
} else {
|
||||
mTaskStackListener = null;
|
||||
}
|
||||
addWindowContextToMap(mPrimaryDisplayId, mPrimaryWindowContext);
|
||||
recreateTaskbars();
|
||||
debugPrimaryTaskbar("TaskbarManager created");
|
||||
}
|
||||
@@ -607,6 +608,14 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
DisplayController.INSTANCE.get(mPrimaryWindowContext).addChangeListener(
|
||||
mRecreationListener);
|
||||
debugPrimaryTaskbar("onUserUnlocked: recreating all taskbars!");
|
||||
// Create DPs for all connected displays if required.
|
||||
for (int i = 0; i < mWindowContexts.size(); i++) {
|
||||
int displayId = mWindowContexts.keyAt(i);
|
||||
if (displayId != mPrimaryDisplayId && !mExternalDeviceProfiles.contains(displayId)) {
|
||||
createExternalDeviceProfile(displayId);
|
||||
}
|
||||
}
|
||||
|
||||
recreateTaskbars();
|
||||
for (int i = 0; i < mTaskbars.size(); i++) {
|
||||
int displayId = mTaskbars.keyAt(i);
|
||||
@@ -722,17 +731,9 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
*/
|
||||
@VisibleForTesting
|
||||
public synchronized void recreateTaskbars() {
|
||||
debugPrimaryTaskbar("recreateTaskbars");
|
||||
// Handles initial creation case.
|
||||
if (mTaskbars.size() == 0) {
|
||||
debugTaskbarManager("recreateTaskbars: create primary taskbar", mPrimaryDisplayId);
|
||||
recreateTaskbarForDisplay(mPrimaryDisplayId, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < mTaskbars.size(); i++) {
|
||||
int displayId = mTaskbars.keyAt(i);
|
||||
debugTaskbarManager("recreateTaskbars: create external taskbar", displayId);
|
||||
for (int i = 0; i < mWindowContexts.size(); i++) {
|
||||
int displayId = mWindowContexts.keyAt(i);
|
||||
debugTaskbarManager("recreateTaskbars", displayId);
|
||||
recreateTaskbarForDisplay(displayId, 0);
|
||||
}
|
||||
}
|
||||
@@ -1110,6 +1111,7 @@ public class TaskbarManager implements DisplayDecorationListener {
|
||||
}
|
||||
|
||||
debugPrimaryTaskbar("destroy: destroying all taskbars!");
|
||||
removeWindowContextFromMap(mPrimaryDisplayId);
|
||||
destroyAllTaskbars();
|
||||
debugPrimaryTaskbar("destroy: finished!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user