Avoid NDC deadlock when re-arming network alert.
When NDC delivers limitReached() event, NMS re-arms the alert, which makes another call back to NDC. If NDC already started processing another call, this causes deadlock. Fix this by re-arming on a handler thread. Bug: 5879848 Change-Id: I46fa78fe1f1122c5f31dd6020483e5ae89a9f39d
This commit is contained in:
@@ -121,6 +121,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
|
||||
private static final int MSG_PERFORM_POLL = 1;
|
||||
private static final int MSG_UPDATE_IFACES = 2;
|
||||
private static final int MSG_REGISTER_GLOBAL_ALERT = 3;
|
||||
|
||||
/** Flags to control detail level of poll event. */
|
||||
private static final int FLAG_PERSIST_NETWORK = 0x1;
|
||||
@@ -600,7 +601,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
mHandler.obtainMessage(MSG_PERFORM_POLL, flags, 0).sendToTarget();
|
||||
|
||||
// re-arm global alert for next update
|
||||
registerGlobalAlert();
|
||||
mHandler.obtainMessage(MSG_REGISTER_GLOBAL_ALERT).sendToTarget();
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -951,6 +952,10 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
updateIfaces();
|
||||
return true;
|
||||
}
|
||||
case MSG_REGISTER_GLOBAL_ALERT: {
|
||||
registerGlobalAlert();
|
||||
return true;
|
||||
}
|
||||
default: {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user