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 aabe96db87)
Change-Id: I7ef118723d13ce1d313c3c56299c2dca2411eee6
This commit is contained in:
@@ -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
|
* 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.
|
* 100kB, so returning a List instead of ParceledListSlice is acceptable.
|
||||||
* Ideally this would be done with ParceledList, however it only supports homogeneous types.
|
* Ideally this would be done with ParceledList, however it only supports homogeneous types.
|
||||||
|
*
|
||||||
|
* @see NetworkLoggingHandler#MAX_EVENTS_PER_BATCH
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public synchronized List<NetworkEvent> retrieveNetworkLogs(ComponentName admin,
|
public synchronized List<NetworkEvent> retrieveNetworkLogs(ComponentName admin,
|
||||||
|
|||||||
@@ -61,8 +61,9 @@ final class NetworkLoggingHandler extends Handler {
|
|||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private ArrayList<NetworkEvent> mFullBatch;
|
private ArrayList<NetworkEvent> mFullBatch;
|
||||||
|
|
||||||
|
// each full batch is represented by its token, which the DPC has to provide back to revieve it
|
||||||
@GuardedBy("this")
|
@GuardedBy("this")
|
||||||
private long currentFullBatchToken;
|
private long mCurrentFullBatchToken;
|
||||||
|
|
||||||
NetworkLoggingHandler(Looper looper, DevicePolicyManagerService dpm) {
|
NetworkLoggingHandler(Looper looper, DevicePolicyManagerService dpm) {
|
||||||
super(looper);
|
super(looper);
|
||||||
@@ -101,9 +102,9 @@ final class NetworkLoggingHandler extends Handler {
|
|||||||
scheduleBatchFinalization(BATCH_FINALIZATION_TIMEOUT_MS);
|
scheduleBatchFinalization(BATCH_FINALIZATION_TIMEOUT_MS);
|
||||||
// notify DO that there's a new non-empty batch waiting
|
// notify DO that there's a new non-empty batch waiting
|
||||||
if (mFullBatch.size() > 0) {
|
if (mFullBatch.size() > 0) {
|
||||||
currentFullBatchToken++;
|
mCurrentFullBatchToken++;
|
||||||
Bundle extras = new Bundle();
|
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());
|
extras.putInt(DeviceAdminReceiver.EXTRA_NETWORK_LOGS_COUNT, mFullBatch.size());
|
||||||
mDpm.sendDeviceOwnerCommand(DeviceAdminReceiver.ACTION_NETWORK_LOGS_AVAILABLE, extras);
|
mDpm.sendDeviceOwnerCommand(DeviceAdminReceiver.ACTION_NETWORK_LOGS_AVAILABLE, extras);
|
||||||
} else {
|
} else {
|
||||||
@@ -112,7 +113,7 @@ final class NetworkLoggingHandler extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized List<NetworkEvent> retrieveFullLogBatch(long batchToken) {
|
synchronized List<NetworkEvent> retrieveFullLogBatch(long batchToken) {
|
||||||
if (batchToken != currentFullBatchToken) {
|
if (batchToken != mCurrentFullBatchToken) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return mFullBatch;
|
return mFullBatch;
|
||||||
|
|||||||
Reference in New Issue
Block a user