Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
panic response in zom
} else if (Panic.isTriggerIntent(intent)) {
if (PanicResponder.receivedTriggerFromConnectedApp(this)) {
if (Preferences.uninstallApp()) {
Log.i(TAG, "uninstallApp");
// lock and delete first for rapid response, then uninstall
shutdownAndLock(this);
PanicResponder.deleteAllAppData(this);
Intent uninstall = new Intent(Intent.ACTION_DELETE);
uninstall.setData(Uri.parse("package:" + getPackageName()));
startActivity(uninstall);
} else if (Preferences.clearAppData()) {
Log.i(TAG, "clearAppData");
// lock first for rapid response, then delete
shutdownAndLock(this);
PanicResponder.deleteAllAppData(this);
} else if (Preferences.lockApp()) {
Log.i(TAG, "lockApp");
shutdownAndLock(this);
}
// TODO add other responses here, paying attention to if/else order
} else if (PanicResponder.shouldUseDefaultResponseToTrigger(this)) {
if (Preferences.lockApp()) {
shutdownAndLock(this);
}
}
// this Intent should not trigger any more processing
finish();
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment