Fix a bug where the legacy extra info is reset on connect.

Bug: 149459996
Test: NetworkAgentTest FrameworksNetTests FrameworksWifiTests FrameworksTelephonyTests

Change-Id: I3e437f0fe2eb28f1d621551a8daf164a06af83fc
Merged-In: I3e437f0fe2eb28f1d621551a8daf164a06af83fc
(cherry picked from commit a3fdb94a32eda40e322b7dbdaf3fad9b42bfbbb9, originally aosp/1277602)
This commit is contained in:
Chalard Jean
2020-04-06 07:25:10 +00:00
parent 5123e0509e
commit 26fc3f31ff

View File

@@ -624,7 +624,9 @@ public abstract class NetworkAgent {
throw new UnsupportedOperationException(
"Legacy agents can't call markConnected.");
}
mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED, null, null);
// |reason| cannot be used by the non-legacy agents
mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.CONNECTED, null /* reason */,
mNetworkInfo.getExtraInfo());
queueOrSendMessage(EVENT_NETWORK_INFO_CHANGED, mNetworkInfo);
}
@@ -638,7 +640,9 @@ public abstract class NetworkAgent {
if (mIsLegacy) {
throw new UnsupportedOperationException("Legacy agents can't call unregister.");
}
mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED, null, null);
// When unregistering an agent nobody should use the extrainfo (or reason) any more.
mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED, null /* reason */,
null /* extraInfo */);
queueOrSendMessage(EVENT_NETWORK_INFO_CHANGED, mNetworkInfo);
}