Replace image from recent application menu

My application contains actions that display confidential user data (incoming, passwords, bank account balance, etc.). These sections, of course, are password protected, and the user is automatically unloaded after some time (this is noted in onRestart ()). The problem is that this application runs on Android 3.0+ (in which the last application menu with images of the latest applications has appeared), that this sensitive data is read in this menu. Is there any way to change this image to the application logo or something else?
I already tried to run these sections in a new task with the EXCLUDE_FROM_RECENTS flag, which helped, but overloaded the user's work.
Another option is to use the onPause () method to try to launch some kind of “logo activity”, which will be stopped in onRestart () and will be shown in the last menu of the application.
Any other / best deals? Thank!

+3
source share
1 answer

Is there any way to change this image to the application logo or something else?

Adding FLAG_SECUREto 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);
  }
}

It also blocks screenshots on ICS devices with screenshot support.

+10
source

Source: https://habr.com/ru/post/1660866/


All Articles