Skip to content

Commit

Permalink
after receiving panic trigger and locking app, remove from history
Browse files Browse the repository at this point in the history
This makes the app fully exit, and removes it from the Recent Apps listing.
  • Loading branch information
eighthave committed Dec 30, 2015
1 parent 903fefb commit b68f933
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name="com.keepassdroid.ExitActivity" android:theme="@android:style/Theme.NoDisplay"></activity>
<service android:name="com.keepassdroid.services.TimeoutService"></service>
<meta-data android:name="com.a0soft.gphone.aTrackDog.webURL" android:value="http://keepassdroid.com" />
</application>
Expand Down
36 changes: 36 additions & 0 deletions src/com/keepassdroid/ExitActivity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

package com.keepassdroid;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;

public class ExitActivity extends Activity {

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if (Build.VERSION.SDK_INT >= 21) {
finishAndRemoveTask();
} else {
finish();
}

System.exit(0);
}

public static void exitAndRemoveFromRecentApps(Activity activity) {
Intent intent = new Intent(activity, ExitActivity.class);

intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
| Intent.FLAG_ACTIVITY_CLEAR_TASK
| Intent.FLAG_ACTIVITY_NO_ANIMATION);

activity.startActivity(intent);
}
}
1 change: 1 addition & 0 deletions src/com/keepassdroid/PanicResponderActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "onCreate");
App.setShutdown();
setResult(KeePass.EXIT_LOCK);
ExitActivity.exitAndRemoveFromRecentApps(this);
}

if (Build.VERSION.SDK_INT >= 21) {
Expand Down

0 comments on commit b68f933

Please sign in to comment.