diff options
author | Chong Zhang <chz@google.com> | 2013-08-29 15:33:12 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2013-08-29 17:32:14 -0700 |
commit | 4fee070366bd0f8cbea4308f4c765d62fa301400 (patch) | |
tree | e567677ced996b9b99011c84d75721abc2ac31db /src/com/android/settings | |
parent | 8df4caf168a793d7f17b31ba50e37479b0404022 (diff) | |
download | packages_apps_Settings-4fee070366bd0f8cbea4308f4c765d62fa301400.tar.gz packages_apps_Settings-4fee070366bd0f8cbea4308f4c765d62fa301400.tar.bz2 packages_apps_Settings-4fee070366bd0f8cbea4308f4c765d62fa301400.zip |
wifi-display: add drop down list for Wps config method
Bug: 9371882
Change-Id: I8c8c645bbb3db9f9d038f015f6aa6078ce3e56c3
Diffstat (limited to 'src/com/android/settings')
-rwxr-xr-x | src/com/android/settings/wfd/WifiDisplaySettings.java | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/src/com/android/settings/wfd/WifiDisplaySettings.java b/src/com/android/settings/wfd/WifiDisplaySettings.java index 7f560b3ef..6ec79f387 100755 --- a/src/com/android/settings/wfd/WifiDisplaySettings.java +++ b/src/com/android/settings/wfd/WifiDisplaySettings.java @@ -33,6 +33,7 @@ import android.net.Uri; import android.net.wifi.p2p.WifiP2pManager; import android.net.wifi.p2p.WifiP2pManager.ActionListener; import android.net.wifi.p2p.WifiP2pManager.Channel; +import android.net.wifi.WpsInfo; import android.os.Bundle; import android.os.Handler; import android.os.Looper; @@ -94,6 +95,7 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { private PreferenceGroup mCertCategory; private boolean mListen; private boolean mAutoGO; + private int mWpsConfig = WpsInfo.INVALID; private int mListenChannel; private int mOperatingChannel; @@ -160,6 +162,8 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { Settings.Global.WIFI_DISPLAY_ON), false, mSettingsObserver); getContentResolver().registerContentObserver(Settings.Global.getUriFor( Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON), false, mSettingsObserver); + getContentResolver().registerContentObserver(Settings.Global.getUriFor( + Settings.Global.WIFI_DISPLAY_WPS_CONFIG), false, mSettingsObserver); mDisplayManager.scanWifiDisplays(); @@ -222,6 +226,8 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { Settings.Global.WIFI_DISPLAY_ON, 0) != 0; mWifiDisplayCertificationOn = Settings.Global.getInt(getContentResolver(), Settings.Global.WIFI_DISPLAY_CERTIFICATION_ON, 0) != 0; + mWpsConfig = Settings.Global.getInt(getContentResolver(), + Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID); mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus(); applyState(); @@ -367,12 +373,41 @@ public final class WifiDisplaySettings extends SettingsPreferenceFragment { cbp.setChecked(mAutoGO); mCertCategory.addPreference(cbp); - // Drop down list for choosing listen channel + // Drop down list for choosing WPS method (PBC/KEYPAD/DISPLAY) ListPreference lp = new ListPreference(getActivity()) { @Override protected void onDialogClosed(boolean positiveResult) { super.onDialogClosed(positiveResult); if (positiveResult) { + mWpsConfig = Integer.parseInt(getValue()); + setSummary("%1$s"); + getActivity().invalidateOptionsMenu(); + Settings.Global.putInt(getActivity().getContentResolver(), + Settings.Global.WIFI_DISPLAY_WPS_CONFIG, mWpsConfig); + } + } + }; + mWpsConfig = Settings.Global.getInt(getActivity().getContentResolver(), + Settings.Global.WIFI_DISPLAY_WPS_CONFIG, WpsInfo.INVALID); + String[] wpsEntries = { "Default", "PBC", "KEYPAD", "DISPLAY" }; + String[] wpsValues = { + "" + WpsInfo.INVALID, + "" + WpsInfo.PBC, + "" + WpsInfo.KEYPAD, + "" + WpsInfo.DISPLAY }; + lp.setTitle(R.string.wifi_display_wps_config); + lp.setEntries(wpsEntries); + lp.setEntryValues(wpsValues); + lp.setValue("" + mWpsConfig); + lp.setSummary("%1$s"); + mCertCategory.addPreference(lp); + + // Drop down list for choosing listen channel + lp = new ListPreference(getActivity()) { + @Override + protected void onDialogClosed(boolean positiveResult) { + super.onDialogClosed(positiveResult); + if (positiveResult) { mListenChannel = Integer.parseInt(getValue()); setSummary("%1$s"); getActivity().invalidateOptionsMenu(); |