I am developing a HIPAA compliant Android app, which requires that all private or sensitive information displayed on the app be hidden when the user taps the "recent apps" button on an Android phone.
I can show an overlay with no issue, but I can't figure out how to capture when the user taps the "Recent Apps" button on the phone.
I have tried putting this code in my base activity: if
@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);
}
}
which will display an overlay correctly. However, the method onWindowFocusChanged(false)
is actually called after the app screenshot is rendered in the "recent apps" expose view.
Does anyone have any idea how to capture user clicks on the "recent apps" button before the OS brings the apps to the exposed view?