honhon
V2EX  ›  Android

安卓截屏 FLAG_SECURE 界面

  •  
  •   honhon · Jan 14 · 2648 views
    This topic created in 128 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
        1
    honhon  
    OP
       Jan 14
    我尝试过了用 MediaProjection 创建虚拟屏幕并设置 VIRTUAL_DISPLAY_FLAG_SECURE ,但是无法截屏到设置了 FLAG_SECURE 的界面,也尝试过使用调用 SurfaceControl.screenshot ,结果也一样
    psllll
        2
    psllll  
       Jan 14
    HojiOShi
        3
    HojiOShi  
       Jan 14
    自己编译的好办,照着楼上模块的 hook 点改源码便是
    honhon
        4
    honhon  
    OP
       Jan 14
    平时我们用的 scrcpy 可以在 pc 上镜像显示安卓内容,不知道能否参考他的实现方案,但是看起来比较复杂
    psllll
        5
    psllll  
       Jan 14
    @honhon scrcpy 是用 adb 运行的,adb 无解绕不开的,你只能用模块
    honhon
        6
    honhon  
    OP
       Jan 14
    @psllll @HojiOShi 感谢大佬,我尝试一下。

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