-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
after receiving panic trigger and locking app, remove from history
This makes the app fully exit, and removes it from the Recent Apps listing.
- Loading branch information
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters