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

Commit 7a5ddb24 authored by Alex Johnston's avatar Alex Johnston Committed by Automerger Merge Worker
Browse files

Merge "Change behaviour of screen capture disabled" into rvc-dev am: 2a02c8e3

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/10919475

Change-Id: I91f7201eac469e203e901d54f629f92e00a00d72
parents 8006f402 2a02c8e3
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -41,7 +41,8 @@ public abstract class DevicePolicyCache {
    /**
     * See {@link DevicePolicyManager#getScreenCaptureDisabled}
     */
    public abstract boolean getScreenCaptureDisabled(@UserIdInt int userHandle);
    public abstract boolean isScreenCaptureAllowed(@UserIdInt int userHandle,
            boolean ownerCanAddInternalSystemWindow);

    /**
     * Caches {@link DevicePolicyManager#getPasswordQuality(android.content.ComponentName)} of the
@@ -56,8 +57,9 @@ public abstract class DevicePolicyCache {
        private static final EmptyDevicePolicyCache INSTANCE = new EmptyDevicePolicyCache();

        @Override
        public boolean getScreenCaptureDisabled(int userHandle) {
            return false;
        public boolean isScreenCaptureAllowed(int userHandle,
                boolean ownerCanAddInternalSystemWindow) {
            return true;
        }

        @Override
+2 −3
Original line number Diff line number Diff line
@@ -4343,9 +4343,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     *         screenshot.
     */
    boolean shouldUseAppThemeSnapshot() {
        return mDisablePreviewScreenshots || forAllWindows(w -> {
                    return mWmService.isSecureLocked(w);
                }, true /* topToBottom */);
        return mDisablePreviewScreenshots || forAllWindows(WindowState::isSecureLocked,
                true /* topToBottom */);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -3824,7 +3824,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            }
            userId = activity.mUserId;
        }
        return !DevicePolicyCache.getInstance().getScreenCaptureDisabled(userId);
        return DevicePolicyCache.getInstance().isScreenCaptureAllowed(userId, false);
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -3782,7 +3782,7 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
    }

    boolean hasSecureWindowOnScreen() {
        final WindowState win = getWindow(w -> w.isOnScreen() && mWmService.isSecureLocked(w));
        final WindowState win = getWindow(w -> w.isOnScreen() && w.isSecureLocked());
        return win != null;
    }

+2 −2
Original line number Diff line number Diff line
@@ -662,10 +662,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        }
    }

    void setSecureSurfaceState(int userId, boolean disabled) {
    void setSecureSurfaceState(int userId) {
        forAllWindows((w) -> {
            if (w.mHasSurface && userId == w.mShowUserId) {
                w.mWinAnimator.setSecureLocked(disabled);
                w.mWinAnimator.setSecureLocked(w.isSecureLocked());
            }
        }, true /* traverseTopToBottom */);
    }
Loading