From 49d703319bff6819747bd8bd6ddd9d06f6d6c4eb Mon Sep 17 00:00:00 2001 From: Paul Stewart Date: Fri, 16 Sep 2016 17:48:37 -0700 Subject: [PATCH] Bad Wi-Fi: Change strings to carrier specs Also add a checkbox to persist the value. However, the logic to pass this persistence to ConnectivityService has not yet been added. Bug: 31075769 Test: Visual inspection of dialog (upcoming) Change-Id: I370ab07ea276b024ce4adc61e10ca085be1c5549 --- res/values/strings.xml | 7 ++++--- .../settings/wifi/WifiNoInternetDialog.java | 15 +++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 7105bc1248e..9c4b83940c4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1752,10 +1752,11 @@ Don\u2019t ask again for this network - Switch to cellular data? - Wi\u2011Fi lost Internet access. Your device can switch to cellular automatically when Wi\u2011Fi isn\u2019t working. Additional charges may apply. - Switch automatically + Wi\u2011Fi is not connected to the Internet + You can switch to the cellular network whenever Wi\u2011Fi has a bad connection. Data usage may apply. + Switch to cellular Stay on Wi\u2011Fi + Never show again Connect diff --git a/src/com/android/settings/wifi/WifiNoInternetDialog.java b/src/com/android/settings/wifi/WifiNoInternetDialog.java index 0924498f3bc..a8f9e3329d5 100644 --- a/src/com/android/settings/wifi/WifiNoInternetDialog.java +++ b/src/com/android/settings/wifi/WifiNoInternetDialog.java @@ -138,14 +138,16 @@ public final class WifiNoInternetDialog extends AlertActivity implements ap.mPositiveButtonListener = this; ap.mNegativeButtonListener = this; - if (ACTION_PROMPT_UNVALIDATED.equals(mAction)) { - final LayoutInflater inflater = LayoutInflater.from(ap.mContext); - final View checkbox = inflater.inflate( - com.android.internal.R.layout.always_use_checkbox, null); - ap.mView = checkbox; + final LayoutInflater inflater = LayoutInflater.from(ap.mContext); + final View checkbox = inflater.inflate( + com.android.internal.R.layout.always_use_checkbox, null); + ap.mView = checkbox; + mAlwaysAllow = (CheckBox) checkbox.findViewById(com.android.internal.R.id.alwaysUse); - mAlwaysAllow = (CheckBox) checkbox.findViewById(com.android.internal.R.id.alwaysUse); + if (ACTION_PROMPT_UNVALIDATED.equals(mAction)) { mAlwaysAllow.setText(getString(R.string.no_internet_access_remember)); + } else { + mAlwaysAllow.setText(getString(R.string.lost_internet_access_persist)); } setupAlert(); @@ -175,6 +177,7 @@ public final class WifiNoInternetDialog extends AlertActivity implements Log.d(TAG, "LOST_INTERNET: " + action); // Only ever set the setting to 1. The values understood by ConnectivityService are null // (use carrier default) or 1 (avoid bad networks regardless of carrier). + // TODO: Use a value other than 1 here to indicate a persisted "yes" or "no" given mAlwaysAllow. if (accept) { Settings.Global.putInt(mAlertParams.mContext.getContentResolver(), Settings.Global.NETWORK_AVOID_BAD_WIFI, 1);