Merge "Cleanup SystemReady in the network stack"
This commit is contained in:
@@ -302,12 +302,6 @@ public class NetworkStackService extends Service {
|
|||||||
mNm.notifyDnsResponse(returnCode);
|
mNm.notifyDnsResponse(returnCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void notifySystemReady() {
|
|
||||||
checkNetworkStackCallingPermission();
|
|
||||||
mNm.notifySystemReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyNetworkConnected(LinkProperties lp, NetworkCapabilities nc) {
|
public void notifyNetworkConnected(LinkProperties lp, NetworkCapabilities nc) {
|
||||||
checkNetworkStackCallingPermission();
|
checkNetworkStackCallingPermission();
|
||||||
|
|||||||
@@ -298,8 +298,6 @@ public class NetworkMonitor extends StateMachine {
|
|||||||
// Avoids surfacing "Sign in to network" notification.
|
// Avoids surfacing "Sign in to network" notification.
|
||||||
private boolean mDontDisplaySigninNotification = false;
|
private boolean mDontDisplaySigninNotification = false;
|
||||||
|
|
||||||
private volatile boolean mSystemReady = false;
|
|
||||||
|
|
||||||
private final State mDefaultState = new DefaultState();
|
private final State mDefaultState = new DefaultState();
|
||||||
private final State mValidatedState = new ValidatedState();
|
private final State mValidatedState = new ValidatedState();
|
||||||
private final State mMaybeNotifyState = new MaybeNotifyState();
|
private final State mMaybeNotifyState = new MaybeNotifyState();
|
||||||
@@ -433,15 +431,6 @@ public class NetworkMonitor extends StateMachine {
|
|||||||
sendMessage(CMD_PRIVATE_DNS_SETTINGS_CHANGED, newCfg);
|
sendMessage(CMD_PRIVATE_DNS_SETTINGS_CHANGED, newCfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send a notification to NetworkMonitor indicating that the system is ready.
|
|
||||||
*/
|
|
||||||
public void notifySystemReady() {
|
|
||||||
// No need to run on the handler thread: mSystemReady is volatile and read only once on the
|
|
||||||
// isCaptivePortal() thread.
|
|
||||||
mSystemReady = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a notification to NetworkMonitor indicating that the network is now connected.
|
* Send a notification to NetworkMonitor indicating that the network is now connected.
|
||||||
*/
|
*/
|
||||||
@@ -1592,10 +1581,6 @@ public class NetworkMonitor extends StateMachine {
|
|||||||
*/
|
*/
|
||||||
private void sendNetworkConditionsBroadcast(boolean responseReceived, boolean isCaptivePortal,
|
private void sendNetworkConditionsBroadcast(boolean responseReceived, boolean isCaptivePortal,
|
||||||
long requestTimestampMs, long responseTimestampMs) {
|
long requestTimestampMs, long responseTimestampMs) {
|
||||||
if (!mSystemReady) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Intent latencyBroadcast =
|
Intent latencyBroadcast =
|
||||||
new Intent(NetworkMonitorUtils.ACTION_NETWORK_CONDITIONS_MEASURED);
|
new Intent(NetworkMonitorUtils.ACTION_NETWORK_CONDITIONS_MEASURED);
|
||||||
if (mNetworkCapabilities.hasTransport(TRANSPORT_WIFI)) {
|
if (mNetworkCapabilities.hasTransport(TRANSPORT_WIFI)) {
|
||||||
|
|||||||
@@ -3738,16 +3738,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EVENT_SYSTEM_READY: {
|
case EVENT_SYSTEM_READY: {
|
||||||
for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) {
|
|
||||||
// Might have been called already in handleRegisterNetworkAgent since
|
|
||||||
// mSystemReady is set before sending EVENT_SYSTEM_READY, but calling
|
|
||||||
// this several times is fine.
|
|
||||||
try {
|
|
||||||
nai.networkMonitor().notifySystemReady();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
e.rethrowFromSystemServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mMultipathPolicyTracker.start();
|
mMultipathPolicyTracker.start();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -5423,15 +5413,6 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
synchronized (mNetworkForNetId) {
|
synchronized (mNetworkForNetId) {
|
||||||
mNetworkForNetId.put(nai.network.netId, nai);
|
mNetworkForNetId.put(nai.network.netId, nai);
|
||||||
}
|
}
|
||||||
synchronized (this) {
|
|
||||||
if (mSystemReady) {
|
|
||||||
try {
|
|
||||||
networkMonitor.notifySystemReady();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
e.rethrowFromSystemServer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
networkMonitor.start();
|
networkMonitor.start();
|
||||||
|
|||||||
@@ -1924,6 +1924,11 @@ public final class SystemServer {
|
|||||||
|
|
||||||
traceBeginAndSlog("StartNetworkStack");
|
traceBeginAndSlog("StartNetworkStack");
|
||||||
try {
|
try {
|
||||||
|
// Note : the network stack is creating on-demand objects that need to send
|
||||||
|
// broadcasts, which means it currently depends on being started after
|
||||||
|
// ActivityManagerService.mSystemReady and ActivityManagerService.mProcessesReady
|
||||||
|
// are set to true. Be careful if moving this to a different place in the
|
||||||
|
// startup sequence.
|
||||||
NetworkStackClient.getInstance().start(context);
|
NetworkStackClient.getInstance().start(context);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
reportWtf("starting Network Stack", e);
|
reportWtf("starting Network Stack", e);
|
||||||
|
|||||||
@@ -47,9 +47,8 @@ oneway interface INetworkMonitor {
|
|||||||
void forceReevaluation(int uid);
|
void forceReevaluation(int uid);
|
||||||
void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config);
|
void notifyPrivateDnsChanged(in PrivateDnsConfigParcel config);
|
||||||
void notifyDnsResponse(int returnCode);
|
void notifyDnsResponse(int returnCode);
|
||||||
void notifySystemReady();
|
|
||||||
void notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc);
|
void notifyNetworkConnected(in LinkProperties lp, in NetworkCapabilities nc);
|
||||||
void notifyNetworkDisconnected();
|
void notifyNetworkDisconnected();
|
||||||
void notifyLinkPropertiesChanged(in LinkProperties lp);
|
void notifyLinkPropertiesChanged(in LinkProperties lp);
|
||||||
void notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc);
|
void notifyNetworkCapabilitiesChanged(in NetworkCapabilities nc);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user