Commit bd983d97 authored by Torsten Grote's avatar Torsten Grote

Remove non-functional uninstall panic action

Fixes #1109
parent de8d1b7d
......@@ -31,13 +31,12 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
public static final String KEY_LOCK = "pref_key_lock";
public static final String KEY_PANIC_APP = "pref_key_panic_app";
public static final String KEY_PURGE = "pref_key_purge";
public static final String KEY_UNINSTALL = "pref_key_uninstall";
private static final Logger LOG =
Logger.getLogger(PanicPreferencesFragment.class.getName());
private PackageManager pm;
private SwitchPreference lockPref, purgePref, uninstallPref;
private SwitchPreference lockPref, purgePref;
private ListPreference panicAppPref;
@Override
......@@ -49,7 +48,6 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
lockPref = (SwitchPreference) findPreference(KEY_LOCK);
panicAppPref = (ListPreference) findPreference(KEY_PANIC_APP);
purgePref = (SwitchPreference) findPreference(KEY_PURGE);
uninstallPref = (SwitchPreference) findPreference(KEY_UNINSTALL);
// check for connect/disconnect intents from panic trigger apps
if (PanicResponder.checkForDisconnectIntent(getActivity())) {
......@@ -99,12 +97,9 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
if (packageName.equals(Panic.PACKAGE_NAME_NONE)) {
purgePref.setChecked(false);
purgePref.setEnabled(false);
uninstallPref.setChecked(false);
uninstallPref.setEnabled(false);
getActivity().setResult(Activity.RESULT_CANCELED);
} else {
purgePref.setEnabled(true);
uninstallPref.setEnabled(true);
}
return true;
......@@ -148,22 +143,11 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
if (sharedPreferences.getBoolean(KEY_PURGE, false)) {
lockPref.setChecked(true);
}
// disable uninstall if purging gets disabled
else {
uninstallPref.setChecked(false);
}
}
// enable purging and locking if uninstall gets enabled
if (key.equals(KEY_UNINSTALL) &&
sharedPreferences.getBoolean(KEY_UNINSTALL, false)) {
lockPref.setChecked(true);
purgePref.setChecked(true);
}
// disable purging and uninstalling if locking gets disabled
if (key.equals(KEY_LOCK) &&
!sharedPreferences.getBoolean(KEY_LOCK, true)) {
purgePref.setChecked(false);
uninstallPref.setChecked(false);
}
}
......@@ -179,7 +163,6 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
// disable destructive panic actions
purgePref.setEnabled(false);
uninstallPref.setEnabled(false);
} else {
// display connected panic app
try {
......@@ -191,7 +174,6 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
// enable destructive panic actions
purgePref.setEnabled(true);
uninstallPref.setEnabled(true);
} catch (PackageManager.NameNotFoundException e) {
// revert back to no app, just to be safe
PanicResponder.setTriggerPackageName(getActivity(),
......
......@@ -2,7 +2,6 @@ package org.briarproject.briar.android.panic;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.preference.PreferenceManager;
......@@ -21,10 +20,8 @@ import info.guardianproject.panic.Panic;
import info.guardianproject.panic.PanicResponder;
import info.guardianproject.trustedintents.TrustedIntents;
import static android.content.Intent.ACTION_DELETE;
import static org.briarproject.briar.android.panic.PanicPreferencesFragment.KEY_LOCK;
import static org.briarproject.briar.android.panic.PanicPreferencesFragment.KEY_PURGE;
import static org.briarproject.briar.android.panic.PanicPreferencesFragment.KEY_UNINSTALL;
public class PanicResponderActivity extends BriarActivity {
......@@ -59,16 +56,7 @@ public class PanicResponderActivity extends BriarActivity {
LOG.info("Panic Trigger came from connected app");
// Performing panic responses
if (sharedPref.getBoolean(KEY_UNINSTALL, false)) {
LOG.info("Purging all data...");
deleteAllData();
LOG.info("Uninstalling...");
Intent uninstall = new Intent(ACTION_DELETE);
uninstall.setData(
Uri.parse("package:" + getPackageName()));
startActivity(uninstall);
} else if (sharedPref.getBoolean(KEY_PURGE, false)) {
if (sharedPref.getBoolean(KEY_PURGE, false)) {
LOG.info("Purging all data...");
deleteAllData();
}
......
......@@ -398,6 +398,7 @@
<string name="panic_app_setting_none">None</string>
<string name="dialog_title_connect_panic_app">Confirm Panic App</string>
<string name="dialog_message_connect_panic_app">Are you sure that you want to allow %1$s to trigger destructive panic button actions?</string>
<string name="panic_setting_destructive_action">Destructive Actions</string>
<string name="panic_setting_signout_title">Sign Out</string>
<string name="panic_setting_signout_summary">Sign out of Briar if a panic button is pressed</string>
<string name="purge_setting_title">Delete Account</string>
......
......@@ -2,30 +2,29 @@
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
<ListPreference
android:icon="@android:drawable/ic_menu_close_clear_cancel"
android:key="pref_key_panic_app"
android:summary="@string/panic_app_setting_summary"
android:title="@string/panic_app_setting_title"/>
<SwitchPreference
android:defaultValue="true"
android:key="pref_key_lock"
android:summary="@string/panic_setting_signout_summary"
android:title="@string/panic_setting_signout_title"/>
<SwitchPreference
android:defaultValue="false"
android:enabled="false"
android:key="pref_key_purge"
android:summary="@string/purge_setting_summary"
android:title="@string/purge_setting_title"/>
<PreferenceCategory
android:layout="@layout/preferences_category"
android:title="@string/panic_setting_destructive_action">
<SwitchPreference
android:defaultValue="false"
android:enabled="false"
android:key="pref_key_uninstall"
android:summary="@string/uninstall_setting_summary"
android:title="@string/uninstall_setting_title"/>
<ListPreference
android:icon="@android:drawable/ic_menu_close_clear_cancel"
android:key="pref_key_panic_app"
android:summary="@string/panic_app_setting_summary"
android:title="@string/panic_app_setting_title"/>
<SwitchPreference
android:defaultValue="false"
android:enabled="false"
android:key="pref_key_purge"
android:summary="@string/purge_setting_summary"
android:title="@string/purge_setting_title"/>
</PreferenceCategory>
</PreferenceScreen>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment