diff options
author | TK MUN <tk.mun@samsung.com> | 2011-02-23 18:57:38 +0900 |
---|---|---|
committer | Simon Wilson <simonwilson@google.com> | 2011-03-09 23:02:21 -0800 |
commit | 36469186b7459d13688a2ca1c2316dbf172794dd (patch) | |
tree | edf4cbbcf7c82fe14979f7d41aece71a9518249c | |
parent | f4393101f80f0ca1a10771613a18565323b69fa2 (diff) | |
download | packages_apps_Settings-36469186b7459d13688a2ca1c2316dbf172794dd.tar.gz packages_apps_Settings-36469186b7459d13688a2ca1c2316dbf172794dd.tar.bz2 packages_apps_Settings-36469186b7459d13688a2ca1c2316dbf172794dd.zip |
DO NOT MERGE WiMAX settings menu
1. Show the 4G menu.
2. Show the 4G MAC address
3. Execute 4G setting apk.
Change-Id: Id9d5551e5bfdb7d79279de42b36ec0ebccdf6099
Signed-off-by: TK MUN <tk.mun@samsung.com>
-rw-r--r-- | AndroidManifest.xml | 15 | ||||
-rwxr-xr-x | res/values/strings.xml | 4 | ||||
-rw-r--r-- | res/xml/device_info_status.xml | 5 | ||||
-rw-r--r-- | res/xml/wireless_settings.xml | 10 | ||||
-rw-r--r-- | src/com/android/settings/WirelessSettings.java | 17 | ||||
-rw-r--r-- | src/com/android/settings/deviceinfo/Status.java | 28 |
6 files changed, 76 insertions, 3 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 660a44ae4..4848c3dbb 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -24,6 +24,8 @@ <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> + <uses-permission android:name="android.permission.ACCESS_WIMAX_STATE" /> + <uses-permission android:name="android.permission.CHANGE_WIMAX_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> @@ -86,6 +88,19 @@ <!-- Top-level settings --> + <activity android:name=".wimax.WimaxSettings" android:label="@string/wimax_settings" + android:clearTaskOnLaunch="true" + > + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + <action android:name="android.settings.WIMAX_SETTINGS" /> + <action android:name="android.net.wimax.PICK_WIMAX_NETWORK" /> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.VOICE_LAUNCH" /> + <category android:name="com.android.settings.SHORTCUT" /> + </intent-filter> + </activity> + <activity android:name=".wifi.WifiSettings" android:label="@string/wifi_settings" android:configChanges="orientation|keyboardHidden" diff --git a/res/values/strings.xml b/res/values/strings.xml index 999cf76da..fe2a9b4ab 100755 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2649,4 +2649,8 @@ found in the list of installed applications.</string> <string name="sound_category_calls_title">Incoming calls</string> <string name="sound_category_notification_title">Notifications</string> <string name="sound_category_feedback_title">Feedback</string> + + <string name="wimax_settings">4G settings</string> + <string name="wimax_settings_summary">Set up & manage 4G network and modem</string> + <string name="status_wimax_mac_address">4G MAC address</string> </resources> diff --git a/res/xml/device_info_status.xml b/res/xml/device_info_status.xml index dee606d6f..0c0f4e282 100644 --- a/res/xml/device_info_status.xml +++ b/res/xml/device_info_status.xml @@ -90,6 +90,11 @@ android:title="@string/status_imei_sv" android:summary="@string/device_info_not_available" android:persistent="false" /> + <Preference android:key="wimax_mac_address" + style="?android:attr/preferenceInformationStyle" + android:title="@string/status_wimax_mac_address" + android:summary="@string/device_info_not_available" + android:persistent="false" /> <Preference android:key="wifi_mac_address" style="?android:attr/preferenceInformationStyle" android:title="@string/status_wifi_mac_address" diff --git a/res/xml/wireless_settings.xml b/res/xml/wireless_settings.xml index 620472d30..294744768 100644 --- a/res/xml/wireless_settings.xml +++ b/res/xml/wireless_settings.xml @@ -40,6 +40,16 @@ android:targetClass="com.android.settings.wifi.WifiSettings" /> </PreferenceScreen> + <PreferenceScreen + android:key="wimax_settings" + android:title="@string/wimax_settings" + android:summary="@string/wimax_settings_summary" > + <intent + android:action="android.intent.action.MAIN" + android:targetPackage="com.android.settings.wimax" + android:targetClass="com.android.settings.wimax.WimaxSettings" /> + </PreferenceScreen> + <CheckBoxPreference android:key="toggle_bluetooth" android:title="@string/bluetooth_quick_toggle_title" diff --git a/src/com/android/settings/WirelessSettings.java b/src/com/android/settings/WirelessSettings.java index 04faa0f7d..a48b587ff 100644 --- a/src/com/android/settings/WirelessSettings.java +++ b/src/com/android/settings/WirelessSettings.java @@ -42,6 +42,7 @@ public class WirelessSettings extends PreferenceActivity { private static final String KEY_TOGGLE_WIFI = "toggle_wifi"; private static final String KEY_TOGGLE_NFC = "toggle_nfc"; private static final String KEY_WIFI_SETTINGS = "wifi_settings"; + private static final String KEY_WIMAX_SETTINGS = "wimax_settings"; private static final String KEY_BT_SETTINGS = "bt_settings"; private static final String KEY_VPN_SETTINGS = "vpn_settings"; private static final String KEY_TETHER_SETTINGS = "tether_settings"; @@ -104,6 +105,22 @@ public class WirelessSettings extends PreferenceActivity { String toggleable = Settings.System.getString(getContentResolver(), Settings.System.AIRPLANE_MODE_TOGGLEABLE_RADIOS); + //enable/disable wimax depending on the value in config.xml + boolean isWimaxEnabled = this.getResources().getBoolean( + com.android.internal.R.bool.config_wimaxEnabled); + if (!isWimaxEnabled) { + PreferenceScreen root = getPreferenceScreen(); + Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); + if (ps != null) + root.removePreference(ps); + } else { + if (toggleable == null || !toggleable.contains(Settings.System.RADIO_WIMAX ) + && isWimaxEnabled) { + Preference ps = (Preference) findPreference(KEY_WIMAX_SETTINGS); + ps.setDependency(KEY_TOGGLE_AIRPLANE); + } + } + // Manually set dependencies for Wifi when not toggleable. if (toggleable == null || !toggleable.contains(Settings.System.RADIO_WIFI)) { wifi.setDependency(KEY_TOGGLE_AIRPLANE); diff --git a/src/com/android/settings/deviceinfo/Status.java b/src/com/android/settings/deviceinfo/Status.java index 99a8975e0..56ce4ba6c 100644 --- a/src/com/android/settings/deviceinfo/Status.java +++ b/src/com/android/settings/deviceinfo/Status.java @@ -22,6 +22,8 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.BatteryManager; @@ -32,6 +34,7 @@ import android.os.SystemClock; import android.os.SystemProperties; import android.preference.Preference; import android.preference.PreferenceActivity; +import android.preference.PreferenceScreen; import android.telephony.PhoneNumberUtils; import android.telephony.PhoneStateListener; import android.telephony.ServiceState; @@ -62,6 +65,7 @@ import java.lang.ref.WeakReference; */ public class Status extends PreferenceActivity { + private static final String KEY_WIMAX_MAC_ADDRESS = "wimax_mac_address"; private static final String KEY_WIFI_MAC_ADDRESS = "wifi_mac_address"; private static final String KEY_BT_ADDRESS = "bt_address"; private static final int EVENT_SIGNAL_STRENGTH_CHANGED = 200; @@ -233,7 +237,8 @@ public class Status extends PreferenceActivity { mPhoneStateReceiver = new PhoneStateIntentReceiver(this, mHandler); mPhoneStateReceiver.notifySignalStrength(EVENT_SIGNAL_STRENGTH_CHANGED); mPhoneStateReceiver.notifyServiceState(EVENT_SERVICE_STATE_CHANGED); - + + setWimaxStatus(); setWifiStatus(); setBtStatus(); } @@ -244,7 +249,7 @@ public class Status extends PreferenceActivity { mPhoneStateReceiver.registerIntent(); registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED)); - + updateSignalStrength(); updateServiceState(mPhone.getServiceState()); updateDataState(); @@ -372,7 +377,24 @@ public class Status extends PreferenceActivity { + r.getString(R.string.radioInfo_display_asu)); } } - + + private void setWimaxStatus() { + ConnectivityManager cm = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); + NetworkInfo ni = cm.getNetworkInfo(ConnectivityManager.TYPE_WIMAX); + + if (ni == null) { + PreferenceScreen root = getPreferenceScreen(); + Preference ps = (Preference) findPreference(KEY_WIMAX_MAC_ADDRESS); + if (ps != null) + root.removePreference(ps); + } else { + Preference wimaxMacAddressPref = findPreference(KEY_WIMAX_MAC_ADDRESS); + String macAddress = SystemProperties.get("net.wimax.mac.address", + getString(R.string.status_unavailable)); + wimaxMacAddressPref.setSummary(macAddress); + } + } + private void setWifiStatus() { WifiManager wifiManager = (WifiManager) getSystemService(WIFI_SERVICE); WifiInfo wifiInfo = wifiManager.getConnectionInfo(); |