diff options
author | Erik Kline <ek@google.com> | 2015-07-09 18:24:03 +0900 |
---|---|---|
committer | Erik Kline <ek@google.com> | 2015-07-14 11:46:51 +0900 |
commit | 7523eb349e7ecb1fdfd8e8a9371306ab28c046ec (patch) | |
tree | b8b12fdcc0b2d775670f00e691025d457d97473d /services/core/java | |
parent | 96d00ab359d60197321f06b4feb3d01f3fa03a29 (diff) | |
download | frameworks_base-7523eb349e7ecb1fdfd8e8a9371306ab28c046ec.zip frameworks_base-7523eb349e7ecb1fdfd8e8a9371306ab28c046ec.tar.gz frameworks_base-7523eb349e7ecb1fdfd8e8a9371306ab28c046ec.tar.bz2 |
Log NetworkRequestInfo to get more detailed history
Bug: 21641983
Bug: 22235775
Bug: 22299819
Bug: 22358164
Change-Id: I48a2d162dd499a3590f06d805267a63822856969
Diffstat (limited to 'services/core/java')
-rw-r--r-- | services/core/java/com/android/server/ConnectivityService.java | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java index 39c2891..9b1e26a 100644 --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -407,6 +407,10 @@ public class ConnectivityService extends IConnectivityManager.Stub // sequence number of NetworkRequests private int mNextNetworkRequestId = 1; + // NetworkRequest activity String log entries. + private static final int MAX_NETWORK_REQUEST_LOGS = 20; + private final LocalLog mNetworkRequestInfoLogs = new LocalLog(MAX_NETWORK_REQUEST_LOGS); + // Array of <Network,ReadOnlyLocalLogs> tracking network validation and results private static final int MAX_VALIDATION_LOGS = 10; private final ArrayDeque<Pair<Network,ReadOnlyLocalLog>> mValidationLogs = @@ -609,8 +613,10 @@ public class ConnectivityService extends IConnectivityManager.Stub if (DBG) log("ConnectivityService starting up"); mDefaultRequest = createInternetRequestForTransport(-1); - mNetworkRequests.put(mDefaultRequest, new NetworkRequestInfo( - null, mDefaultRequest, new Binder(), NetworkRequestInfo.REQUEST)); + NetworkRequestInfo defaultNRI = new NetworkRequestInfo(null, mDefaultRequest, + new Binder(), NetworkRequestInfo.REQUEST); + mNetworkRequests.put(mDefaultRequest, defaultNRI); + mNetworkRequestInfoLogs.log("REGISTER " + defaultNRI); mDefaultMobileDataRequest = createInternetRequestForTransport( NetworkCapabilities.TRANSPORT_CELLULAR); @@ -1858,6 +1864,12 @@ public class ConnectivityService extends IConnectivityManager.Stub pw.decreaseIndent(); } } + + pw.println(); + pw.println("mNetworkRequestInfoLogs (most recent first):"); + pw.increaseIndent(); + mNetworkRequestInfoLogs.reverseDump(fd, pw, args); + pw.decreaseIndent(); } } @@ -2207,6 +2219,7 @@ public class ConnectivityService extends IConnectivityManager.Stub private void handleRegisterNetworkRequest(NetworkRequestInfo nri) { mNetworkRequests.put(nri.request, nri); + mNetworkRequestInfoLogs.log("REGISTER " + nri); rematchAllNetworksAndRequests(null, 0); if (nri.isRequest && mNetworkForRequestId.get(nri.request.requestId) == null) { sendUpdatedScoreToFactories(nri.request, 0); @@ -2256,6 +2269,7 @@ public class ConnectivityService extends IConnectivityManager.Stub if (DBG) log("releasing NetworkRequest " + request); nri.unlinkDeathRecipient(); mNetworkRequests.remove(request); + mNetworkRequestInfoLogs.log("RELEASE " + nri); if (nri.isRequest) { // Find all networks that are satisfying this request and remove the request // from their request lists. @@ -3528,8 +3542,9 @@ public class ConnectivityService extends IConnectivityManager.Stub } public String toString() { - return (isRequest ? "Request" : "Listen") + " from uid/pid:" + mUid + "/" + - mPid + " for " + request + + return (isRequest ? "Request" : "Listen") + + " from uid/pid:" + mUid + "/" + mPid + + " for " + request + (mPendingIntent == null ? "" : " to trigger " + mPendingIntent); } } @@ -3559,9 +3574,9 @@ public class ConnectivityService extends IConnectivityManager.Stub NetworkRequest networkRequest = new NetworkRequest(networkCapabilities, legacyType, nextNetworkRequestId()); - if (DBG) log("requestNetwork for " + networkRequest); NetworkRequestInfo nri = new NetworkRequestInfo(messenger, networkRequest, binder, NetworkRequestInfo.REQUEST); + if (DBG) log("requestNetwork for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_REQUEST, nri)); if (timeoutMs > 0) { @@ -3624,9 +3639,9 @@ public class ConnectivityService extends IConnectivityManager.Stub NetworkRequest networkRequest = new NetworkRequest(networkCapabilities, TYPE_NONE, nextNetworkRequestId()); - if (DBG) log("pendingRequest for " + networkRequest + " to trigger " + operation); NetworkRequestInfo nri = new NetworkRequestInfo(networkRequest, operation, NetworkRequestInfo.REQUEST); + if (DBG) log("pendingRequest for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_REQUEST_WITH_INTENT, nri)); return networkRequest; @@ -3674,11 +3689,11 @@ public class ConnectivityService extends IConnectivityManager.Stub enforceAccessPermission(); } - NetworkRequest networkRequest = new NetworkRequest(new NetworkCapabilities( - networkCapabilities), TYPE_NONE, nextNetworkRequestId()); - if (DBG) log("listenForNetwork for " + networkRequest); + NetworkRequest networkRequest = new NetworkRequest( + new NetworkCapabilities(networkCapabilities), TYPE_NONE, nextNetworkRequestId()); NetworkRequestInfo nri = new NetworkRequestInfo(messenger, networkRequest, binder, NetworkRequestInfo.LISTEN); + if (DBG) log("listenForNetwork for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri)); return networkRequest; @@ -3692,11 +3707,11 @@ public class ConnectivityService extends IConnectivityManager.Stub enforceAccessPermission(); } - NetworkRequest networkRequest = new NetworkRequest(new NetworkCapabilities( - networkCapabilities), TYPE_NONE, nextNetworkRequestId()); - if (DBG) log("pendingListenForNetwork for " + networkRequest + " to trigger " + operation); + NetworkRequest networkRequest = new NetworkRequest( + new NetworkCapabilities(networkCapabilities), TYPE_NONE, nextNetworkRequestId()); NetworkRequestInfo nri = new NetworkRequestInfo(networkRequest, operation, NetworkRequestInfo.LISTEN); + if (DBG) log("pendingListenForNetwork for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_LISTENER, nri)); } |