DO NOT MERGE [DPM] Minor code fixes in NetworkLoggingHandler

am: 896b9db8ed

Change-Id: I497a699c3137ef85c0ffd1c887bf8bd60600c182
This commit is contained in:
Michal Karpinski
2016-12-14 10:53:30 +00:00
committed by android-build-merger
2 changed files with 7 additions and 4 deletions

View File

@@ -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<NetworkEvent> retrieveNetworkLogs(ComponentName admin,

View File

@@ -61,8 +61,9 @@ final class NetworkLoggingHandler extends Handler {
@GuardedBy("this")
private ArrayList<NetworkEvent> 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<NetworkEvent> retrieveFullLogBatch(long batchToken) {
if (batchToken != currentFullBatchToken) {
if (batchToken != mCurrentFullBatchToken) {
return null;
}
return mFullBatch;