From dcc61554263e91c80b27ab64a9bc80302fda096f Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Wed, 10 Jun 2015 15:16:36 +0900 Subject: [PATCH 1/2] Reword "no internet access" dialog to conform with mocks. Bug: 20081183 Bug: 20739299 Change-Id: I63e58dafcba879c56669766f652729a73ef722e2 --- res/values/strings.xml | 2 +- src/com/android/settings/wifi/WifiNoInternetDialog.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 967e52f29d3..bde0a9f33ec 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1588,7 +1588,7 @@ CONNECT - This network has no Internet access. Use this network anyway? + This network has no Internet access. Stay connected? Don\u2019t ask again for this network diff --git a/src/com/android/settings/wifi/WifiNoInternetDialog.java b/src/com/android/settings/wifi/WifiNoInternetDialog.java index f044114f9df..970524828ab 100644 --- a/src/com/android/settings/wifi/WifiNoInternetDialog.java +++ b/src/com/android/settings/wifi/WifiNoInternetDialog.java @@ -112,8 +112,8 @@ public final class WifiNoInternetDialog extends AlertActivity implements final AlertController.AlertParams ap = mAlertParams; ap.mTitle = mNetworkName; ap.mMessage = getString(R.string.no_internet_access_text); - ap.mPositiveButtonText = getString(android.R.string.ok); - ap.mNegativeButtonText = getString(android.R.string.cancel); + ap.mPositiveButtonText = getString(R.string.yes); + ap.mNegativeButtonText = getString(R.string.no); ap.mPositiveButtonListener = this; ap.mNegativeButtonListener = this; From 25935892092a9efe31c075555f0e9e6fc72d795c Mon Sep 17 00:00:00 2001 From: Lorenzo Colitti Date: Wed, 10 Jun 2015 22:49:52 +0900 Subject: [PATCH 2/2] Pass in the netId using intent data, not intent extras. This allows ConnectivityService to use different PendingIntents for different dialogs; two PendingIntents that differ in their data are treated as different, but two PendingIntents that differ only in their extras are treated as being the same. Bug: 20081183 Change-Id: Ie1bdcf2a0a0747be815ea528db0cb34f5ab415b9 --- .../android/settings/wifi/WifiNoInternetDialog.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/wifi/WifiNoInternetDialog.java b/src/com/android/settings/wifi/WifiNoInternetDialog.java index 970524828ab..b87087372c3 100644 --- a/src/com/android/settings/wifi/WifiNoInternetDialog.java +++ b/src/com/android/settings/wifi/WifiNoInternetDialog.java @@ -54,15 +54,21 @@ public final class WifiNoInternetDialog extends AlertActivity implements final Intent intent = getIntent(); if (intent == null || - !intent.getAction().equals(ConnectivityManager.ACTION_PROMPT_UNVALIDATED)) { + !intent.getAction().equals(ConnectivityManager.ACTION_PROMPT_UNVALIDATED) || + !"netId".equals(intent.getScheme())) { Log.e(TAG, "Unexpected intent " + intent + ", exiting"); finish(); return; } - mNetwork = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK); + try { + mNetwork = new Network(Integer.parseInt(intent.getData().getSchemeSpecificPart())); + } catch (NullPointerException|NumberFormatException e) { + mNetwork = null; + } + if (mNetwork == null) { - Log.e(TAG, "ACTION_PROMPT_UNVALIDATED for null network, exiting"); + Log.e(TAG, "Can't determine network from '" + intent.getData() + "' , exiting"); finish(); return; }