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

Commit 94a1ee22 authored by Marvin Ramin's avatar Marvin Ramin
Browse files

Update canCreateSystemApplicationOverlay when adding system overlays

Ensure the permission state is properly updated when adding overlay
windows. This prevents the Session state to get outdated and policies to
get enforced when they shouldn't.

Test: manual
Bug: 429985912
Flag: com.android.media.projection.flags.recording_overlay
Change-Id: Ic436e853b1336796d9548589586bb364a6946fb1
parent 6bf4a7e3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;
import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
import static android.view.WindowManager.LayoutParams.LAST_SUB_WINDOW;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SYSTEM_APPLICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_TRUSTED_OVERLAY;
import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
import static android.view.WindowManager.LayoutParams.TYPE_ACCESSIBILITY_OVERLAY;
@@ -1681,6 +1682,12 @@ public class WindowManagerService extends IWindowManager.Stub
                    return WindowManagerGlobal.ADD_BAD_SUBWINDOW_TOKEN;
                }
            }
            // Update whether the session should be able to add system application overlays for any
            // attempt to add a system application overlay.
            if ((attrs.privateFlags & PRIVATE_FLAG_SYSTEM_APPLICATION_OVERLAY) != 0) {
                session.updateCanCreateSystemApplicationOverlay(mPermissionManager);
            }

            final DisplayContent displayContent = parentWindow != null
                    ? parentWindow.mDisplayContent
                    : getDisplayContentOrCreate(displayId, attrs.token);