fixed bug #1897 and made feature #2004

Fixed bug described here https://dev.guardianproject.info/issues/1897 
and implemented feature https://dev.guardianproject.info/issues/2004

I tested it with notecipher/notepadbot and it seems to work properly now. 
It doesn't show the lockscreen of notecipher anymore after I have left the app. 
Hope it's ok. :)