honhon
V2EX  ›  Android

安卓截屏 FLAG_SECURE 界面

  •  
  •   honhon · Jan 14 · 3998 views
    This topic created in 306 days ago, the information mentioned may be changed or developed.
    给位大佬,请问在安卓 11 系统应用中能否截屏到设置了 FLAG_SECURE 的界面
    • 系统是我们编译 aosp11 源码
    • 运行环境为模拟器
    14 replies  •  2026-01-23 16:22:35 +08:00
    honhon
    honhon
    OP
    Jan 14
    1
    我尝试过了用 MediaProjection 创建虚拟屏幕并设置 VIRTUAL_DISPLAY_FLAG_SECURE ,但是无法截屏到设置了 FLAG_SECURE 的界面,也尝试过使用调用 SurfaceControl.screenshot ,结果也一样
    HojiOShi
    HojiOShi
    Jan 14
    3
    自己编译的好办,照着楼上模块的 hook 点改源码便是
    honhon
    honhon
    OP
    Jan 14
    4
    平时我们用的 scrcpy 可以在 pc 上镜像显示安卓内容,不知道能否参考他的实现方案,但是看起来比较复杂
    psllll
    psllll
    Jan 14
    5
    @honhon scrcpy 是用 adb 运行的,adb 无解绕不开的,你只能用模块
    honhon
    honhon
    OP
    Jan 14
    6
    @psllll @HojiOShi 感谢大佬,我尝试一下。

    我这边还有一个问题是,我只有在部分情况下需要截屏 FLAG_SECURE 界面内容,正常情况下还是不允许在截屏或者录屏过程中暴露 FLAG_SECURE 界面内容的
    sky96111
    sky96111
    Jan 14
    7
    @honhon #4 scrcpy 在遇到 FLAG_SECURE 的情况下也没法显示,会黑屏
    honhon
    honhon
    OP
    Jan 14
    8
    @sky96111 这个我这边测试是可以正常显示
    flyqie
    flyqie
    Jan 14 via Android
    9
    能跑自己编译的 aosp 的话可以对应点位改一下 framework 层代码呀,看看能不能根据某些条件做白名单什么的?
    honhon
    honhon
    OP
    Jan 15
    10
    @flyqie 主要是还没找到对应点位🐶
    honhon
    honhon
    OP
    Jan 15
    11
    @psllll 这个项目支持 Android 12-16 刚好不支持 android11
    honhon
    honhon
    OP
    Jan 15
    13
    @psllll 感谢大佬,我还看了一下 https://github.com/LSPosed/DisableFlagSecure 的历史记录,以前也好像有版本支持,研究中
    Nitsuya
    Nitsuya
    Jan 23
    14
    虚拟屏幕 的 VIRTUAL_DISPLAY_FLAG_SECURE, 应该是说标记了 FLAG_SECURE 的 Activity 可以在这个虚拟屏显示.
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4224 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 09:14 · PVG 17:14 · LAX 01:14 · JFK 04:14
    ♥ Do have faith in what you're doing.