我正在开发符合HIPAA标准的Android应用,该应用要求当用户点按Android手机上的“最近应用”按钮时,应隐藏应用上显示的所有私人或敏感信息。
我可以显示没有问题的叠加层,但是当用户点击手机上的“最近应用”按钮时,我无法弄清楚如何捕捉。
我已尝试将此代码放入我的基本活动中: 如果
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (!hasFocus) {
if(mInflatedView == null) {
mInflatedView = View.inflate(this, R.layout.background_overlay, null);
}
WindowManager.LayoutParams wlp = new WindowManager.LayoutParams();
wlp.height = WindowManager.LayoutParams.MATCH_PARENT;
wlp.width = WindowManager.LayoutParams.MATCH_PARENT;
wlp.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
wm.addView(mInflatedView, wlp);
}
}
将正确显示叠加层。但是,在“最近的应用”曝光视图中呈现应用屏幕截图后,方法onWindowFocusChanged(false)
实际上称为 。
有没有人知道如何在操作系统将应用程序带到公开的视图之前 之前捕获用户点击“最近的应用程序”按钮?