DO NOT MERGE: MDST is not ready until connected to DcTracker.
When the system becomes loaded the PhoneApp can be delayed significantly and a call to setEnableFailFastMobileData may not occur because the channel between the MobileDataStateTracker (MDST) and DcTracker (DCT) is not connected. Solution: Add a isReady to MDST and isMobileDataStateTrackerReady to ConnectivityService and call it from isMobileOk. Bug: 10351868 Change-Id: I92f9d58121b88186b636cd71c2fd2ef9a28f7cf6
This commit is contained in:
@ -375,6 +375,13 @@ public class MobileDataStateTracker implements NetworkStateTracker {
|
|||||||
return (setEnableApn(mApnType, false) != PhoneConstants.APN_REQUEST_FAILED);
|
return (setEnableApn(mApnType, false) != PhoneConstants.APN_REQUEST_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if this is ready to operate
|
||||||
|
*/
|
||||||
|
public boolean isReady() {
|
||||||
|
return mDataConnectionTrackerAc != null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void captivePortalCheckComplete() {
|
public void captivePortalCheckComplete() {
|
||||||
// not implemented
|
// not implemented
|
||||||
|
@ -3572,6 +3572,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
enabled));
|
enabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isMobileDataStateTrackerReady() {
|
||||||
|
MobileDataStateTracker mdst =
|
||||||
|
(MobileDataStateTracker) mNetTrackers[ConnectivityManager.TYPE_MOBILE];
|
||||||
|
return (mdst != null) && (mdst.isReady());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int checkMobileProvisioning(boolean sendNotification, int suggestedTimeOutMs,
|
public int checkMobileProvisioning(boolean sendNotification, int suggestedTimeOutMs,
|
||||||
final ResultReceiver resultReceiver) {
|
final ResultReceiver resultReceiver) {
|
||||||
@ -3739,14 +3745,26 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Enable fail fast as we'll do retries here and use a
|
|
||||||
// hipri connection so the default connection stays active.
|
|
||||||
log("isMobileOk: start hipri url=" + params.mUrl);
|
|
||||||
mCs.setEnableFailFastMobileData(DctConstants.ENABLED);
|
|
||||||
|
|
||||||
// Continue trying to connect until time has run out
|
// Continue trying to connect until time has run out
|
||||||
long endTime = SystemClock.elapsedRealtime() + params.mTimeOutMs;
|
long endTime = SystemClock.elapsedRealtime() + params.mTimeOutMs;
|
||||||
|
|
||||||
|
if (!mCs.isMobileDataStateTrackerReady()) {
|
||||||
|
// Wait for MobileDataStateTracker to be ready.
|
||||||
|
if (DBG) log("isMobileOk: mdst is not ready");
|
||||||
|
while(SystemClock.elapsedRealtime() < endTime) {
|
||||||
|
if (mCs.isMobileDataStateTrackerReady()) {
|
||||||
|
// Enable fail fast as we'll do retries here and use a
|
||||||
|
// hipri connection so the default connection stays active.
|
||||||
|
if (DBG) log("isMobileOk: mdst ready, enable fail fast of mobile data");
|
||||||
|
mCs.setEnableFailFastMobileData(DctConstants.ENABLED);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log("isMobileOk: start hipri url=" + params.mUrl);
|
||||||
|
|
||||||
// First wait until we can start using hipri
|
// First wait until we can start using hipri
|
||||||
Binder binder = new Binder();
|
Binder binder = new Binder();
|
||||||
while(SystemClock.elapsedRealtime() < endTime) {
|
while(SystemClock.elapsedRealtime() < endTime) {
|
||||||
|
Reference in New Issue
Block a user