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

Commit 4fad1456 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Remove Activity if it enters PiP without window

This is to prevent malicious app entering PiP without being visible
first, like blocking onResume from completion. Which in turn
leaves the PiP window in limbo and non-interactable.

Bug: 265293293
Test: atest PinnedStackTests
Change-Id: I458a9508662e72a1adb9d9818105f2e9d7096d44
parent 1b0f4091
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1200,6 +1200,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            }
            ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS,
                    true /* ignoreVisibility */);
            if (inPictureInPictureMode && findMainWindow() == null) {
                // Prevent malicious app entering PiP without valid WindowState, which can in turn
                // result a non-touchable PiP window since the InputConsumer for PiP requires it.
                EventLog.writeEvent(0x534e4554, "265293293", -1, "");
                removeImmediately();
            }
        }
    }