为什么 Google 设置了 FLAG_SECURE 助手也能截屏?

Why is Google Assistant able to take the screenshots even if FLAG_SECURE is set?

我的应用程序中有一些用户敏感信息,我想通过标准系统快捷方式或 Google 助手禁用其中的屏幕截图。我使用的 WindowManager FLAG_SECURE 在某些设备上不会通过 Google 助手禁用屏幕截图。是系统bug吗?有什么解决方法吗?

documentation 之后,我为 activity window 设置了 FLAG_SECURE。它不适用于所有设备。

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE,
                WindowManager.LayoutParams.FLAG_SECURE);
        setContentView(R.layout.activity_main);
}

在 Google Pixel 2 设备 (Android 9.0) 上运行良好。屏幕截图被禁用。 Google 助手 returns 黑图截图。 在三星 A6 设备 (Android 9.0) 上我无法通过系统快捷方式截屏,但 Google 助手仍然可以截屏。

这是一个已知的安全问题。似乎它已经在 Pixel 设备上用最新的安全补丁修复了,但在三星设备上还没有。