private void checkKeyguard() {
// If the keyguard is being displayed, exit this activity. This returns
// the user to the activity list page, which will in turn return the user
// to the login page, requiring the user to enter his password again before
// get access again to his secrets.
KeyguardManager keyGuard = (KeyguardManager) getSystemService(
KEYGUARD_SERVICE);
if (keyGuard.inKeyguardRestrictedInputMode())
finish();
}