Merge "Implement 'Available via Passpoint' feature [DO NOT MERGE]" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a03f330af3
@@ -36,11 +36,14 @@ public class AccessPointPreference extends Preference {
|
|||||||
|
|
||||||
private TextView mSummaryView;
|
private TextView mSummaryView;
|
||||||
private boolean showSummary = true;
|
private boolean showSummary = true;
|
||||||
|
private boolean mForSavedNetworks = false;
|
||||||
private AccessPoint mAccessPoint;
|
private AccessPoint mAccessPoint;
|
||||||
|
|
||||||
public AccessPointPreference(AccessPoint accessPoint, Context context) {
|
public AccessPointPreference(AccessPoint accessPoint, Context context,
|
||||||
|
boolean forSavedNetworks) {
|
||||||
super(context);
|
super(context);
|
||||||
mAccessPoint = accessPoint;
|
mAccessPoint = accessPoint;
|
||||||
|
mForSavedNetworks = forSavedNetworks;
|
||||||
mAccessPoint.setTag(this);
|
mAccessPoint.setTag(this);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
@@ -104,7 +107,10 @@ public class AccessPointPreference extends Preference {
|
|||||||
* Updates the title and summary; may indirectly call notifyChanged().
|
* Updates the title and summary; may indirectly call notifyChanged().
|
||||||
*/
|
*/
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
setTitle(mAccessPoint.getSsid());
|
if (mForSavedNetworks)
|
||||||
|
setTitle(mAccessPoint.getConfigName());
|
||||||
|
else
|
||||||
|
setTitle(mAccessPoint.getSsid());
|
||||||
|
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
updateIcon(mAccessPoint.getLevel(), context);
|
updateIcon(mAccessPoint.getLevel(), context);
|
||||||
@@ -112,7 +118,9 @@ public class AccessPointPreference extends Preference {
|
|||||||
// Force new summary
|
// Force new summary
|
||||||
setSummary(null);
|
setSummary(null);
|
||||||
|
|
||||||
String summary = mAccessPoint.getSummary();
|
String summary = mForSavedNetworks ? mAccessPoint.getSavedNetworkSummary()
|
||||||
|
: mAccessPoint.getSettingsSummary();
|
||||||
|
|
||||||
if (summary.length() > 0) {
|
if (summary.length() > 0) {
|
||||||
setSummary(summary);
|
setSummary(summary);
|
||||||
setShowSummary(true);
|
setShowSummary(true);
|
||||||
|
@@ -96,7 +96,7 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
|
|||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context, true,
|
final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context, true,
|
||||||
false);
|
false, true);
|
||||||
|
|
||||||
preferenceScreen.removeAll();
|
preferenceScreen.removeAll();
|
||||||
|
|
||||||
@@ -106,7 +106,7 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
|
|||||||
final int accessPointsSize = accessPoints.size();
|
final int accessPointsSize = accessPoints.size();
|
||||||
for (int i = 0; i < accessPointsSize; ++i){
|
for (int i = 0; i < accessPointsSize; ++i){
|
||||||
AccessPointPreference preference = new AccessPointPreference(accessPoints.get(i),
|
AccessPointPreference preference = new AccessPointPreference(accessPoints.get(i),
|
||||||
context);
|
context, true);
|
||||||
WifiConfiguration config = accessPoints.get(i).getConfig();
|
WifiConfiguration config = accessPoints.get(i).getConfig();
|
||||||
if (config != null) {
|
if (config != null) {
|
||||||
int userId = UserHandle.getUserId(config.creatorUid);
|
int userId = UserHandle.getUserId(config.creatorUid);
|
||||||
@@ -222,7 +222,7 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
|
|||||||
|
|
||||||
// Add available Wi-Fi access points
|
// Add available Wi-Fi access points
|
||||||
final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context,
|
final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context,
|
||||||
true, false);
|
true, false, true);
|
||||||
|
|
||||||
final int accessPointsSize = accessPoints.size();
|
final int accessPointsSize = accessPoints.size();
|
||||||
for (int i = 0; i < accessPointsSize; ++i){
|
for (int i = 0; i < accessPointsSize; ++i){
|
||||||
|
@@ -250,8 +250,15 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
mConfigUi.setSubmitButton(res.getString(R.string.wifi_connect));
|
mConfigUi.setSubmitButton(res.getString(R.string.wifi_connect));
|
||||||
} else {
|
} else {
|
||||||
if (state != null) {
|
if (state != null) {
|
||||||
addRow(group, R.string.wifi_status, AccessPoint.getSummary(
|
WifiConfiguration config = mAccessPoint.getConfig();
|
||||||
mConfigUi.getContext(), state, !mAccessPoint.isSaved()));
|
boolean isEphimeral = mAccessPoint.isSaved() == false;
|
||||||
|
String providerFriendlyName = null;
|
||||||
|
if (config != null && config.isPasspoint()) {
|
||||||
|
providerFriendlyName = config.providerFriendlyName;
|
||||||
|
}
|
||||||
|
String summary = AccessPoint.getSummary(
|
||||||
|
mConfigUi.getContext(), state, isEphimeral, providerFriendlyName);
|
||||||
|
addRow(group, R.string.wifi_status, summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signalLevel != null) {
|
if (signalLevel != null) {
|
||||||
|
@@ -156,7 +156,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
|
|
||||||
mWifiTracker = new WifiTracker(getActivity(), this, true, true);
|
mWifiTracker = new WifiTracker(getActivity(), this, true, true, false);
|
||||||
mWifiManager = mWifiTracker.getManager();
|
mWifiManager = mWifiTracker.getManager();
|
||||||
|
|
||||||
mConnectListener = new WifiManager.ActionListener() {
|
mConnectListener = new WifiManager.ActionListener() {
|
||||||
@@ -629,7 +629,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
if (accessPoint.getLevel() != -1) {
|
if (accessPoint.getLevel() != -1) {
|
||||||
hasAvailableAccessPoints = true;
|
hasAvailableAccessPoints = true;
|
||||||
AccessPointPreference preference = new AccessPointPreference(accessPoint,
|
AccessPointPreference preference = new AccessPointPreference(accessPoint,
|
||||||
getActivity());
|
getActivity(), false);
|
||||||
|
|
||||||
getPreferenceScreen().addPreference(preference);
|
getPreferenceScreen().addPreference(preference);
|
||||||
accessPoint.setListener(this);
|
accessPoint.setListener(this);
|
||||||
@@ -891,7 +891,7 @@ public class WifiSettings extends RestrictedSettingsFragment
|
|||||||
|
|
||||||
// Add saved Wi-Fi access points
|
// Add saved Wi-Fi access points
|
||||||
final Collection<AccessPoint> accessPoints =
|
final Collection<AccessPoint> accessPoints =
|
||||||
WifiTracker.getCurrentAccessPoints(context, true, false);
|
WifiTracker.getCurrentAccessPoints(context, true, false, false);
|
||||||
for (AccessPoint accessPoint : accessPoints) {
|
for (AccessPoint accessPoint : accessPoints) {
|
||||||
data = new SearchIndexableRaw(context);
|
data = new SearchIndexableRaw(context);
|
||||||
data.title = accessPoint.getSsid();
|
data.title = accessPoint.getSsid();
|
||||||
|
@@ -300,7 +300,7 @@ public class WifiStatusTest extends Activity {
|
|||||||
WifiInfo info = mWifiManager.getConnectionInfo();
|
WifiInfo info = mWifiManager.getConnectionInfo();
|
||||||
String summary = AccessPoint.getSummary(this, info.getSSID(),
|
String summary = AccessPoint.getSummary(this, info.getSSID(),
|
||||||
networkInfo.getDetailedState(),
|
networkInfo.getDetailedState(),
|
||||||
info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID);
|
info.getNetworkId() == WifiConfiguration.INVALID_NETWORK_ID, null);
|
||||||
mNetworkState.setText(summary);
|
mNetworkState.setText(summary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user