Remove non-functional uninstall panic action

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