adrian / upm-android

Android version of Universal Password Manager.
http://upm.sourceforge.net/
76 stars 46 forks source link

Automatically logout after a period of time #7

Open adrian opened 13 years ago

adrian commented 13 years ago

I'm a former blackberry user. The password vault on the BB would automatically log off when the screen back light timed out. This way if some unauthorized person picked up your phone, or stole your phone, they would not already be logged into your password database. A VERY IMPORTANT SECURITY FEATURE if you ask me.

Please consider adding this as perhaps a menu option. You may also consider a user select-able time out auto log off selection. say 30 sec, 1 min, 5 min etc.

Source: https://sourceforge.net/tracker/?func=detail&atid=791610&aid=3386447&group_id=154394

appatalks commented 11 years ago

I see something similar was implemented in the upm-swipe addition. Any chance of porting this good work to the android code as well? Or will it take a different approach? One thing I've been tinkering with is also making it lock after screen off, but having a few issues (my coding ability is very green)

appatalks commented 11 years ago

I've come up with a workaround for this issue, in the AccountsList.java I made the revision:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /* Time Lockout after 10 mins */
    Timer timer = new Timer();
    timer.schedule(new TimerTask() {
       public void run() {
        Intent i = new Intent(AccountsList.this, AppEntryActivity.class);
        i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(i);
        finish();
        return;
       }
    }, 600000);
    /* Time Lockout END */

}

It so far seems to work well for me. ~^^ Though it locks after 10 minutes after opening the program, not from inactivity. I will try to make this a menu option sometime down the line.

Edit* I just realized this stops working if screen goes off or phone sleeps. I will need to find a more practical way of getting this to work.

Edit 2* I was able to resolve the issue by adding:

getWindow().addFlags(LayoutParams.FLAG_KEEP_SCREEN_ON);

And now it works as expected. ^^ Note* Have to add this line to other activities.