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

Commit 361d3d08 authored by Patrick Williams's avatar Patrick Williams Committed by Android (Google) Code Review
Browse files

Merge "Make task surface controls secure when DPM disables screenshots" into main

parents dfabfc18 dbcc9c9f
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.
     *