Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62f69423 authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Don't set background color if TDA doesn't have a valid surface

This is something that sometimes occurs in tests since the detaching of the TDA in not necesseraily synchronized with animations

Test: atest CtsWindowManagerDeviceTestCases:MultiDisplaySystemDecorationTests
Bug: 207667555
Bug: 209936970
Merged-In: I9881453ba14cba4f219861ec4449f2baa8058b57
Change-Id: I9881453ba14cba4f219861ec4449f2baa8058b57
(cherry picked from commit e644ff61)
parent dc4296e3
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -975,18 +975,23 @@ final class TaskDisplayArea extends DisplayArea<WindowContainer> {
        Color color = Color.valueOf(colorInt);
        mColorLayerCounter++;

        // 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
        // even if we are not showing it for when/if the TDA is reattached and gets a valid surface
        if (mSurfaceControl != null) {
            getPendingTransaction()
                .setColor(mSurfaceControl, new float[]{color.red(), color.green(), color.blue()});

                    .setColor(mSurfaceControl,
                            new float[]{color.red(), color.green(), color.blue()});
            scheduleAnimation();
        }
    }

    void clearBackgroundColor() {
        mColorLayerCounter--;

        // Only clear the color layer if we have received the same amounts of clear as set
        // requests.
        if (mColorLayerCounter == 0) {
        // requests and TDA has a non null surface control (i.e. is attached)
        if (mColorLayerCounter == 0 && mSurfaceControl != null) {
            getPendingTransaction().unsetColor(mSurfaceControl);
            scheduleAnimation();
        }