Skip to content

Instantly share code, notes, and snippets.

@eighthave
Created January 5, 2016 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eighthave/6c4757f5877b88c5a586 to your computer and use it in GitHub Desktop.
Save eighthave/6c4757f5877b88c5a586 to your computer and use it in GitHub Desktop.
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