am cffe6d73: Merge "Fix legacy APIs." into lmp-preview-dev
* commit 'cffe6d7315bc364d913e6a7daf1b62b7d173bfb7': Fix legacy APIs.
This commit is contained in:
@@ -1754,31 +1754,34 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
if (DBG) log("requestRouteToHostAddress on invalid network: " + networkType);
|
if (DBG) log("requestRouteToHostAddress on invalid network: " + networkType);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
NetworkStateTracker tracker = mNetTrackers[networkType];
|
|
||||||
DetailedState netState = DetailedState.DISCONNECTED;
|
NetworkAgentInfo nai = mLegacyTypeTracker.getNetworkForType(networkType);
|
||||||
if (tracker != null) {
|
if (nai == null) {
|
||||||
netState = tracker.getNetworkInfo().getDetailedState();
|
if (mLegacyTypeTracker.isTypeSupported(networkType) == false) {
|
||||||
|
if (DBG) log("requestRouteToHostAddress on unsupported network: " + networkType);
|
||||||
|
} else {
|
||||||
|
if (DBG) log("requestRouteToHostAddress on down network: " + networkType);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DetailedState netState = nai.networkInfo.getDetailedState();
|
||||||
|
|
||||||
if ((netState != DetailedState.CONNECTED &&
|
if ((netState != DetailedState.CONNECTED &&
|
||||||
netState != DetailedState.CAPTIVE_PORTAL_CHECK) ||
|
netState != DetailedState.CAPTIVE_PORTAL_CHECK)) {
|
||||||
tracker.isTeardownRequested()) {
|
|
||||||
if (VDBG) {
|
if (VDBG) {
|
||||||
log("requestRouteToHostAddress on down network "
|
log("requestRouteToHostAddress on down network "
|
||||||
+ "(" + networkType + ") - dropped"
|
+ "(" + networkType + ") - dropped"
|
||||||
+ " tracker=" + tracker
|
+ " netState=" + netState);
|
||||||
+ " netState=" + netState
|
|
||||||
+ " isTeardownRequested="
|
|
||||||
+ ((tracker != null) ? tracker.isTeardownRequested() : "tracker:null"));
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final int uid = Binder.getCallingUid();
|
final int uid = Binder.getCallingUid();
|
||||||
final long token = Binder.clearCallingIdentity();
|
final long token = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
LinkProperties lp = tracker.getLinkProperties();
|
LinkProperties lp = nai.linkProperties;
|
||||||
boolean ok = modifyRouteToAddress(lp, addr, ADD, TO_DEFAULT_TABLE, exempt,
|
boolean ok = modifyRouteToAddress(lp, addr, ADD, TO_DEFAULT_TABLE, exempt,
|
||||||
tracker.getNetwork().netId, uid);
|
nai.network.netId, uid);
|
||||||
if (DBG) log("requestRouteToHostAddress ok=" + ok);
|
if (DBG) log("requestRouteToHostAddress ok=" + ok);
|
||||||
return ok;
|
return ok;
|
||||||
} finally {
|
} finally {
|
||||||
@@ -3316,6 +3319,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
if (bestNetwork != null) {
|
if (bestNetwork != null) {
|
||||||
if (VDBG) log("using " + bestNetwork.name());
|
if (VDBG) log("using " + bestNetwork.name());
|
||||||
bestNetwork.addRequest(nri.request);
|
bestNetwork.addRequest(nri.request);
|
||||||
|
mNetworkForRequestId.put(nri.request.requestId, bestNetwork);
|
||||||
int legacyType = nri.request.legacyType;
|
int legacyType = nri.request.legacyType;
|
||||||
if (legacyType != TYPE_NONE) {
|
if (legacyType != TYPE_NONE) {
|
||||||
mLegacyTypeTracker.add(legacyType, bestNetwork);
|
mLegacyTypeTracker.add(legacyType, bestNetwork);
|
||||||
|
|||||||
Reference in New Issue
Block a user