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

Commit 33619554 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 am: 362ada44

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

Change-Id: Iec4e29bdc7d792ce40e7f0891d99c4305d7dce79
parents c597076a 362ada44
Loading
Loading
Loading
Loading
+5 −3
Original line number Original line Diff line number Diff line
@@ -41,7 +41,8 @@ public abstract class DevicePolicyCache {
    /**
    /**
     * See {@link DevicePolicyManager#getScreenCaptureDisabled}
     * 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
     * Caches {@link DevicePolicyManager#getPasswordQuality(android.content.ComponentName)} of the
@@ -56,8 +57,9 @@ public abstract class DevicePolicyCache {
        private static final EmptyDevicePolicyCache INSTANCE = new EmptyDevicePolicyCache();
        private static final EmptyDevicePolicyCache INSTANCE = new EmptyDevicePolicyCache();


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


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


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


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


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


+2 −2
Original line number Original line 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) -> {
        forAllWindows((w) -> {
            if (w.mHasSurface && userId == w.mShowUserId) {
            if (w.mHasSurface && userId == w.mShowUserId) {
                w.mWinAnimator.setSecureLocked(disabled);
                w.mWinAnimator.setSecureLocked(w.isSecureLocked());
            }
            }
        }, true /* traverseTopToBottom */);
        }, true /* traverseTopToBottom */);
    }
    }
Loading