From 222dd91102b2cc9244559d2f691fac0b8abd8515 Mon Sep 17 00:00:00 2001 From: Jeremy Goldman Date: Thu, 11 Mar 2021 13:57:23 +0800 Subject: [PATCH] Legacy VPN Configuration Dialog includes error message if VPN is an insecure type. Screenshot: https://screenshot.googleplex.com/53pAJuhTDLJW4Em Bug: 176821216 Test: atest SettingsUnitTests Change-Id: I528d46654a39df04b647d6d0137aaf80e7adb05c Merged-In: I528d46654a39df04b647d6d0137aaf80e7adb05c (cherry picked from commit 5d92ad5232f581c5e92f5edd4098c5937bf55300) --- res/layout/vpn_dialog.xml | 408 ++++++++++-------- res/values/strings.xml | 3 + .../android/settings/vpn2/ConfigDialog.java | 8 +- 3 files changed, 232 insertions(+), 187 deletions(-) diff --git a/res/layout/vpn_dialog.xml b/res/layout/vpn_dialog.xml index 73f669b5740..9e264f92d67 100644 --- a/res/layout/vpn_dialog.xml +++ b/res/layout/vpn_dialog.xml @@ -13,218 +13,254 @@ See the License for the specific language governing permissions and limitations under the License. --> - - + - + android:layout_height="wrap_content" + android:textAppearance="@android:style/TextAppearance.DeviceDefault.Small" + android:id="@+id/dialog_alert_subtitle" + android:text="@string/vpn_insecure_dialog_subtitle" + android:textColor="?android:attr/colorError" + android:visibility="gone" + android:includeFontPadding="false" + android:padding="0dp" /> - + + android:paddingTop="24dp"> - - - - - - - - - - - - + - + android:text="@string/vpn_name" + android:labelFor="@+id/name"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + - + android:orientation="vertical"> + - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:animateLayoutChanges="true"> + + - - - - - - - - - - - - - - - - - - + + diff --git a/res/values/strings.xml b/res/values/strings.xml index d306ea9b5b5..ee1cb60d462 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -7061,6 +7061,9 @@ [CHAR LIMIT=40] --> Require VPN connection? + + This VPN is not secure. Update to an IKEv2 VPN + Select a VPN profile to always remain connected to. Network traffic will only be allowed when connected to this VPN. diff --git a/src/com/android/settings/vpn2/ConfigDialog.java b/src/com/android/settings/vpn2/ConfigDialog.java index 03e3613b9eb..24fb576a818 100644 --- a/src/com/android/settings/vpn2/ConfigDialog.java +++ b/src/com/android/settings/vpn2/ConfigDialog.java @@ -204,10 +204,16 @@ class ConfigDialog extends AlertDialog implements TextWatcher, configureAdvancedOptionsVisibility(); - // Create a button to forget the profile if it has already been saved.. if (mExists) { + // Create a button to forget the profile if it has already been saved.. setButton(DialogInterface.BUTTON_NEUTRAL, context.getString(R.string.vpn_forget), mListener); + + // Display warning subtitle if the existing VPN is an insecure type... + if (VpnProfile.isLegacyType(mProfile.type)) { + TextView subtitle = mView.findViewById(R.id.dialog_alert_subtitle); + subtitle.setVisibility(View.VISIBLE); + } } // Create a button to save the profile.