diff --git a/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java b/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java index 2335dd3b..27442ac9 100644 --- a/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java +++ b/app/src/main/java/com/emanuelef/remote_capture/activities/SettingsActivity.java @@ -134,6 +134,7 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment private DropDownPreference mIpMode; private DropDownPreference mCapInterface; private Preference mVpnExceptions; + private Preference mMitmWizard; private SwitchPreference mMalwareDetectionEnabled; private Billing mIab; private boolean mHasStartedMitmWizard; @@ -157,7 +158,7 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment fullPayloadHideShow(mTlsDecryption.isChecked()); socks5ProxyHideShow(mTlsDecryption.isChecked(), mSocks5Enabled.isChecked(), rootCaptureEnabled()); - mBlockQuic.setVisible(mTlsDecryption.isChecked()); + mBlockQuic.setVisible(mTlsDecryption.isChecked() && !rootCaptureEnabled()); rootCaptureHideShow(rootCaptureEnabled()); Intent intent = requireActivity().getIntent(); @@ -288,6 +289,9 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment boolean enabled = (boolean) newValue; Context ctx = requireContext(); + if(checkDecrpytionWithRoot(rootCaptureEnabled(), (boolean) newValue)) + return false; + if(enabled && MitmAddon.needsSetup(ctx)) { mHasStartedMitmWizard = true; Intent intent = new Intent(ctx, MitmSetupWizard.class); @@ -295,16 +299,23 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment return false; } - checkDecrpytionWithRoot(rootCaptureEnabled(), (boolean) newValue); - fullPayloadHideShow((boolean) newValue); - mBlockQuic.setVisible((boolean) newValue); + mBlockQuic.setVisible(((boolean) newValue) && !rootCaptureEnabled()); + mMitmWizard.setVisible((boolean) newValue); socks5ProxyHideShow((boolean) newValue, mSocks5Enabled.isChecked(), rootCaptureEnabled()); return true; }); mFullPayloadEnabled = requirePreference(Prefs.PREF_FULL_PAYLOAD); mBlockQuic = requirePreference(Prefs.PREF_BLOCK_QUIC); + mMitmWizard = requirePreference("mitm_setup_wizard"); + mMitmWizard.setVisible(mTlsDecryption.isChecked()); + mMitmWizard.setOnPreferenceClickListener(preference -> { + mHasStartedMitmWizard = true; + Intent intent = new Intent(requireContext(), MitmSetupWizard.class); + startActivity(intent); + return true; + }); mSocks5Enabled = requirePreference(Prefs.PREF_SOCKS5_ENABLED_KEY); mSocks5Enabled.setOnPreferenceChangeListener((preference, newValue) -> { @@ -415,9 +426,9 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment mVpnExceptions.setVisible(!enabled); } - private void checkDecrpytionWithRoot(boolean rootEnabled, boolean tlsDecryption) { + private boolean checkDecrpytionWithRoot(boolean rootEnabled, boolean tlsDecryption) { if(mRootDecryptionNoticeShown || !rootEnabled || !tlsDecryption) - return; + return false; new AlertDialog.Builder(requireContext()) .setMessage(R.string.tls_decryption_with_root_msg) @@ -425,6 +436,7 @@ public class SettingsActivity extends BaseActivity implements PreferenceFragment .show(); mRootDecryptionNoticeShown = true; + return true; } } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d1a4bf6e..9044d3e5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -411,4 +411,5 @@ Paid feature Buy the %1$s feature to start blocking connections The mitm certificate does not seem to be installed. If you proceed, decryption may fail + Configure the device for the TLS decryption diff --git a/app/src/main/res/xml/root_preferences.xml b/app/src/main/res/xml/root_preferences.xml index 7b96f573..55132a45 100644 --- a/app/src/main/res/xml/root_preferences.xml +++ b/app/src/main/res/xml/root_preferences.xml @@ -66,6 +66,12 @@ app:summary="@string/tls_decryption_summary" app:defaultValue="false" /> + +