diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index c03bdb16..b36b0602 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -39,6 +39,15 @@
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
tools:replace="screenOrientation" />
-
+
+
+
+
+
+
diff --git a/app/src/main/java/org/shadowice/flocke/andotp/Activities/PanicResponderActivity.java b/app/src/main/java/org/shadowice/flocke/andotp/Activities/PanicResponderActivity.java
new file mode 100644
index 00000000..ecd00cf2
--- /dev/null
+++ b/app/src/main/java/org/shadowice/flocke/andotp/Activities/PanicResponderActivity.java
@@ -0,0 +1,40 @@
+package org.shadowice.flocke.andotp.Activities;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.PreferenceManager;
+
+import org.shadowice.flocke.andotp.Database.Entry;
+import org.shadowice.flocke.andotp.R;
+
+import java.util.ArrayList;
+
+import static org.shadowice.flocke.andotp.Utilities.DatabaseHelper.saveDatabase;
+
+public class PanicResponderActivity extends Activity {
+ public static final String PANIC_TRIGGER_ACTION = "info.guardianproject.panic.action.TRIGGER";
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ Intent intent = getIntent();
+ if (intent != null && PANIC_TRIGGER_ACTION.equals(intent.getAction())) {
+ // Clean custom configuration.
+ SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
+ sharedPref.edit().clear().commit();
+ PreferenceManager.setDefaultValues(this, R.xml.preferences, true);
+ // Override secrets database
+ saveDatabase(this, new ArrayList());
+ }
+
+ if (Build.VERSION.SDK_INT >= 21) {
+ finishAndRemoveTask();
+ } else {
+ finish();
+ }
+ }
+}
\ No newline at end of file