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

Commit ac76ed94 authored by Chavi Weingarten's avatar Chavi Weingarten
Browse files

Move LayoutParam secure flag so it's set on the WS level

The LayoutParam secure flag set by the client is set on the WSA level.

This causes a few issues:
1. Child windows don't inherit this flag since child windows are added
   beneath WS
2. Prevents moving the WSA's SC to the client since the secure flag
   needs to be set in WMS.

Test: FlagSecureTest
Bug: 308662081
Change-Id: I724ab0d834b0d74b33ccbb6bbd2c6f9c622c2a15
parent bf76cceb
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -48,3 +48,11 @@ flag {
    is_fixed_read_only: true
    bug: "262477923"
}

flag {
    namespace: "window_surfaces"
    name: "secure_window_state"
    description: "Move SC secure flag to WindowState level"
    is_fixed_read_only: true
    bug: "308662081"
}
+6 −6
Original line number Diff line number Diff line
@@ -991,12 +991,6 @@
      "group": "WM_DEBUG_WINDOW_INSETS",
      "at": "com\/android\/server\/wm\/InsetsSourceProvider.java"
    },
    "-1176488860": {
      "message": "SURFACE isSecure=%b: %s",
      "level": "INFO",
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/WindowSurfaceController.java"
    },
    "-1164930508": {
      "message": "Moving to RESUMED: %s (starting new instance) callers=%s",
      "level": "VERBOSE",
@@ -3277,6 +3271,12 @@
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/ActivityRecord.java"
    },
    "810599500": {
      "message": "SURFACE isSecure=%b: %s",
      "level": "INFO",
      "group": "WM_SHOW_TRANSACTIONS",
      "at": "com\/android\/server\/wm\/WindowState.java"
    },
    "829434921": {
      "message": "Draw state now committed in %s",
      "level": "VERBOSE",
+1 −1
Original line number Diff line number Diff line
@@ -627,7 +627,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
    void refreshSecureSurfaceState() {
        forAllWindows((w) -> {
            if (w.mHasSurface) {
                w.mWinAnimator.setSecureLocked(w.isSecureLocked());
                w.setSecureLocked(w.isSecureLocked());
            }
        }, true /* traverseTopToBottom */);
    }
+2 −2
Original line number Diff line number Diff line
@@ -2327,8 +2327,8 @@ public class WindowManagerService extends IWindowManager.Stub
            boolean wallpaperMayMove = win.mViewVisibility != viewVisibility
                    && win.hasWallpaper();
            wallpaperMayMove |= (flagChanges & FLAG_SHOW_WALLPAPER) != 0;
            if ((flagChanges & FLAG_SECURE) != 0 && winAnimator.mSurfaceController != null) {
                winAnimator.mSurfaceController.setSecure(win.isSecureLocked());
            if ((flagChanges & FLAG_SECURE) != 0) {
                win.setSecureLocked(win.isSecureLocked());
            }

            final boolean wasVisible = win.isVisible();
+26 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_RESIZE;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_STARTING_WINDOW;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_SYNC_ENGINE;
import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_WINDOW_INSETS;
import static com.android.internal.protolog.ProtoLogGroup.WM_SHOW_TRANSACTIONS;
import static com.android.server.policy.WindowManagerPolicy.FINISH_LAYOUT_REDO_WALLPAPER;
import static com.android.server.policy.WindowManagerPolicy.TRANSIT_ENTER;
import static com.android.server.policy.WindowManagerPolicy.TRANSIT_EXIT;
@@ -177,6 +178,7 @@ import static com.android.server.wm.WindowStateProto.UNRESTRICTED_KEEP_CLEAR_ARE
import static com.android.server.wm.WindowStateProto.VIEW_VISIBILITY;
import static com.android.server.wm.WindowStateProto.WINDOW_CONTAINER;
import static com.android.server.wm.WindowStateProto.WINDOW_FRAMES;
import static com.android.window.flags.Flags.secureWindowState;
import static com.android.window.flags.Flags.surfaceTrustedOverlay;

import android.annotation.CallSuper;
@@ -1195,6 +1197,9 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        if (surfaceTrustedOverlay() && isWindowTrustedOverlay()) {
            getPendingTransaction().setTrustedOverlay(mSurfaceControl, true);
        }
        if (secureWindowState()) {
            getPendingTransaction().setSecure(mSurfaceControl, isSecureLocked());
        }
    }

    void updateTrustedOverlay() {
@@ -6040,4 +6045,25 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        // Cancel any draw requests during a sync.
        return mPrepareSyncSeqId > 0;
    }

    void setSecureLocked(boolean isSecure) {
        ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isSecure=%b: %s", isSecure, getName());
        if (secureWindowState()) {
            if (mSurfaceControl == null) {
                return;
            }
            getPendingTransaction().setSecure(mSurfaceControl, isSecure);
        } else {
            if (mWinAnimator.mSurfaceController == null
                    || mWinAnimator.mSurfaceController.mSurfaceControl == null) {
                return;
            }
            getPendingTransaction().setSecure(mWinAnimator.mSurfaceController.mSurfaceControl,
                    isSecure);
        }
        if (mDisplayContent != null) {
            mDisplayContent.refreshImeSecureFlag(getSyncTransaction());
        }
        mWmService.scheduleAnimationLocked();
    }
}
Loading