Don't increment colorLayerCounter on surface migration
If the TDA's surface is migrated mid transition then the colorLayerCounter is increment an additional time leading to a colorLayerCounter that is out of sync by +1 which means the color is never cleared. Test: Run repo steps from b/221775939 and make sure the background color doesn't presist Bug: 221775939 Merged-In: Ifc93d5482bad9591e942e4be91e0039daae743b1 Change-Id: Ifc93d5482bad9591e942e4be91e0039daae743b1
This commit is contained in:
@@ -971,9 +971,19 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setBackgroundColor(@ColorInt int colorInt) {
|
void setBackgroundColor(@ColorInt int colorInt) {
|
||||||
|
setBackgroundColor(colorInt, false /* restore */);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setBackgroundColor(@ColorInt int colorInt, boolean restore) {
|
||||||
mBackgroundColor = colorInt;
|
mBackgroundColor = colorInt;
|
||||||
Color color = Color.valueOf(colorInt);
|
Color color = Color.valueOf(colorInt);
|
||||||
|
|
||||||
|
// We don't want to increment the mColorLayerCounter if we are restoring the background
|
||||||
|
// color after a surface migration because in that case the mColorLayerCounter already
|
||||||
|
// accounts for setting that background color.
|
||||||
|
if (!restore) {
|
||||||
mColorLayerCounter++;
|
mColorLayerCounter++;
|
||||||
|
}
|
||||||
|
|
||||||
// Only apply the background color if the TDA is actually attached and has a valid surface
|
// Only apply the background color if the TDA is actually attached and has a valid surface
|
||||||
// to set the background color on. We still want to keep track of the background color state
|
// to set the background color on. We still want to keep track of the background color state
|
||||||
@@ -1002,7 +1012,7 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
|
|||||||
super.migrateToNewSurfaceControl(t);
|
super.migrateToNewSurfaceControl(t);
|
||||||
|
|
||||||
if (mColorLayerCounter > 0) {
|
if (mColorLayerCounter > 0) {
|
||||||
setBackgroundColor(mBackgroundColor);
|
setBackgroundColor(mBackgroundColor, true /* restore */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces.
|
// As TaskDisplayArea is getting a new surface, reparent and reorder the child surfaces.
|
||||||
|
|||||||
Reference in New Issue
Block a user