### Install dh-strip-nondeterminism on Ubuntu 14.04 Source: https://github.com/guardianproject/panickit/blob/master/README.md For Ubuntu/trusty/14.04, add the Guardian Project PPA and install dh-strip-nondeterminism. ```bash curl 'https://pgp.mit.edu/pks/lookup?op=get&search=0x6B80A84207B30AC9DEE235FEF50EADDD2234F563' | sudo apt-key add - sudo add-apt-repository ppa:guardianproject/ppa sudo apt-get update sudo apt-get install dh-strip-nondeterminism ``` -------------------------------- ### Install dh-strip-nondeterminism on Debian/Ubuntu Source: https://github.com/guardianproject/panickit/blob/master/README.md Install the dh-strip-nondeterminism package on Debian/jessie or Ubuntu/vivid/15.04 or newer using apt-get. ```bash sudo apt-get install dh-strip-nondeterminism ``` -------------------------------- ### Discover Installed Responders Source: https://context7.com/guardianproject/panickit/llms.txt Queries the Android PackageManager to find all installed apps that have registered to receive ACTION_TRIGGER as an Activity, Service, or BroadcastReceiver. ```APIDOC ## `PanicTrigger.getResponderActivities(Context)` ### Description Queries the Android `PackageManager` to find all installed apps that have registered to receive `ACTION_TRIGGER` as an `Activity`. ### Method `PanicTrigger.getResponderActivities(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ### Response #### Success Response - **Set** - A set of package names for installed activities that are responders. ## `PanicTrigger.getResponderServices(Context)` ### Description Queries the Android `PackageManager` to find all installed apps that have registered to receive `ACTION_TRIGGER` as a `Service`. ### Method `PanicTrigger.getResponderServices(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ### Response #### Success Response - **Set** - A set of package names for installed services that are responders. ## `PanicTrigger.getResponderBroadcastReceivers(Context)` ### Description Queries the Android `PackageManager` to find all installed apps that have registered to receive `ACTION_TRIGGER` as a `BroadcastReceiver`. ### Method `PanicTrigger.getResponderBroadcastReceivers(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ### Response #### Success Response - **Set** - A set of package names for installed broadcast receivers that are responders. ## `PanicTrigger.getAllResponders(Context)` ### Description Retrieves a union of all installed responders (Activities, Services, and BroadcastReceivers). ### Method `PanicTrigger.getAllResponders(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ### Response #### Success Response - **Set** - A set of package names for all installed responders. ## `PanicTrigger.getConnectedResponders(Context)` ### Description Returns responders that the user has actively paired via `ACTION_CONNECT`. ### Method `PanicTrigger.getConnectedResponders(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ### Response #### Success Response - **Set** - A set of package names for connected responders. ## `PanicTrigger.getEnabledResponders(Context)` ### Description Returns responders that the user has chosen to enable. ### Method `PanicTrigger.getEnabledResponders(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ### Response #### Success Response - **Set** - A set of package names for enabled responders. ``` -------------------------------- ### List Pure Trigger Apps for UI Picker Source: https://context7.com/guardianproject/panickit/llms.txt Returns a list of installed apps that respond to ACTION_CONNECT but not ACTION_TRIGGER, suitable for populating a UI picker for the user's trigger app. Includes a helper for configuring ListPreferences. ```java import android.content.pm.ResolveInfo; import java.util.List; List triggerApps = PanicResponder.resolveTriggerApps(getPackageManager()); // Populate a ListPreference or RecyclerView: for (ResolveInfo info : triggerApps) { String pkg = info.activityInfo.packageName; String label = (String) getPackageManager().getApplicationLabel( getPackageManager().getApplicationInfo(pkg, 0)); addPickerEntry(label, pkg); } // Or use the built-in ListPreference helper (API ≥ 11): PanicResponder.configTriggerAppListPreference( (ListPreference) findPreference("panic_trigger"), R.string.default_panic_summary, // shown when DEFAULT is selected R.string.none_panic_summary // shown when NONE is selected ); ``` -------------------------------- ### Find Pairable Responders Source: https://context7.com/guardianproject/panickit/llms.txt Returns the subset of installed responders that support the full ACTION_CONNECT handshake, which is required for destructive responses. ```APIDOC ## `PanicTrigger.getRespondersThatCanConnect(Context)` ### Description Returns the subset of installed responders that support the full `ACTION_CONNECT` handshake. ### Method `PanicTrigger.getRespondersThatCanConnect(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ### Response #### Success Response - **Set** - A set of package names for responders that can connect. ``` -------------------------------- ### Discover Installed Responders with PanicTrigger Source: https://context7.com/guardianproject/panickit/llms.txt Queries the Android PackageManager to find installed apps registered for ACTION_TRIGGER. Note that only Activity-based responders can cryptographically confirm the trigger app's identity. ```java import info.guardianproject.panic.PanicTrigger; import java.util.Set; // Discover every installed responder type: Set activities = PanicTrigger.getResponderActivities(context); Set services = PanicTrigger.getResponderServices(context); Set broadcastReceivers = PanicTrigger.getResponderBroadcastReceivers(context); // Or get all at once (union of all three sets): Set allResponders = PanicTrigger.getAllResponders(context); // Example output: // allResponders → {"org.example.securedelete", "org.example.alertsender"} // Only responders the user has actively paired via ACTION_CONNECT: Set connected = PanicTrigger.getConnectedResponders(context); // Only responders the user has chosen to enable: Set enabled = PanicTrigger.getEnabledResponders(context); ``` -------------------------------- ### PanicResponder.resolveTriggerApps Source: https://context7.com/guardianproject/panickit/llms.txt Returns all installed apps that respond to ACTION_CONNECT but not to ACTION_TRIGGER — in other words, pure trigger apps. Useful for building a settings screen that lets the user pick their trigger app. ```APIDOC ## `PanicResponder.resolveTriggerApps(PackageManager)` — List Trigger Apps for a UI Picker Returns all installed apps that respond to `ACTION_CONNECT` but **not** to `ACTION_TRIGGER` — in other words, pure trigger apps. Useful for building a settings screen that lets the user pick their trigger app. ```java import android.content.pm.ResolveInfo; import java.util.List; List triggerApps = PanicResponder.resolveTriggerApps(getPackageManager()); // Populate a ListPreference or RecyclerView: for (ResolveInfo info : triggerApps) { String pkg = info.activityInfo.packageName; String label = (String) getPackageManager().getApplicationLabel( getPackageManager().getApplicationInfo(pkg, 0)); addPickerEntry(label, pkg); } // Or use the built-in ListPreference helper (API ≥ 11): PanicResponder.configTriggerAppListPreference( (ListPreference) findPreference("panic_trigger"), R.string.default_panic_summary, // shown when DEFAULT is selected R.string.none_panic_summary // shown when NONE is selected ); ``` ``` -------------------------------- ### Find Pairable Responders with PanicTrigger Source: https://context7.com/guardianproject/panickit/llms.txt Returns a subset of installed responders that support the full ACTION_CONNECT handshake, which is required for destructive responses. This can be used to populate a settings UI with apps the user can pair with. ```java Set pairable = PanicTrigger.getRespondersThatCanConnect(context); // Populate a settings UI with apps the user can pair with: for (String pkg : pairable) { ApplicationInfo info = getPackageManager().getApplicationInfo(pkg, 0); String label = (String) getPackageManager().getApplicationLabel(info); addRowToUI(label, pkg); } ``` -------------------------------- ### Accept an Incoming Connection Source: https://context7.com/guardianproject/panickit/llms.txt Called in a responder app's connection Activity to get the package name of the trigger app requesting a connection. ```APIDOC ## `PanicResponder.getConnectIntentSender(Activity)` ### Description Called in a responder app's connection `Activity`. Returns the package name of the trigger app requesting a connection, or `null` if this was not an `ACTION_CONNECT` intent. ### Method `PanicResponder.getConnectIntentSender(Activity)` ### Parameters #### Path Parameters - **activity** (Activity) - Required - The current Activity context. ### Response #### Success Response - **String** - The package name of the trigger app, or `null`. ## `PanicResponder.setTriggerPackageName(Context)` ### Description Stores the trigger app's package name, typically read from the received Intent, to confirm the connection. ### Method `PanicResponder.setTriggerPackageName(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. ``` -------------------------------- ### Accept Incoming Connection with PanicResponder Source: https://context7.com/guardianproject/panickit/llms.txt Used in a responder app's connection Activity to get the package name of the trigger app requesting a connection. Reads from the received ACTION_CONNECT intent. ```java import info.guardianproject.panic.PanicResponder; // In the responder app's "Panic Config" Activity: @Override protected void onResume() { super.onResume(); String triggerPkg = PanicResponder.getConnectIntentSender(this); if (triggerPkg != null) { // Store it as the active trigger and confirm back to the trigger app: PanicResponder.setTriggerPackageName(this); // reads from the received Intent setResult(RESULT_OK); finish(); } } ``` -------------------------------- ### Manage Enabled Responders Source: https://context7.com/guardianproject/panickit/llms.txt Allows the user to choose which installed responders will receive the trigger signal. The enabled state is persisted to a private SharedPreferences file. ```APIDOC ## `PanicTrigger.enableResponder(Context, String)` ### Description Enables a responder so it receives future triggers. The enabled state is persisted. ### Method `PanicTrigger.enableResponder(Context, String)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. - **responderPkg** (String) - Required - The package name of the responder to enable. ### Response #### Success Response - **boolean** - `true` if the responder was successfully enabled, `false` otherwise. ## `PanicTrigger.disableResponder(Context, String)` ### Description Disables a responder, removing it from the enabled set. ### Method `PanicTrigger.disableResponder(Context, String)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. - **responderPkg** (String) - Required - The package name of the responder to disable. ### Response #### Success Response - **boolean** - `true` if the responder was successfully disabled, `false` otherwise. ## `PanicTrigger.addConnectedResponder(Context, String)` ### Description Manually persists the connection status for a responder. ### Method `PanicTrigger.addConnectedResponder(Context, String)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. - **responderPkg** (String) - Required - The package name of the responder to mark as connected. ## `PanicTrigger.removeConnectedResponder(Context, String)` ### Description Manually removes the connection status for a responder. ### Method `PanicTrigger.removeConnectedResponder(Context, String)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context. - **responderPkg** (String) - Required - The package name of the responder to mark as disconnected. ``` -------------------------------- ### Manage Enabled Responders with PanicTrigger Source: https://context7.com/guardianproject/panickit/llms.txt Enables or disables installed responders to control which apps receive trigger signals. Enabled state is persisted to SharedPreferences. Manually add or remove responders from the connected set if needed. ```java String responderPkg = "org.example.securedelete"; // Enable a responder so it receives future triggers: boolean saved = PanicTrigger.enableResponder(context, responderPkg); // → true // Disable it (removes from SharedPreferences): boolean removed = PanicTrigger.disableResponder(context, responderPkg); // → true // Persist connect/disconnect manually if needed: PanicTrigger.addConnectedResponder(context, responderPkg); PanicTrigger.removeConnectedResponder(context, responderPkg); ``` -------------------------------- ### PanicTrigger.checkForDisconnectIntent Source: https://context7.com/guardianproject/panickit/llms.txt Enables a trigger app to remove a connection with a responder app. It checks if the activity was started with the `ACTION_DISCONNECT` intent and removes the calling responder from the connected set if successful. ```APIDOC ## PanicTrigger.checkForDisconnectIntent(Activity activity) ### Description This method is called symmetrically with `checkForConnectIntent` within a trigger app's `Activity.onResume()`. It checks if the activity was started with the `ACTION_DISCONNECT` intent. If true, it removes the calling responder app from the set of connected responders. ### Method `PanicTrigger.checkForDisconnectIntent(Activity activity)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java @Override protected void onResume() { super.onResume(); if (PanicTrigger.checkForDisconnectIntent(this)) { // The responder that sent ACTION_DISCONNECT is no longer connected. Toast.makeText(this, "Panic app disconnected.", Toast.LENGTH_SHORT).show(); } } ``` ### Response #### Success Response - `boolean` (boolean) - Returns `true` if `ACTION_DISCONNECT` was detected and the connection was removed, `false` otherwise. ``` -------------------------------- ### Include PanicKit Library with Gradle Source: https://github.com/guardianproject/panickit/blob/master/README.md Add this line to your build.gradle file to include the PanicKit library in your project. ```gradle compile 'info.guardianproject.panic:panic:1.0' ``` -------------------------------- ### Panic Intent Actions and Constants Source: https://context7.com/guardianproject/panickit/llms.txt Defines the core Intent action strings used for communication between trigger and responder apps, along with special package-name sentinels and a utility method to check incoming intents. ```APIDOC ## Panic Constants and Intent Actions ### Description This section details the central `Panic` class constants, including shared `Intent` action strings for connecting, disconnecting, and triggering panic events, as well as special package-name sentinels and a utility method for validating incoming trigger intents. ### Constants - `ACTION_CONNECT`: String - "info.guardianproject.panic.action.CONNECT" Sent by a trigger app to initiate a handshake with a responder app. - `ACTION_DISCONNECT`: String - "info.guardianproject.panic.action.DISCONNECT" Sent by a trigger app to sever its relationship with a responder app. - `ACTION_TRIGGER`: String - "info.guardianproject.panic.action.TRIGGER" Sent by a trigger app when the user activates the panic response. - `PACKAGE_NAME_NONE`: String - "NONE" A sentinel value indicating the user has explicitly chosen no trigger app. - `PACKAGE_NAME_DEFAULT`: String - "DEFAULT" A sentinel value indicating to fall back to the built-in default response. ### Utility Method - `isTriggerIntent(Intent intent)`: Boolean Checks if the provided `Intent` is a valid trigger intent. Returns `false` for null Intents and non-TRIGGER actions. ``` -------------------------------- ### Panic Intent Actions and Constants Source: https://context7.com/guardianproject/panickit/llms.txt Defines standard Intent actions for panic communication and utility methods to check incoming trigger Intents. Use these constants to send or identify panic-related Intents. ```java import info.guardianproject.panic.Panic; import android.content.Intent; // ── Intent action strings ────────────────────────────────────────────────── // Sent by a trigger app to initiate a handshake with a responder app. String ACTION_CONNECT = Panic.ACTION_CONNECT; // "info.guardianproject.panic.action.CONNECT" // Sent by a trigger app to sever its relationship with a responder app. String ACTION_DISCONNECT = Panic.ACTION_DISCONNECT; // "info.guardianproject.panic.action.DISCONNECT" // Sent by a trigger app when the user activates the panic response. String ACTION_TRIGGER = Panic.ACTION_TRIGGER; // "info.guardianproject.panic.action.TRIGGER" // ── Special package-name sentinels ───────────────────────────────────────── // "NONE" → the user has explicitly chosen no trigger app // "DEFAULT" → fall back to the built-in default response String noneValue = Panic.PACKAGE_NAME_NONE; // "NONE" String defaultValue = Panic.PACKAGE_NAME_DEFAULT; // "DEFAULT" // ── Checking an incoming Intent ──────────────────────────────────────────── Intent incomingIntent = getIntent(); // inside an Activity if (Panic.isTriggerIntent(incomingIntent)) { // Safe to cast and act on this Intent. // Returns false for null Intents and non-TRIGGER actions. performPanicResponse(); } ``` -------------------------------- ### Add PanicKit Dependency to Gradle Source: https://context7.com/guardianproject/panickit/llms.txt Include the PanicKit library in your Android project by adding the dependency to your app's build.gradle file and ensuring the jcenter() repository is configured. ```groovy // build.gradle (app module) repositories { jcenter() } dependencies { compile 'info.guardianproject.panic:panic:1.0' } ``` -------------------------------- ### Accept Responder Connection with PanicTrigger Source: https://context7.com/guardianproject/panickit/llms.txt Call `checkForConnectIntent` within an Activity's `onResume()` to handle incoming `ACTION_CONNECT` Intents from responder apps. This persists the responder's package name upon successful connection. ```java import info.guardianproject.panic.PanicTrigger; // In the trigger app's connection-management Activity: @Override protected void onResume() { super.onResume(); if (PanicTrigger.checkForConnectIntent(this)) { // A responder app sent ACTION_CONNECT. // Its package name is now stored as "connected". Toast.makeText(this, "Panic app connected!", Toast.LENGTH_SHORT).show(); } } ``` -------------------------------- ### PanicTrigger.checkForConnectIntent Source: https://context7.com/guardianproject/panickit/llms.txt Allows a trigger app to accept a connection request from a responder app. When called, it checks if the activity was initiated with the `ACTION_CONNECT` intent and persists the responder's package name if successful. ```APIDOC ## PanicTrigger.checkForConnectIntent(Activity activity) ### Description This method should be called within a trigger app's `Activity.onResume()` method. It checks if the activity was started with the `ACTION_CONNECT` intent. If true, it establishes a connection with the calling responder app by persisting its package name. ### Method `PanicTrigger.checkForConnectIntent(Activity activity)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java // In the trigger app's connection-management Activity: @Override protected void onResume() { super.onResume(); if (PanicTrigger.checkForConnectIntent(this)) { // A responder app sent ACTION_CONNECT. // Its package name is now stored as "connected". Toast.makeText(this, "Panic app connected!", Toast.LENGTH_SHORT).show(); } } ``` ### Response #### Success Response - `boolean` (boolean) - Returns `true` if `ACTION_CONNECT` was detected and a connection was established, `false` otherwise. ``` -------------------------------- ### Fire the Panic Signal Source: https://context7.com/guardianproject/panickit/llms.txt Iterates over all enabled responders and dispatches the ACTION_TRIGGER Intent to each one. ```APIDOC ## `PanicTrigger.sendTrigger(Context)` ### Description Dispatches the `ACTION_TRIGGER` `Intent` to all enabled responders (Activities, BroadcastReceivers, and Services). This method must be called from an `Activity` so responders can verify the sender's identity. ### Method `PanicTrigger.sendTrigger(Context)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context (should be an Activity). ## `PanicTrigger.sendTrigger(Context, Intent)` ### Description Dispatches a custom `Intent` to all enabled responders. The Intent's action must be `Panic.ACTION_TRIGGER`. This method must be called from an `Activity` so responders can verify the sender's identity. ### Method `PanicTrigger.sendTrigger(Context, Intent)` ### Parameters #### Path Parameters - **context** (Context) - Required - The Android context (should be an Activity). - **trigger** (Intent) - Required - The `Intent` to send, with action `Panic.ACTION_TRIGGER`. ### Request Example ```java Intent trigger = new Intent(Panic.ACTION_TRIGGER); trigger.putExtra("message", "I need help at 40.7128° N, 74.0060° W"); trigger.putExtra("email", "emergency@example.com"); PanicTrigger.sendTrigger(this, trigger); ``` ### Error Handling - `IllegalArgumentException` is thrown if the Intent's action is not `ACTION_TRIGGER`. - `ActivityNotFoundException` and `SecurityException` are caught internally and printed; they do not propagate to the caller. ``` -------------------------------- ### PanicResponder.setTriggerPackageName Source: https://context7.com/guardianproject/panickit/llms.txt Persists the trigger app's package name (or clears it) in the responder's default SharedPreferences. Also sends ACTION_DISCONNECT to the old trigger app and ACTION_CONNECT to the new one. ```APIDOC ## `PanicResponder.setTriggerPackageName(Activity)` / `setTriggerPackageName(Activity, String)` — Configure the Active Trigger Persists the trigger app's package name (or clears it) in the responder's default `SharedPreferences`. Also sends `ACTION_DISCONNECT` to the old trigger app and `ACTION_CONNECT` to the new one. ```java // Derive package name automatically from the received Intent: PanicResponder.setTriggerPackageName(activity); // Or set it explicitly (e.g., from a user-chosen list): PanicResponder.setTriggerPackageName(activity, "org.example.panicsender"); // Clear the connected trigger entirely: PanicResponder.setTriggerPackageName(activity, null); // Read back the currently configured trigger at any time: String currentTrigger = PanicResponder.getTriggerPackageName(context); // → "org.example.panicsender" or null if none configured ``` ``` -------------------------------- ### Configure and Clear Trigger App Package Name Source: https://context7.com/guardianproject/panickit/llms.txt Persists the trigger app's package name in SharedPreferences. Can be set explicitly, derived from an intent, or cleared by passing null. Also handles sending disconnect/connect actions to trigger apps. ```java // Derive package name automatically from the received Intent: PanicResponder.setTriggerPackageName(activity); // Or set it explicitly (e.g., from a user-chosen list): PanicResponder.setTriggerPackageName(activity, "org.example.panicsender"); // Clear the connected trigger entirely: PanicResponder.setTriggerPackageName(activity, null); // Read back the currently configured trigger at any time: String currentTrigger = PanicResponder.getTriggerPackageName(context); // → "org.example.panicsender" or null if none configured ``` -------------------------------- ### Register Intent Filters for Responder App (Activity) Source: https://context7.com/guardianproject/panickit/llms.txt Declare an intent filter for the TRIGGER action in the responder app's Activity. This enables the app to handle panic signals when launched as an Activity, verifying the sender. ```xml ``` -------------------------------- ### Send Panic Trigger Signal with PanicTrigger Source: https://context7.com/guardianproject/panickit/llms.txt Dispatches the ACTION_TRIGGER Intent to all enabled responders. Must be called from an Activity for responders to verify the sender. Supports sending a basic trigger or a rich trigger with optional payload data. ```java import info.guardianproject.panic.PanicTrigger; import android.content.Intent; import info.guardianproject.panic.Panic; // ── Basic trigger (no payload) ───────────────────────────────────────────── // Must be called from an Activity so responders can verify the sender. PanicTrigger.sendTrigger(this); // 'this' is an Activity // ── Rich trigger with optional payload ──────────────────────────────────── Intent trigger = new Intent(Panic.ACTION_TRIGGER); trigger.putExtra("message", "I need help at 40.7128° N, 74.0060° W"); trigger.putExtra("email", "emergency@example.com"); try { PanicTrigger.sendTrigger(this, trigger); } catch (IllegalArgumentException e) { // Thrown if the Intent's action is not ACTION_TRIGGER. Log.e(TAG, "Bad intent action", e); } // Internally, ActivityNotFoundException and SecurityException are caught and // printed; they do not propagate to the caller. ``` -------------------------------- ### Register Intent Filters for Responder App (Service) Source: https://context7.com/guardianproject/panickit/llms.txt Declare an intent filter for the TRIGGER action in the responder app's Service. This allows the app to handle panic signals when running as a background service, where the sender is unverifiable. ```xml ``` -------------------------------- ### Verify Trigger Origin for Destructive Actions Source: https://context7.com/guardianproject/panickit/llms.txt Use these guards within an ACTION_TRIGGER handler to determine if the trigger originated from the paired app, allowing for destructive actions, or if a safe default response should be used. ```java import info.guardianproject.panic.PanicResponder; @Override protected void onResume() { super.onResume(); if (PanicResponder.receivedTriggerFromConnectedApp(this)) { // Verified: the trigger came from the paired app. // Safe to execute destructive responses (wipe data, etc.). PanicResponder.deleteAllAppData(this); // clears prefs + files + cache, then force-closes } else if (PanicResponder.shouldUseDefaultResponseToTrigger(this)) { // Unverified sender or no trigger app configured. // Execute only a non-destructive default response. hideUI(); } } ``` -------------------------------- ### PanicResponder.deleteAllAppData Source: https://context7.com/guardianproject/panickit/llms.txt The built-in destructive responder action. Clears SharedPreferences, recursively deletes internal files, cache, external cache, and external media dirs, then calls ActivityManager.clearApplicationUserData() (API ≥ 19) or pm clear on older devices. This terminates the app process. ```APIDOC ## `PanicResponder.deleteAllAppData(Context)` — Wipe All App Data The built-in destructive responder action. Clears `SharedPreferences`, recursively deletes internal files, cache, external cache, and external media dirs, then calls `ActivityManager.clearApplicationUserData()` (API ≥ 19) or `pm clear ` on older devices. **This terminates the app process.** ```java // Only call this after receivedTriggerFromConnectedApp() returns true. if (PanicResponder.receivedTriggerFromConnectedApp(this)) { PanicResponder.deleteAllAppData(this); // App process is killed; no code runs after this line. } ``` ``` -------------------------------- ### Register Intent Filters for Trigger App Source: https://context7.com/guardianproject/panickit/llms.txt Declare intent filters for CONNECT and DISCONNECT actions in the trigger app's Activity. This allows the app to receive pairing requests and manage connections. ```xml ``` -------------------------------- ### Wipe All App Data Securely Source: https://context7.com/guardianproject/panickit/llms.txt The built-in destructive responder action. This method clears SharedPreferences, internal files, cache, and external media directories, then terminates the app process. It should only be called after verifying the trigger origin. ```java // Only call this after receivedTriggerFromConnectedApp() returns true. if (PanicResponder.receivedTriggerFromConnectedApp(this)) { PanicResponder.deleteAllAppData(this); // App process is killed; no code runs after this line. } ``` -------------------------------- ### Handle Disconnection Intent in Activity Source: https://context7.com/guardianproject/panickit/llms.txt Checks if the activity was launched with ACTION_DISCONNECT. If so, it clears the stored trigger package name and finishes the activity. ```java protected void onResume() { super.onResume(); if (PanicResponder.checkForDisconnectIntent(this)) { // Trigger app is no longer paired; revert to default behavior. updateUI("No panic app connected."); setResult(RESULT_OK); finish(); } } ``` -------------------------------- ### Register Intent Filters for Responder App (BroadcastReceiver) Source: https://context7.com/guardianproject/panickit/llms.txt Declare an intent filter for the TRIGGER action in the responder app's BroadcastReceiver. This enables the app to handle panic signals received via broadcast, where the sender is also unverifiable. ```xml ``` -------------------------------- ### PanicResponder.receivedTriggerFromConnectedApp / shouldUseDefaultResponseToTrigger Source: https://context7.com/guardianproject/panickit/llms.txt Two guards that a responder uses inside the Activity handling ACTION_TRIGGER to decide whether to perform a destructive action or only a safe default response. ```APIDOC ## `PanicResponder.receivedTriggerFromConnectedApp(Activity)` / `shouldUseDefaultResponseToTrigger(Activity)` — Verify Trigger Origin Two guards that a responder uses inside the `Activity` handling `ACTION_TRIGGER` to decide whether to perform a destructive action or only a safe default response. ```java import info.guardianproject.panic.PanicResponder; @Override protected void onResume() { super.onResume(); if (PanicResponder.receivedTriggerFromConnectedApp(this)) { // Verified: the trigger came from the paired app. // Safe to execute destructive responses (wipe data, etc.). PanicResponder.deleteAllAppData(this); // clears prefs + files + cache, then force-closes } else if (PanicResponder.shouldUseDefaultResponseToTrigger(this)) { // Unverified sender or no trigger app configured. // Execute only a non-destructive default response. hideUI(); } } ``` ``` -------------------------------- ### PanicResponder.checkForDisconnectIntent Source: https://context7.com/guardianproject/panickit/llms.txt Checks if the activity was launched with ACTION_DISCONNECT from the currently connected trigger app. If so, it clears the stored trigger package name. ```APIDOC ## `PanicResponder.checkForDisconnectIntent(Activity)` — Handle Disconnection Checks whether the activity was launched with `ACTION_DISCONNECT` from the currently connected trigger app. If so, it clears the stored trigger package name. ```java @Override protected void onResume() { super.onResume(); if (PanicResponder.checkForDisconnectIntent(this)) { // Trigger app is no longer paired; revert to default behavior. updateUI("No panic app connected."); setResult(RESULT_OK); finish(); } } ``` ``` -------------------------------- ### Remove Responder Connection with PanicTrigger Source: https://context7.com/guardianproject/panickit/llms.txt Use `checkForDisconnectIntent` in `onResume()` to process `ACTION_DISCONNECT` Intents. This method removes the specified responder from the set of connected responders. ```java @Override protected void onResume() { super.onResume(); if (PanicTrigger.checkForDisconnectIntent(this)) { // The responder that sent ACTION_DISCONNECT is no longer connected. Toast.makeText(this, "Panic app disconnected.", Toast.LENGTH_SHORT).show(); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.