From 82ff3d5c568b698995c3360595065cff10eaf384 Mon Sep 17 00:00:00 2001 From: xinhe Date: Wed, 7 Jan 2015 17:41:51 -0800 Subject: set softAP on a specified band, including both 2.4 and 5 GHz band Bug:18929692 Change-Id: I455e9b17e5091596beb0246ccfd981c5d2b932f0 --- res/layout/wifi_ap_dialog.xml | 25 +++++++++++++++++++++ res/values/strings.xml | 6 +++++ src/com/android/settings/wifi/WifiApDialog.java | 30 ++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/res/layout/wifi_ap_dialog.xml b/res/layout/wifi_ap_dialog.xml index 30043c46a..7a038cb1b 100644 --- a/res/layout/wifi_ap_dialog.xml +++ b/res/layout/wifi_ap_dialog.xml @@ -66,6 +66,31 @@ style="@style/wifi_item_content" android:prompt="@string/wifi_security" android:entries="@array/wifi_ap_security" /> + + + + + + + + + Password Show password + + Config AP Band + + 2.4 GHz Band + + 5 GHz Band IP settings diff --git a/src/com/android/settings/wifi/WifiApDialog.java b/src/com/android/settings/wifi/WifiApDialog.java index fb8026a9f..352ae143f 100644 --- a/src/com/android/settings/wifi/WifiApDialog.java +++ b/src/com/android/settings/wifi/WifiApDialog.java @@ -32,9 +32,13 @@ import android.widget.CheckBox; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; +import android.widget.RadioGroup; +import android.widget.RadioButton; import com.android.settings.R; +import android.util.Log; + /** * Dialog to configure the SSID and security settings * for Access Point operation @@ -53,8 +57,12 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, private TextView mSsid; private int mSecurityTypeIndex = OPEN_INDEX; private EditText mPassword; + private RadioGroup mChannel; + private RadioButton mChannel2G; + private RadioButton mChannel5G; WifiConfiguration mWifiConfig; + private static final String TAG = "WifiApDialog"; public WifiApDialog(Context context, DialogInterface.OnClickListener listener, WifiConfiguration wifiConfig) { @@ -85,6 +93,16 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, */ config.SSID = mSsid.getText().toString(); + //obtain the band configure + if (mChannel2G.isChecked()) { + config.apBand = 0; + } else if(mChannel5G.isChecked()) { + config.apBand = 1; + } else { + Log.e("TAG", "AP band configure error!"); + return null; + } + switch (mSecurityTypeIndex) { case OPEN_INDEX: config.allowedKeyManagement.set(KeyMgmt.NONE); @@ -118,15 +136,25 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, mSsid = (TextView) mView.findViewById(R.id.ssid); mPassword = (EditText) mView.findViewById(R.id.password); + mChannel = (RadioGroup) mView.findViewById(R.id.choose_channel); + mChannel2G = (RadioButton) mView.findViewById(R.id.ap_2G_band); + mChannel5G = (RadioButton) mView.findViewById(R.id.ap_5G_band); + setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener); setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.wifi_cancel), mListener); if (mWifiConfig != null) { mSsid.setText(mWifiConfig.SSID); + if (mWifiConfig.apBand == 0) { + mChannel2G.setChecked(true); + } else { + mChannel5G.setChecked(true); + } + mSecurity.setSelection(mSecurityTypeIndex); if (mSecurityTypeIndex == WPA2_INDEX) { - mPassword.setText(mWifiConfig.preSharedKey); + mPassword.setText(mWifiConfig.preSharedKey); } } -- cgit v1.2.3 From d51b9525c913b4a34a8ea1f2cf18b0f8555da51a Mon Sep 17 00:00:00 2001 From: xinhe Date: Mon, 23 Feb 2015 17:10:08 -0800 Subject: Do not provide 5GHz option for softap if there is no country code available Bug:19414134 Change-Id: I3899d9daa33eca5d2c5528c2e4da97b02d019160 --- src/com/android/settings/wifi/WifiApDialog.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/com/android/settings/wifi/WifiApDialog.java b/src/com/android/settings/wifi/WifiApDialog.java index 352ae143f..eee3db970 100644 --- a/src/com/android/settings/wifi/WifiApDialog.java +++ b/src/com/android/settings/wifi/WifiApDialog.java @@ -22,6 +22,7 @@ import android.content.DialogInterface; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiConfiguration.AuthAlgorithm; import android.net.wifi.WifiConfiguration.KeyMgmt; +import android.net.wifi.WifiManager; import android.os.Bundle; import android.text.Editable; import android.text.InputType; @@ -62,6 +63,8 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, private RadioButton mChannel5G; WifiConfiguration mWifiConfig; + WifiManager mWifiManager; + private static final String TAG = "WifiApDialog"; public WifiApDialog(Context context, DialogInterface.OnClickListener listener, @@ -72,6 +75,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, if (wifiConfig != null) { mSecurityTypeIndex = getSecurityTypeIndex(wifiConfig); } + mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); } public static int getSecurityTypeIndex(WifiConfiguration wifiConfig) { @@ -140,6 +144,17 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, mChannel2G = (RadioButton) mView.findViewById(R.id.ap_2G_band); mChannel5G = (RadioButton) mView.findViewById(R.id.ap_5G_band); + String countryCode = mWifiManager.getCountryCode(); + if (!mWifiManager.is5GHzBandSupported() || countryCode == null) { + //If no country code, 5GHz AP is forbidden + Log.e(TAG," NO country code, forbid 5GHz"); + mChannel5G.setVisibility(View.INVISIBLE); + mWifiConfig.apBand = 0; + } else { + mChannel5G.setVisibility(View.VISIBLE); + } + + setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener); setButton(DialogInterface.BUTTON_NEGATIVE, context.getString(R.string.wifi_cancel), mListener); -- cgit v1.2.3 From 4ab32563f1cd7d018ee7cdaec8d5a527964a05b9 Mon Sep 17 00:00:00 2001 From: Pavel Zhamaitsiak Date: Mon, 23 Feb 2015 15:34:07 -0800 Subject: Add Wi-Fi Calling preference screen Change-Id: Ie89902b55c5c4184236636f5039b3246a9c0bda5 --- AndroidManifest.xml | 17 ++ res/values/strings.xml | 29 +++ res/xml/wifi_calling_settings.xml | 34 ++++ res/xml/wireless_settings.xml | 5 + src/com/android/settings/Settings.java | 1 + src/com/android/settings/SettingsActivity.java | 4 +- src/com/android/settings/WifiCallingSettings.java | 220 +++++++++++++++++++++ src/com/android/settings/WirelessSettings.java | 17 ++ src/com/android/settings/search/Ranking.java | 2 + .../settings/search/SearchIndexableResources.java | 8 + 10 files changed, 336 insertions(+), 1 deletion(-) create mode 100644 res/xml/wifi_calling_settings.xml create mode 100644 src/com/android/settings/WifiCallingSettings.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index ad84ff9b6..e49c6a288 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -2058,6 +2058,23 @@ + + + + + + + + + + + + Configured networks + + Wi-Fi calling + + Wi-Fi calling mode + + Wi-Fi calling mode + + Wi-Fi preferred + Cellular preferred + Wi-Fi only + + + "2" + "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) + + WFC handoff while roaming + + Allow Wi-Fi voice calls handoff to cell network when roaming + diff --git a/res/xml/wifi_calling_settings.xml b/res/xml/wifi_calling_settings.xml new file mode 100644 index 000000000..37a2d285b --- /dev/null +++ b/res/xml/wifi_calling_settings.xml @@ -0,0 +1,34 @@ + + + + + + + + + + diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml index a5f722b87..fc3ca1678 100644 --- a/res/xml/wireless_settings.xml +++ b/res/xml/wireless_settings.xml @@ -63,6 +63,11 @@ android:targetClass="com.android.phone.MobileNetworkSettings" /> + + Date: Fri, 6 Feb 2015 05:38:06 -0800 Subject: Update Multi-SIM setting to use getSubIdForPhoneAccount API. Settings app should not be parsing the subId direction from the phone account. Instead this CL updates the settings app to use a new API to grab the sub ID. Change-Id: Iefd1831b04c061168fa2b135a2d296a27e3d4e92 --- src/com/android/settings/sim/SimDialogActivity.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/sim/SimDialogActivity.java b/src/com/android/settings/sim/SimDialogActivity.java index 3170daed6..456666212 100644 --- a/src/com/android/settings/sim/SimDialogActivity.java +++ b/src/com/android/settings/sim/SimDialogActivity.java @@ -29,6 +29,7 @@ import android.telecom.PhoneAccountHandle; import android.telecom.TelecomManager; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; +import android.telephony.TelephonyManager; import android.text.TextUtils; import android.util.Log; import android.view.KeyEvent; @@ -210,6 +211,7 @@ public class SimDialogActivity extends Activity { ArrayList callsSubInfoList = new ArrayList(); if (id == CALLS_PICK) { final TelecomManager telecomManager = TelecomManager.from(context); + final TelephonyManager telephonyManager = TelephonyManager.from(context); final Iterator phoneAccounts = telecomManager.getCallCapablePhoneAccounts().listIterator(); @@ -219,13 +221,9 @@ public class SimDialogActivity extends Activity { final PhoneAccount phoneAccount = telecomManager.getPhoneAccount(phoneAccounts.next()); list.add((String)phoneAccount.getLabel()); - // Added check to add entry into callsSubInforList only if phoneAccountId is int - // Todo : Might have to change it later based on b/18904714 - if (phoneAccount.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION) && - TextUtils.isDigitsOnly(phoneAccount.getAccountHandle().getId())) { - final String phoneAccountId = phoneAccount.getAccountHandle().getId(); - final SubscriptionInfo sir = Utils.findRecordBySubId(context, - Integer.parseInt(phoneAccountId)); + int subId = telephonyManager.getSubIdForPhoneAccount(phoneAccount); + if (subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) { + final SubscriptionInfo sir = Utils.findRecordBySubId(context, subId); callsSubInfoList.add(sir); } else { callsSubInfoList.add(null); -- cgit v1.2.3 From 71099329cc0443ce4517480c86f81ed6b4e33ff2 Mon Sep 17 00:00:00 2001 From: Pavel Zhamaitsiak Date: Mon, 2 Mar 2015 15:01:03 -0800 Subject: Wi-Fi calling settings cleanup Bug: 19573771 Change-Id: Idcbbdc962238f0a32fd7adf4d6b8409d6e6ffd37 --- res/values/strings.xml | 3 ++- res/xml/wireless_settings.xml | 1 + src/com/android/settings/WifiCallingSettings.java | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 190cb80bf..8e29e5ddc 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1884,7 +1884,7 @@ Label on Wifi Configuration screen--> Configured networks - + Wi-Fi calling Wi-Fi calling mode @@ -5637,6 +5637,7 @@ wifi wi-fi network connection text message texting messages messaging cellular cell carrier wireless data 4g 3g 2g lte + wifi wi-fi call calling roaming handoff launcher screen touchscreen dim screen touchscreen battery diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml index fc3ca1678..7a4ed9a52 100644 --- a/res/xml/wireless_settings.xml +++ b/res/xml/wireless_settings.xml @@ -66,6 +66,7 @@ Date: Mon, 9 Mar 2015 16:58:39 -0700 Subject: Update Wi-Fi Calling mode when WFC is enabled/disabled Bug: 19644042 Change-Id: Ie9cfe8c7f416985e4f78d48159d83191a19ac599 --- src/com/android/settings/WifiCallingSettings.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/WifiCallingSettings.java b/src/com/android/settings/WifiCallingSettings.java index 2e8fb7479..23fc2ea87 100644 --- a/src/com/android/settings/WifiCallingSettings.java +++ b/src/com/android/settings/WifiCallingSettings.java @@ -137,7 +137,7 @@ public class WifiCallingSettings extends SettingsPreferenceFragment int wfcMode = ImsManager.getWfcMode(context); mButtonWfcMode.setValue(Integer.toString(wfcMode)); - mButtonWfcMode.setSummary(getWfcModeSummary(context, ImsManager.getWfcMode(context))); + mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode)); mButtonWfcRoam.setChecked(wfcEnabled && (wfcMode != ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY) @@ -165,9 +165,10 @@ public class WifiCallingSettings extends SettingsPreferenceFragment ImsManager.setWfcSetting(context, isChecked); + int wfcMode = ImsManager.getWfcMode(context); + mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode)); mButtonWfcMode.setEnabled(isChecked); - boolean wfcHandoffEnabled = (ImsManager.getWfcMode(context) - != ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY); + boolean wfcHandoffEnabled = (wfcMode != ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY); mButtonWfcRoam.setEnabled(isChecked && wfcHandoffEnabled); mButtonWfcRoam.setChecked(isChecked && wfcHandoffEnabled && ImsManager.isWfcRoamingEnabledByUser(context)); -- cgit v1.2.3 From 897b492d69a3a19d3ca888b84405af1172a1459d Mon Sep 17 00:00:00 2001 From: Pavel Zhamaitsiak Date: Fri, 6 Mar 2015 16:02:53 -0800 Subject: Show alerts in case of some IMS registration errors. Change-Id: I7019c6f0bae66190d190babd83ebcdd780e5b8a0 --- src/com/android/settings/WifiCallingSettings.java | 55 +++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/src/com/android/settings/WifiCallingSettings.java b/src/com/android/settings/WifiCallingSettings.java index 2e8fb7479..f3daf4154 100644 --- a/src/com/android/settings/WifiCallingSettings.java +++ b/src/com/android/settings/WifiCallingSettings.java @@ -16,7 +16,12 @@ package com.android.settings; +import android.app.Activity; +import android.app.AlertDialog; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; @@ -28,6 +33,7 @@ import android.widget.Switch; import com.android.ims.ImsConfig; import com.android.ims.ImsManager; +import com.android.internal.telephony.imsphone.ImsPhone; import com.android.settings.widget.SwitchBar; /** @@ -104,6 +110,41 @@ public class WifiCallingSettings extends SettingsPreferenceFragment mSwitchBar.hide(); } + private void showAlert(Intent intent) { + Context context = getActivity(); + + CharSequence title = intent.getCharSequenceExtra(ImsPhone.EXTRA_KEY_ALERT_TITLE); + CharSequence message = intent.getCharSequenceExtra(ImsPhone.EXTRA_KEY_ALERT_MESSAGE); + + AlertDialog.Builder builder = new AlertDialog.Builder(context); + builder.setMessage(message) + .setTitle(title) + .setIcon(android.R.drawable.stat_sys_warning) + .setPositiveButton(android.R.string.ok, null); + AlertDialog dialog = builder.create(); + dialog.show(); + } + + private IntentFilter mIntentFilter; + + private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + String action = intent.getAction(); + if (action.equals(ImsPhone.REGISTRATION_ERROR)) { + // If this fragment is active then we are immediately + // showing alert on screen. There is no need to add + // notification in this case. + // + // In order to communicate to ImsPhone that it should + // not show notification, we are changing result code here. + setResultCode(Activity.RESULT_CANCELED); + + showAlert(intent); + } + } + }; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -115,6 +156,9 @@ public class WifiCallingSettings extends SettingsPreferenceFragment mButtonWfcRoam = (SwitchPreference) findPreference(BUTTON_WFC_ROAM); mButtonWfcRoam.setOnPreferenceChangeListener(this); + + mIntentFilter = new IntentFilter(); + mIntentFilter.addAction(ImsPhone.REGISTRATION_ERROR); } @Override @@ -142,18 +186,29 @@ public class WifiCallingSettings extends SettingsPreferenceFragment mButtonWfcRoam.setChecked(wfcEnabled && (wfcMode != ImsConfig.WfcModeFeatureValueConstants.WIFI_ONLY) && ImsManager.isWfcRoamingEnabledByUser(context)); + + context.registerReceiver(mIntentReceiver, mIntentFilter); + + Intent intent = getActivity().getIntent(); + if (intent.getBooleanExtra(ImsPhone.EXTRA_KEY_ALERT_SHOW, false)) { + showAlert(intent); + } } @Override public void onPause() { super.onPause(); + final Context context = getActivity(); + if (ImsManager.isWfcEnabledByPlatform(getActivity())) { TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_NONE); mSwitchBar.removeOnSwitchChangeListener(this); } + + context.unregisterReceiver(mIntentReceiver); } /** -- cgit v1.2.3