From fe475227efdf69a4342a1e393ae60ca01fe9af30 Mon Sep 17 00:00:00 2001 From: Sanket Padawe Date: Mon, 23 Mar 2015 12:01:19 -0700 Subject: [PATCH 1/4] Fix "Rename device" BT settings to avoid accepting blank spaces. Bug: 16157293 Change-Id: I0eddafd9fad89b76ab1d00005ca4a4f2725eb83e --- .../android/settings/bluetooth/BluetoothNameDialogFragment.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java index 4466aeae5c1..ccbb6556f8e 100644 --- a/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java +++ b/src/com/android/settings/bluetooth/BluetoothNameDialogFragment.java @@ -188,7 +188,7 @@ public final class BluetoothNameDialogFragment extends DialogFragment implements } else { mDeviceNameEdited = true; if (mOkButton != null) { - mOkButton.setEnabled(s.length() != 0); + mOkButton.setEnabled(s.toString().trim().length() != 0); } } } From ee5f27dbeeef90381de905d05b3b67bc1837df20 Mon Sep 17 00:00:00 2001 From: Pavel Zhamaitsiak Date: Mon, 23 Mar 2015 14:43:24 -0700 Subject: [PATCH 2/4] Update Wi-Fi Calling settings - Update strings - Move WFC mode summary strings to framework/base - Update screens to reflect latest UX requirements Change-Id: Ibcb1a0b6eec2342dfbaa30f90fe728976ad80a0d --- res/values/strings.xml | 12 +++------- res/xml/wireless_settings.xml | 12 +++++----- .../android/settings/WifiCallingSettings.java | 24 +++++++++++++++---- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 1dafbeb8e63..09ba335a41f 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1887,7 +1887,7 @@ Wi-Fi calling - Wi-Fi calling mode + Calling preference Wi-Fi calling mode @@ -1900,14 +1900,8 @@ "1" "0" - - Off - - Wi-Fi preferred (Uses cell network only if Wi-Fi isn\'t available) - - Cellular preferred (Uses Wi-Fi only if cell network isn\'t available) - - Wi-Fi only (Never uses cell network. Can\'t make or receive calls if Wi-Fi isn\'t available) + + When Wi-Fi calling is on, your phone can route calls via Wi-Fi networks or your carrier\'s network, depending on your preference and which signal is stronger. Before turning on this feature, check with your carrier regarding fees and other details. diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml index 7a4ed9a52aa..b615c9e2c9f 100644 --- a/res/xml/wireless_settings.xml +++ b/res/xml/wireless_settings.xml @@ -37,6 +37,12 @@ android:summary="@string/nfc_quick_toggle_summary" android:persistent="false" /> + + - - Date: Fri, 11 Jul 2014 14:56:06 -0700 Subject: [PATCH 3/4] Increase allowed duration to connect to HOGP profile This patch increases the duration allowed between the first device connection attempt (immidiately after bonding) and profile connection after service discovery from 5 seconds to 30 seconds to allow HOGP connections for slow connection conditions. Change-Id: Ia8a33a6ef8951d6e08b4a22837fcfdb70910112c --- .../settings/bluetooth/CachedBluetoothDevice.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java index f33f4db2bc7..c8b9c5b2256 100755 --- a/src/com/android/settings/bluetooth/CachedBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/CachedBluetoothDevice.java @@ -16,6 +16,7 @@ package com.android.settings.bluetooth; +import android.bluetooth.BluetoothUuid; import android.bluetooth.BluetoothClass; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; @@ -102,6 +103,7 @@ final class CachedBluetoothDevice implements Comparable { // See mConnectAttempted private static final long MAX_UUID_DELAY_FOR_AUTO_CONNECT = 5000; + private static final long MAX_HOGP_DELAY_FOR_AUTO_CONNECT = 30000; /** Auto-connect after pairing only if locally initiated. */ private boolean mConnectAfterPairing; @@ -523,9 +525,11 @@ final class CachedBluetoothDevice implements Comparable { */ void onUuidChanged() { updateProfiles(); + ParcelUuid[] uuids = mDevice.getUuids(); + long timeout = MAX_UUID_DELAY_FOR_AUTO_CONNECT; if (DEBUG) { - Log.e(TAG, "onUuidChanged: Time since last connect" + Log.d(TAG, "onUuidChanged: Time since last connect" + (SystemClock.elapsedRealtime() - mConnectAttempted)); } @@ -533,9 +537,11 @@ final class CachedBluetoothDevice implements Comparable { * If a connect was attempted earlier without any UUID, we will do the * connect now. */ + if (BluetoothUuid.isUuidPresent(uuids, BluetoothUuid.Hogp)) { + timeout = MAX_HOGP_DELAY_FOR_AUTO_CONNECT; + } if (!mProfiles.isEmpty() - && (mConnectAttempted + MAX_UUID_DELAY_FOR_AUTO_CONNECT) > SystemClock - .elapsedRealtime()) { + && (mConnectAttempted + timeout) > SystemClock.elapsedRealtime()) { connectWithoutResettingTimer(false); } dispatchAttributesChanged(); From 15b4c84c315f3998308e7e58ebcfdc388800e6a6 Mon Sep 17 00:00:00 2001 From: Vinit Deshpande Date: Tue, 24 Mar 2015 19:10:42 -0700 Subject: [PATCH 4/4] Fix settings UI for passpoint networks This change includes showing the friendly name in saved networks list and 'Connected via provider' addition for passpoint connections. Change-Id: I613770e0468f888c280e82a89b8a012a841d5bbd --- res/values/strings.xml | 2 ++ .../android/settings/wifi/AccessPoint.java | 16 ++++++++++-- src/com/android/settings/wifi/Summary.java | 26 +++++++++++++++---- .../android/settings/wifi/WifiSettings.java | 23 ++++++++++++++++ 4 files changed, 60 insertions(+), 7 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 4301e39c45d..b3aadaedc40 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1333,6 +1333,8 @@ Wi\u2011Fi Assistant Connected via Wi\u2011Fi assistant + + Connected via %1$s Cast screen diff --git a/src/com/android/settings/wifi/AccessPoint.java b/src/com/android/settings/wifi/AccessPoint.java index 1bf1a5c5a13..1d5f8ce1fed 100644 --- a/src/com/android/settings/wifi/AccessPoint.java +++ b/src/com/android/settings/wifi/AccessPoint.java @@ -230,7 +230,11 @@ class AccessPoint extends Preference { } private void loadConfig(WifiConfiguration config) { - ssid = (config.SSID == null ? "" : removeDoubleQuotes(config.SSID)); + if (config.isPasspoint()) + ssid = config.providerFriendlyName; + else + ssid = (config.SSID == null ? "" : removeDoubleQuotes(config.SSID)); + bssid = config.BSSID; security = getSecurity(config); networkId = config.networkId; @@ -360,6 +364,7 @@ class AccessPoint extends Preference { refresh(); return true; } + return false; } @@ -394,6 +399,11 @@ class AccessPoint extends Preference { } } + void update(WifiConfiguration config) { + mConfig = config; + refresh(); + } + int getLevel() { if (mRssi == Integer.MAX_VALUE) { return -1; @@ -617,8 +627,10 @@ class AccessPoint extends Preference { StringBuilder summary = new StringBuilder(); if (isActive()) { // This is the active connection + String passpointProvider = (mConfig != null && mConfig.isPasspoint()) ? + mConfig.providerFriendlyName : null; summary.append(Summary.get(context, getState(), - networkId == WifiConfiguration.INVALID_NETWORK_ID)); + networkId == WifiConfiguration.INVALID_NETWORK_ID, passpointProvider)); } else if (mConfig != null && mConfig.hasNoInternetAccess()) { summary.append(context.getString(R.string.wifi_no_internet)); diff --git a/src/com/android/settings/wifi/Summary.java b/src/com/android/settings/wifi/Summary.java index 123f64a8a73..2abe3b95299 100644 --- a/src/com/android/settings/wifi/Summary.java +++ b/src/com/android/settings/wifi/Summary.java @@ -20,12 +20,20 @@ import com.android.settings.R; import android.content.Context; import android.net.NetworkInfo.DetailedState; +import android.text.TextUtils; class Summary { - static String get(Context context, String ssid, DetailedState state, boolean isEphemeral) { - if (state == DetailedState.CONNECTED && isEphemeral && ssid == null) { - // Special case for connected + ephemeral networks. - return context.getString(R.string.connected_via_wfa); + static String get(Context context, String ssid, DetailedState state, boolean isEphemeral, + String passpointProvider) { + if (state == DetailedState.CONNECTED) { + if (TextUtils.isEmpty(passpointProvider) == false) { + // Special case for connected + ephemeral networks. + String format = context.getString(R.string.connected_via_passpoint); + return String.format(format, passpointProvider); + } else if (isEphemeral && ssid == null) { + // Special case for connected + ephemeral networks. + return context.getString(R.string.connected_via_wfa); + } } String[] formats = context.getResources().getStringArray((ssid == null) @@ -38,7 +46,15 @@ class Summary { return String.format(formats[index], ssid); } + static String get(Context context, String ssid, DetailedState state, boolean isEphemeral) { + return get(context, ssid, state, isEphemeral, null); + } static String get(Context context, DetailedState state, boolean isEphemeral) { - return get(context, null, state, isEphemeral); + return get(context, null, state, isEphemeral, null); + } + + static String get(Context context, DetailedState state, boolean isEphemeral, + String passpointProvider) { + return get(context, null, state, isEphemeral, passpointProvider); } } diff --git a/src/com/android/settings/wifi/WifiSettings.java b/src/com/android/settings/wifi/WifiSettings.java index 54ebc6d6147..2fd695d838d 100644 --- a/src/com/android/settings/wifi/WifiSettings.java +++ b/src/com/android/settings/wifi/WifiSettings.java @@ -653,6 +653,7 @@ public class WifiSettings extends RestrictedSettingsFragment switch (wifiState) { case WifiManager.WIFI_STATE_ENABLED: // AccessPoints are automatically sorted with TreeSet. + mLastInfo = mWifiManager.getConnectionInfo(); final Collection accessPoints = constructAccessPoints(getActivity(), mWifiManager, mLastInfo, mLastNetworkInfo); @@ -721,6 +722,7 @@ public class WifiSettings extends RestrictedSettingsFragment /** Lookup table to more quickly update AccessPoints by only considering objects with the * correct SSID. Maps SSID -> List of AccessPoints with the given SSID. */ Multimap apMap = new Multimap(); + WifiConfiguration connectionConfig = null; final List configs = wifiManager.getConfiguredNetworks(); if (configs != null) { @@ -732,13 +734,23 @@ public class WifiSettings extends RestrictedSettingsFragment } } for (WifiConfiguration config : configs) { + if (lastInfo != null && lastInfo.getNetworkId() == config.networkId) { + connectionConfig = config; + } + if (config.selfAdded && config.numAssociation == 0) { continue; } + + if (config.isPasspoint()) { + continue; + } + AccessPoint accessPoint = new AccessPoint(context, config); if (lastInfo != null && lastNetworkInfo != null) { accessPoint.update(lastInfo, lastNetworkInfo); } + accessPoints.add(accessPoint); apMap.put(accessPoint.ssid, accessPoint); } @@ -758,11 +770,22 @@ public class WifiSettings extends RestrictedSettingsFragment if (accessPoint.update(result)) found = true; } + if (!found) { + AccessPoint accessPoint = new AccessPoint(context, result); if (lastInfo != null && lastNetworkInfo != null) { accessPoint.update(lastInfo, lastNetworkInfo); } + + if (lastInfo != null && lastInfo.getBSSID() != null + && lastInfo.getBSSID().equals(result.BSSID) + && connectionConfig != null && connectionConfig.isPasspoint()) { + /* This network is connected via this passpoint config */ + /* SSID match is not going to work for it; so update explicitly */ + accessPoint.update(connectionConfig); + } + accessPoints.add(accessPoint); apMap.put(accessPoint.ssid, accessPoint); }