Check that hipri has started.
I needed to test the result of startUsingNetworkFeature, otherwise on mobile networks that are slow to come up, we won't detect warm SIMs after booting. Bug: 9962943 Change-Id: Ib638a4e43867ecaa85d6abff65643b77a63526b6
This commit is contained in:
@@ -3732,11 +3732,26 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
// hipri connection so the default connection stays active.
|
||||
log("isMobileOk: start hipri url=" + params.mUrl);
|
||||
mCs.setEnableFailFastMobileData(DctConstants.ENABLED);
|
||||
mCs.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
|
||||
Phone.FEATURE_ENABLE_HIPRI, new Binder());
|
||||
|
||||
// Continue trying to connect until time has run out
|
||||
long endTime = SystemClock.elapsedRealtime() + params.mTimeOutMs;
|
||||
|
||||
// First wait until we can start using hipri
|
||||
Binder binder = new Binder();
|
||||
while(SystemClock.elapsedRealtime() < endTime) {
|
||||
int ret = mCs.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
|
||||
Phone.FEATURE_ENABLE_HIPRI, binder);
|
||||
if ((ret == PhoneConstants.APN_ALREADY_ACTIVE)
|
||||
|| (ret == PhoneConstants.APN_REQUEST_STARTED)) {
|
||||
log("isMobileOk: hipri started");
|
||||
break;
|
||||
}
|
||||
if (VDBG) log("isMobileOk: hipri not started yet");
|
||||
result = ConnectivityManager.CMP_RESULT_CODE_NO_CONNECTION;
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
// Continue trying to connect until time has run out
|
||||
while(SystemClock.elapsedRealtime() < endTime) {
|
||||
try {
|
||||
// Wait for hipri to connect.
|
||||
@@ -3745,8 +3760,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
NetworkInfo.State state = mCs
|
||||
.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_HIPRI).getState();
|
||||
if (state != NetworkInfo.State.CONNECTED) {
|
||||
log("isMobileOk: not connected ni=" +
|
||||
if (VDBG) {
|
||||
log("isMobileOk: not connected ni=" +
|
||||
mCs.getNetworkInfo(ConnectivityManager.TYPE_MOBILE_HIPRI));
|
||||
}
|
||||
sleep(1);
|
||||
result = ConnectivityManager.CMP_RESULT_CODE_NO_CONNECTION;
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user