问题
In my app are activities which are displaying user sensitive data (inbox, passwords, bank account balance etc.). These sections are of course password protected and user is automatically logged off after some amount of time (this is checked in onRestart()). Problem is when this app is running on Android 3.0+ (which has recent app menu with images of recent apps) that these sensitive data are readable in this menu. Is there way to change that image to application logo or something else?
I already tried starting those sections in new task with EXCLUDE_FROM_RECENTS flag which helped but is interupting the user experience.
Other option is in onPause() method try to start some sort of "logo activity" which will be stopped in onRestart() and will be shown in recent app menu.
Any other/better suggestions? Thanks!
回答1:
Is there way to change that image to application logo or something else?
Adding FLAG_SECURE to the window handles this, IIRC:
public class FlagSecureTestActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(LayoutParams.FLAG_SECURE,
LayoutParams.FLAG_SECURE);
setContentView(R.layout.main);
}
}
This also blocks screenshots on ICS devices with screenshot support.
来源:https://stackoverflow.com/questions/10533186/replace-image-from-recent-app-menu