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

Commit 4d0c5481 authored by chaviw's avatar chaviw Committed by Chavi Weingarten
Browse files

Set the IME to secure if the target is secure

If the target window for the IME is secure, set the IME to be secure.
This ensures that if the window can't be screenshot, the IME shouldn't
be able to be screenshot at that time. Once the IME gets a new target,
it can be screenshot if the new target isn't secure.

Test: Secure app with IME no longer screenrecords IME
Bug: 118188362
Change-Id: I5d64e4a2262734eb8b0cba09481479231d166c4a
parent 81b12816
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -3750,6 +3750,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    @VisibleForTesting
    @VisibleForTesting
    void setImeInputTarget(WindowState target) {
    void setImeInputTarget(WindowState target) {
        mImeInputTarget = target;
        mImeInputTarget = target;
        boolean canScreenshot = mImeInputTarget == null || !mImeInputTarget.isSecureLocked();
        if (mImeWindowsContainer.setCanScreenshot(canScreenshot)) {
            mWmService.requestTraversal();
        }
    }
    }


    @VisibleForTesting
    @VisibleForTesting
@@ -3867,7 +3871,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    void updateImeInputAndControlTarget(WindowState target) {
    void updateImeInputAndControlTarget(WindowState target) {
        if (mImeInputTarget != target) {
        if (mImeInputTarget != target) {
            ProtoLog.i(WM_DEBUG_IME, "setInputMethodInputTarget %s", target);
            ProtoLog.i(WM_DEBUG_IME, "setInputMethodInputTarget %s", target);
            mImeInputTarget = target;
            setImeInputTarget(target);
            updateImeControlTarget();
            updateImeControlTarget();
        }
        }
    }
    }
+8 −0
Original line number Original line Diff line number Diff line
@@ -3321,4 +3321,12 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    @WindowManager.LayoutParams.WindowType int getWindowType() {
    @WindowManager.LayoutParams.WindowType int getWindowType() {
        return INVALID_WINDOW_TYPE;
        return INVALID_WINDOW_TYPE;
    }
    }

    boolean setCanScreenshot(boolean canScreenshot) {
        if (mSurfaceControl == null) {
            return false;
        }
        getPendingTransaction().setSecure(mSurfaceControl, !canScreenshot);
        return true;
    }
}
}