Android->Eth:fix can not save static ip
This commit is contained in:
@ -76,6 +76,8 @@ import android.preference.ListPreference;
|
||||
|
||||
import com.android.settings.ethernet_static_ip_dialog;
|
||||
|
||||
import android.provider.Settings.System;
|
||||
|
||||
public class EthernetSettings extends SettingsPreferenceFragment
|
||||
implements DialogInterface.OnClickListener ,OnPreferenceChangeListener {
|
||||
private static final String TAG = "EthernetSettings";
|
||||
@ -275,6 +277,7 @@ public class EthernetSettings extends SettingsPreferenceFragment
|
||||
if(preference==mkeyEthMode) {
|
||||
String value=(String)newValue;
|
||||
if(value.equals("DHCP")){
|
||||
System.putInt(getContentResolver(), System.ETHERNET_USE_STATIC_IP, 0);
|
||||
mEthManager.setConfiguration(new IpConfiguration(IpAssignment.DHCP, ProxySettings.NONE,null,null));
|
||||
log("switch to dhcp");
|
||||
}else if(value.equals("StaticIP")){
|
||||
@ -499,6 +502,7 @@ public class EthernetSettings extends SettingsPreferenceFragment
|
||||
if(button==ethernet_static_ip_dialog.BUTTON_SUBMIT) {
|
||||
mDialog.saveIpSettingInfo(); //从Dialog获取静态数据
|
||||
if(setStaticIpConfiguration()) {
|
||||
System.putInt(getContentResolver(), System.ETHERNET_USE_STATIC_IP, 1);
|
||||
mEthManager.setConfiguration(mIpConfiguration);
|
||||
} else {
|
||||
Log.e(TAG, mIpConfiguration.toString());
|
||||
|
||||
Reference in New Issue
Block a user