diff options
| -rw-r--r-- | core/java/android/net/NetworkConfig.java | 10 | ||||
| -rwxr-xr-x | core/res/res/values/config.xml | 19 | ||||
| -rw-r--r-- | services/java/com/android/server/ConnectivityService.java | 19 |
3 files changed, 35 insertions, 13 deletions
diff --git a/core/java/android/net/NetworkConfig.java b/core/java/android/net/NetworkConfig.java index 6e774a6f8640..3cc0bc5eae61 100644 --- a/core/java/android/net/NetworkConfig.java +++ b/core/java/android/net/NetworkConfig.java @@ -50,6 +50,13 @@ public class NetworkConfig { public boolean dependencyMet; /** + * indicates the default restoral timer in seconds + * if the network is used as a special network feature + * -1 indicates no restoration of default + */ + public int restoreTime; + + /** * input string from config.xml resource. Uses the form: * [Connection name],[ConnectivityManager connection type], * [associated radio-type],[priority],[dependencyMet] @@ -60,7 +67,8 @@ public class NetworkConfig { type = Integer.parseInt(fragments[1]); radio = Integer.parseInt(fragments[2]); priority = Integer.parseInt(fragments[3]); - dependencyMet = Boolean.parseBoolean(fragments[4]); + restoreTime = Integer.parseInt(fragments[4]); + dependencyMet = Boolean.parseBoolean(fragments[5]); } /** diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 62c91768cecd..f116025bf999 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -148,17 +148,20 @@ attributes. This is used by the connectivity manager to decide which networks can coexist based on the hardware --> <!-- An Array of "[Connection name],[ConnectivityManager connection type], - [associated radio-type],[priority],[dependencyMet] --> - <!-- the 5th element indicates boot-time dependency-met value. --> + [associated radio-type],[priority],[restoral-timer(ms)],[dependencyMet] --> + <!-- the 5th element "resore-time" indicates the number of milliseconds to delay + before automatically restore the default connection. Set -1 if the connection + does not require auto-restore. --> + <!-- the 6th element indicates boot-time dependency-met value. --> <string-array translatable="false" name="networkAttributes"> <item>"wifi,1,1,1,true"</item> <item>"mobile,0,0,0,true"</item> - <item>"mobile_mms,2,0,2,true"</item> - <item>"mobile_supl,3,0,2,true"</item> - <item>"mobile_hipri,5,0,3,true"</item> - <item>"mobile_fota,10,0,2,true"</item> - <item>"mobile_ims,11,0,2,true"</item> - <item>"mobile_cbs,12,0,2,true"</item> + <item>"mobile_mms,2,0,2,60000,true"</item> + <item>"mobile_supl,3,0,2,60000,true"</item> + <item>"mobile_hipri,5,0,3,60000,true"</item> + <item>"mobile_fota,10,0,2,60000,true"</item> + <item>"mobile_ims,11,0,2,60000,true"</item> + <item>"mobile_cbs,12,0,2,60000,true"</item> </string-array> <!-- This string array should be overridden by the device to present a list of radio diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index d77ab60ca909..428c94f8bba5 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -719,9 +719,13 @@ public class ConnectivityService extends IConnectivityManager.Stub { mNetRequestersPids[usedNetworkType].add(currentPid); } } - mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_RESTORE_DEFAULT_NETWORK, - f), getRestoreDefaultNetworkDelay()); + int restoreTimer = getRestoreDefaultNetworkDelay(usedNetworkType); + + if (restoreTimer >= 0) { + mHandler.sendMessageDelayed( + mHandler.obtainMessage(EVENT_RESTORE_DEFAULT_NETWORK, f), restoreTimer); + } if ((ni.isConnectedOrConnecting() == true) && !network.isTeardownRequested()) { @@ -1658,7 +1662,7 @@ public class ConnectivityService extends IConnectivityManager.Stub { } } - private int getRestoreDefaultNetworkDelay() { + private int getRestoreDefaultNetworkDelay(int networkType) { String restoreDefaultNetworkDelayStr = SystemProperties.get( NETWORK_RESTORE_DELAY_PROP_NAME); if(restoreDefaultNetworkDelayStr != null && @@ -1668,7 +1672,14 @@ public class ConnectivityService extends IConnectivityManager.Stub { } catch (NumberFormatException e) { } } - return RESTORE_DEFAULT_NETWORK_DELAY; + // if the system property isn't set, use the value for the apn type + int ret = RESTORE_DEFAULT_NETWORK_DELAY; + + if ((networkType <= ConnectivityManager.MAX_NETWORK_TYPE) && + (mNetConfigs[networkType] != null)) { + ret = mNetConfigs[networkType].restoreTime; + } + return ret; } @Override |