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

Commit dbcc9c9f authored by Patrick Williams's avatar Patrick Williams
Browse files

Make task surface controls secure when DPM disables screenshots

Bug: 402757820
Flag: EXEMPT bugfix
Test: presubmits
Change-Id: Ica49b513adc0e3c4b81500032d11c0c448572d84
parent e5b6f2aa
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -630,6 +630,9 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        forAllWindows(w -> {
            w.setSecureLocked(w.isSecureLocked());
        }, true /* traverseTopToBottom */);
        forAllTasks(t -> {
            t.setSecure(t.isSecure());
        });
    }

    void updateHiddenWhileSuspendedState(final ArraySet<String> packages, final boolean suspended) {
+14 −0
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ import android.app.PictureInPictureParams;
import android.app.TaskInfo;
import android.app.TaskInfo.SelfMovable;
import android.app.WindowConfiguration;
import android.app.admin.DevicePolicyCache;
import android.content.ComponentName;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -3055,6 +3056,7 @@ class Task extends TaskFragment {
    void setInitialSurfaceControlProperties(SurfaceControl.Builder b) {
        b.setEffectLayer().setMetadata(METADATA_TASK_ID, mTaskId);
        super.setInitialSurfaceControlProperties(b);
        getPendingTransaction().setSecure(mSurfaceControl, isSecure());
    }

    /** Checking if self or its child tasks are animated by recents animation. */
@@ -6935,6 +6937,18 @@ class Task extends TaskFragment {
        t.show(mDecorSurfaceContainer.mDecorSurface);
    }

    void setSecure(boolean secure) {
        getPendingTransaction().setSecure(mSurfaceControl, secure);
        scheduleAnimation();
    }

    boolean isSecure() {
        if (mWmService.getDisableSecureWindows()) {
            return false;
        }
        return !DevicePolicyCache.getInstance().isScreenCaptureAllowed(mUserId);
    }

    /**
     * A class managing the decor surface.
     *