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

Commit 325cac43 authored by Andrii Kulian's avatar Andrii Kulian
Browse files

Always create display content with system identity

If an app tried to use a virtual display that it had just created
and add a window to it before it was registered in WM, WM would try
to create a DisplayContent instance. This would be executed with
app's calling identity and fail permission check.
This CL ensures that we always clear the calling identity before
creating display content.

Bug: 37422998
Test: android.display.cts.VirtualDisplayTest#testPrivateVirtualDisplay
Change-Id: I442cca65055886b384a28eeefcc35f2a36e482d0
parent aa6b649a
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -188,7 +188,12 @@ class RootWindowContainer extends WindowContainer<DisplayContent> {
        if (dc == null) {
            final Display display = mService.mDisplayManager.getDisplay(displayId);
            if (display != null) {
                final long callingIdentity = Binder.clearCallingIdentity();
                try {
                    dc = createDisplayContent(display);
                } finally {
                    Binder.restoreCallingIdentity(callingIdentity);
                }
            }
        }
        return dc;