Allow sign out by trusted non-paired panic apps

parent 9155f62d
...@@ -97,14 +97,12 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat ...@@ -97,14 +97,12 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
showPanicApp(packageName); showPanicApp(packageName);
if (packageName.equals(Panic.PACKAGE_NAME_NONE)) { if (packageName.equals(Panic.PACKAGE_NAME_NONE)) {
lockPref.setEnabled(false);
purgePref.setChecked(false); purgePref.setChecked(false);
purgePref.setEnabled(false); purgePref.setEnabled(false);
uninstallPref.setChecked(false); uninstallPref.setChecked(false);
uninstallPref.setEnabled(false); uninstallPref.setEnabled(false);
getActivity().setResult(Activity.RESULT_CANCELED); getActivity().setResult(Activity.RESULT_CANCELED);
} else { } else {
lockPref.setEnabled(true);
purgePref.setEnabled(true); purgePref.setEnabled(true);
uninstallPref.setEnabled(true); uninstallPref.setEnabled(true);
} }
...@@ -179,8 +177,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat ...@@ -179,8 +177,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
panicAppPref.setIcon( panicAppPref.setIcon(
android.R.drawable.ic_menu_close_clear_cancel); android.R.drawable.ic_menu_close_clear_cancel);
// disable panic actions // disable destructive panic actions
lockPref.setEnabled(false);
purgePref.setEnabled(false); purgePref.setEnabled(false);
uninstallPref.setEnabled(false); uninstallPref.setEnabled(false);
} else { } else {
...@@ -192,8 +189,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat ...@@ -192,8 +189,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
panicAppPref.setIcon( panicAppPref.setIcon(
pm.getApplicationIcon(triggerPackageName)); pm.getApplicationIcon(triggerPackageName));
// enable panic actions // enable destructive panic actions
lockPref.setEnabled(true);
purgePref.setEnabled(true); purgePref.setEnabled(true);
uninstallPref.setEnabled(true); uninstallPref.setEnabled(true);
} catch (PackageManager.NameNotFoundException e) { } catch (PackageManager.NameNotFoundException e) {
......
...@@ -71,11 +71,13 @@ public class PanicResponderActivity extends BriarActivity { ...@@ -71,11 +71,13 @@ public class PanicResponderActivity extends BriarActivity {
} else if (sharedPref.getBoolean(KEY_PURGE, false)) { } else if (sharedPref.getBoolean(KEY_PURGE, false)) {
LOG.info("Purging all data..."); LOG.info("Purging all data...");
deleteAllData(); deleteAllData();
} else if (sharedPref.getBoolean(KEY_LOCK, true)) {
LOG.info("Signing out...");
signOut(true);
} }
} }
// non-destructive actions are allowed by non-connected trusted apps
if (sharedPref.getBoolean(KEY_LOCK, true)) {
LOG.info("Signing out...");
signOut(true);
}
} }
} }
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:enabled="false"
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"/>
......
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