diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 223217d3e..15af72b57 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -99,6 +99,14 @@ android:theme="@style/NoTitleBar"> + + + + + + diff --git a/src/com/keepassdroid/PanicResponderActivity.java b/src/com/keepassdroid/PanicResponderActivity.java new file mode 100644 index 000000000..ce6a4e804 --- /dev/null +++ b/src/com/keepassdroid/PanicResponderActivity.java @@ -0,0 +1,39 @@ + +package com.keepassdroid; + +import android.annotation.SuppressLint; +import android.app.Activity; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.util.Log; + +import com.android.keepass.KeePass; +import com.keepassdroid.app.App; + +public class PanicResponderActivity extends Activity { + + private static final String TAG = PanicResponderActivity.class.getSimpleName(); + + public static final String PANIC_TRIGGER_ACTION = "info.guardianproject.panic.action.TRIGGER"; + + @SuppressLint("NewApi") + @Override + protected void onCreate(Bundle savedInstanceState) { + Log.i(TAG, "onCreate"); + super.onCreate(savedInstanceState); + + Intent intent = getIntent(); + if (intent != null && PANIC_TRIGGER_ACTION.equals(intent.getAction())) { + Log.i(TAG, "onCreate"); + App.setShutdown(); + setResult(KeePass.EXIT_LOCK); + } + + if (Build.VERSION.SDK_INT >= 21) { + finishAndRemoveTask(); + } else { + finish(); + } + } +}