Merge "Count and Report Bandwidth Requests by UID"
am: e1d140619f Change-Id: Iadfb7c04a49055c57cc8eed2ce9ad5f10e15cf52
This commit is contained in:
@@ -500,6 +500,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
|
||||
private final IpConnectivityLog mMetricsLog;
|
||||
|
||||
@GuardedBy("mBandwidthRequests")
|
||||
private final SparseArray<Integer> mBandwidthRequests = new SparseArray(10);
|
||||
|
||||
@VisibleForTesting
|
||||
final MultinetworkPolicyTracker mMultinetworkPolicyTracker;
|
||||
|
||||
@@ -2107,6 +2110,18 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
pw.println("currently holding WakeLock for: " + (duration / 1000) + "s");
|
||||
}
|
||||
mWakelockLogs.reverseDump(fd, pw, args);
|
||||
|
||||
pw.println();
|
||||
pw.println("bandwidth update requests (by uid):");
|
||||
pw.increaseIndent();
|
||||
synchronized (mBandwidthRequests) {
|
||||
for (int i = 0; i < mBandwidthRequests.size(); i++) {
|
||||
pw.println("[" + mBandwidthRequests.keyAt(i)
|
||||
+ "]: " + mBandwidthRequests.valueAt(i));
|
||||
}
|
||||
}
|
||||
pw.decreaseIndent();
|
||||
|
||||
pw.decreaseIndent();
|
||||
}
|
||||
}
|
||||
@@ -4267,6 +4282,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
}
|
||||
if (nai != null) {
|
||||
nai.asyncChannel.sendMessage(android.net.NetworkAgent.CMD_REQUEST_BANDWIDTH_UPDATE);
|
||||
synchronized (mBandwidthRequests) {
|
||||
final int uid = Binder.getCallingUid();
|
||||
Integer uidReqs = mBandwidthRequests.get(uid);
|
||||
if (uidReqs == null) {
|
||||
uidReqs = new Integer(0);
|
||||
}
|
||||
mBandwidthRequests.put(uid, ++uidReqs);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user