From a4314a5d8b5959bc81ce9fc28fb902ed9ecf6cef Mon Sep 17 00:00:00 2001 From: Pavel Zhamaitsiak Date: Wed, 15 Apr 2015 16:12:55 -0700 Subject: [PATCH 1/3] Fix missing text message when WiFi Calling is Off. Bug: 20124534 Change-Id: I5221c942e7dc43e9fd5c824bb53f69c3da4b229d --- src/com/android/settings/WifiCallingSettings.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/WifiCallingSettings.java b/src/com/android/settings/WifiCallingSettings.java index 5167ab0a1ab..740dc9f5389 100644 --- a/src/com/android/settings/WifiCallingSettings.java +++ b/src/com/android/settings/WifiCallingSettings.java @@ -172,10 +172,9 @@ public class WifiCallingSettings extends SettingsPreferenceFragment boolean wfcEnabled = ImsManager.isWfcEnabledByUser(context) && ImsManager.isNonTtyOrTtyOnVolteEnabled(context); mSwitch.setChecked(wfcEnabled); - int wfcMode = ImsManager.getWfcMode(context); mButtonWfcMode.setValue(Integer.toString(wfcMode)); - mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode)); + updateButtonWfcMode(context, wfcEnabled, wfcMode); context.registerReceiver(mIntentReceiver, mIntentFilter); @@ -211,11 +210,15 @@ public class WifiCallingSettings extends SettingsPreferenceFragment ImsManager.setWfcSetting(context, isChecked); int wfcMode = ImsManager.getWfcMode(context); + updateButtonWfcMode(context, isChecked, wfcMode); + } + + private void updateButtonWfcMode(Context context, boolean wfcEnabled, int wfcMode) { mButtonWfcMode.setSummary(getWfcModeSummary(context, wfcMode)); - mButtonWfcMode.setEnabled(isChecked); + mButtonWfcMode.setEnabled(wfcEnabled); final PreferenceScreen preferenceScreen = getPreferenceScreen(); - if (isChecked) { + if (wfcEnabled) { preferenceScreen.addPreference(mButtonWfcMode); } else { preferenceScreen.removePreference(mButtonWfcMode); From e11aa6f445111ae65d7afbfc5be3c684bfa9b2ab Mon Sep 17 00:00:00 2001 From: xinhe Date: Fri, 17 Apr 2015 11:32:42 -0700 Subject: [PATCH 2/3] Change SoftAP Setup UI Bug:20140630 Change-Id: I7f5696a5b78c70a6bc8ac38c5b99dd408e06a668 --- res/layout/wifi_ap_dialog.xml | 45 ++++++------- res/values/arrays.xml | 11 ++++ .../android/settings/wifi/WifiApDialog.java | 66 ++++++++++++------- 3 files changed, 74 insertions(+), 48 deletions(-) diff --git a/res/layout/wifi_ap_dialog.xml b/res/layout/wifi_ap_dialog.xml index 7a038cb1b32..5452cd03a26 100644 --- a/res/layout/wifi_ap_dialog.xml +++ b/res/layout/wifi_ap_dialog.xml @@ -67,30 +67,6 @@ android:prompt="@string/wifi_security" android:entries="@array/wifi_ap_security" /> - - - - - - - - + + + + + + + + diff --git a/res/values/arrays.xml b/res/values/arrays.xml index c108a212b88..49a003724ec 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -324,6 +324,17 @@ AKA\' + + + + @string/wifi_ap_choose_2G + @string/wifi_ap_choose_5G + + + + @string/wifi_ap_choose_2G + + diff --git a/src/com/android/settings/wifi/WifiApDialog.java b/src/com/android/settings/wifi/WifiApDialog.java index 3c4d912d31c..d30457be51b 100644 --- a/src/com/android/settings/wifi/WifiApDialog.java +++ b/src/com/android/settings/wifi/WifiApDialog.java @@ -29,12 +29,11 @@ import android.text.InputType; import android.text.TextWatcher; import android.view.View; import android.widget.AdapterView; +import android.widget.ArrayAdapter; 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; @@ -58,12 +57,11 @@ 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; + private int mBandIndex = OPEN_INDEX; WifiConfiguration mWifiConfig; WifiManager mWifiManager; + private Context mContext; private static final String TAG = "WifiApDialog"; @@ -76,6 +74,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, mSecurityTypeIndex = getSecurityTypeIndex(wifiConfig); } mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); + mContext = context; } public static int getSecurityTypeIndex(WifiConfiguration wifiConfig) { @@ -97,15 +96,7 @@ 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; - } + config.apBand = mBandIndex; switch (mSecurityTypeIndex) { case OPEN_INDEX: @@ -126,9 +117,10 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, @Override protected void onCreate(Bundle savedInstanceState) { - + boolean mInit = true; mView = getLayoutInflater().inflate(R.layout.wifi_ap_dialog, null); Spinner mSecurity = ((Spinner) mView.findViewById(R.id.security)); + final Spinner mChannel = (Spinner) mView.findViewById(R.id.choose_channel); setView(mView); setInverseBackgroundForced(true); @@ -140,20 +132,20 @@ 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); - + ArrayAdapter channelAdapter; 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); + Log.i(TAG," NO country code, forbid 5GHz"); + channelAdapter = ArrayAdapter.createFromResource(mContext, + R.array.wifi_ap_band_config_2G_only, android.R.layout.simple_spinner_item); mWifiConfig.apBand = 0; } else { - mChannel5G.setVisibility(View.VISIBLE); + channelAdapter = ArrayAdapter.createFromResource(mContext, + R.array.wifi_ap_band_config_full, android.R.layout.simple_spinner_item); } + channelAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener); setButton(DialogInterface.BUTTON_NEGATIVE, @@ -162,9 +154,9 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, if (mWifiConfig != null) { mSsid.setText(mWifiConfig.SSID); if (mWifiConfig.apBand == 0) { - mChannel2G.setChecked(true); + mBandIndex = 0; } else { - mChannel5G.setChecked(true); + mBandIndex = 1; } mSecurity.setSelection(mSecurityTypeIndex); @@ -173,6 +165,32 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener, } } + mChannel.setAdapter(channelAdapter); + mChannel.setOnItemSelectedListener( + new AdapterView.OnItemSelectedListener() { + boolean mInit = true; + @Override + public void onItemSelected(AdapterView adapterView, View view, int position, + long id) { + if (!mInit) { + mBandIndex = position; + mWifiConfig.apBand = mBandIndex; + Log.i(TAG, "config on channelIndex : " + mBandIndex + " Band: " + + mWifiConfig.apBand); + } else { + mInit = false; + mChannel.setSelection(mBandIndex); + } + + } + + @Override + public void onNothingSelected(AdapterView adapterView) { + + } + } + ); + mSsid.addTextChangedListener(this); mPassword.addTextChangedListener(this); ((CheckBox) mView.findViewById(R.id.show_password)).setOnClickListener(this); From 377c7c9afa2b1b827ba10a67185c5c2248e3e7df Mon Sep 17 00:00:00 2001 From: Erik Kline Date: Mon, 20 Apr 2015 13:33:31 +0900 Subject: [PATCH 3/3] Use CONNECTIVITY_ACTION instead _IMMEDIATE With the demise of the connectivity change delay CONNECTIVITY_ACTION and CONNECTIVITY_ACTION_IMMEDIATE are issued back to back. CONNECTIVITY_ACTION_IMMEDIATE is being reaped. Bug: 20013379 Change-Id: I71d1752cf3b2ebc377127c5fb7bf0864da9a860a --- src/com/android/settings/deviceinfo/Status.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java index 2c929731366..dcac1cb7058 100644 --- a/src/com/android/settings/deviceinfo/Status.java +++ b/src/com/android/settings/deviceinfo/Status.java @@ -71,7 +71,7 @@ public class Status extends PreferenceActivity { // Broadcasts to listen to for connectivity changes. private static final String[] CONNECTIVITY_INTENTS = { BluetoothAdapter.ACTION_STATE_CHANGED, - ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE, + ConnectivityManager.CONNECTIVITY_ACTION, WifiManager.LINK_CONFIGURATION_CHANGED_ACTION, WifiManager.NETWORK_STATE_CHANGED_ACTION, };