am df6da5c9: am aae781f3: Merge "Add auto-restore timeout for secondary networks." into honeycomb-LTE
* commit 'df6da5c96bc18cff1785fc30d639b2fe73110fe8': Add auto-restore timeout for secondary networks.
This commit is contained in:
@@ -49,6 +49,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],
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -709,9 +709,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()) {
|
||||
@@ -1662,7 +1666,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 &&
|
||||
@@ -1672,7 +1676,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
|
||||
|
||||
Reference in New Issue
Block a user