From 896b9db8ed14bdfa88d5dce96405361e78dee80e Mon Sep 17 00:00:00 2001 From: Michal Karpinski Date: Mon, 14 Nov 2016 12:10:32 +0000 Subject: DO NOT MERGE [DPM] Minor code fixes in NetworkLoggingHandler Added a comment and renamed field to follow mConvention. Test: will be CTS tested once APIs unhidden Bug: 29748723 (cherry picked from commit aabe96db87838501d3abeb96c25a4b1c50b9c12c) Change-Id: I7ef118723d13ce1d313c3c56299c2dca2411eee6 --- .../android/server/devicepolicy/DevicePolicyManagerService.java | 2 ++ .../com/android/server/devicepolicy/NetworkLoggingHandler.java | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 86b697fd7fce..c21a86343a77 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -9490,6 +9490,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { * A maximum of 1200 events are returned, and the total marshalled size is in the order of * 100kB, so returning a List instead of ParceledListSlice is acceptable. * Ideally this would be done with ParceledList, however it only supports homogeneous types. + * + * @see NetworkLoggingHandler#MAX_EVENTS_PER_BATCH */ @Override public synchronized List retrieveNetworkLogs(ComponentName admin, diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLoggingHandler.java b/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLoggingHandler.java index 98e5570a2f6b..29cc43fbcb21 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLoggingHandler.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/NetworkLoggingHandler.java @@ -61,8 +61,9 @@ final class NetworkLoggingHandler extends Handler { @GuardedBy("this") private ArrayList mFullBatch; + // each full batch is represented by its token, which the DPC has to provide back to revieve it @GuardedBy("this") - private long currentFullBatchToken; + private long mCurrentFullBatchToken; NetworkLoggingHandler(Looper looper, DevicePolicyManagerService dpm) { super(looper); @@ -101,9 +102,9 @@ final class NetworkLoggingHandler extends Handler { scheduleBatchFinalization(BATCH_FINALIZATION_TIMEOUT_MS); // notify DO that there's a new non-empty batch waiting if (mFullBatch.size() > 0) { - currentFullBatchToken++; + mCurrentFullBatchToken++; Bundle extras = new Bundle(); - extras.putLong(DeviceAdminReceiver.EXTRA_NETWORK_LOGS_TOKEN, currentFullBatchToken); + extras.putLong(DeviceAdminReceiver.EXTRA_NETWORK_LOGS_TOKEN, mCurrentFullBatchToken); extras.putInt(DeviceAdminReceiver.EXTRA_NETWORK_LOGS_COUNT, mFullBatch.size()); mDpm.sendDeviceOwnerCommand(DeviceAdminReceiver.ACTION_NETWORK_LOGS_AVAILABLE, extras); } else { @@ -112,7 +113,7 @@ final class NetworkLoggingHandler extends Handler { } synchronized List retrieveFullLogBatch(long batchToken) { - if (batchToken != currentFullBatchToken) { + if (batchToken != mCurrentFullBatchToken) { return null; } return mFullBatch; -- cgit v1.2.3-59-g8ed1b