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

Commit d38954b2 authored by Oleg Blinnikov's avatar Oleg Blinnikov
Browse files

Call onPresentation on success only

Previously onPresentation could be called
even when addWindow fails for
whatever reason.

Now call to onPresentation is made
only after all error handling

Bug: 310976810
Test: presentation event is logged
Flag: EXEMPT simple bugfix
Change-Id: Id4a939242fcb0d04f65cae33045cac10bf9855d2
parent 4f783b4e
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -1591,11 +1591,6 @@ public class WindowManagerService extends IWindowManager.Stub
                return WindowManagerGlobal.ADD_DUPLICATE_ADD;
            }

            if (type == TYPE_PRESENTATION || type == TYPE_PRIVATE_PRESENTATION) {
                mDisplayManagerInternal.onPresentation(displayContent.getDisplay().getDisplayId(),
                        /*isShown=*/ true);
            }

            if (type == TYPE_PRIVATE_PRESENTATION && !displayContent.isPrivate()) {
                ProtoLog.w(WM_ERROR,
                        "Attempted to add private presentation window to a non-private display.  "
@@ -1946,6 +1941,12 @@ public class WindowManagerService extends IWindowManager.Stub
                outAttachedFrame.set(0, 0, -1, -1);
            }
            outSizeCompatScale[0] = win.getCompatScaleForClient();

            if (res >= ADD_OKAY
                    && (type == TYPE_PRESENTATION || type == TYPE_PRIVATE_PRESENTATION)) {
                mDisplayManagerInternal.onPresentation(displayContent.getDisplay().getDisplayId(),
                        /*isShown=*/ true);
            }
        }

        Binder.restoreCallingIdentity(origId);