Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 896b9db8 authored by Michal Karpinski's avatar Michal Karpinski
Browse files

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 aabe96db)

Change-Id: I7ef118723d13ce1d313c3c56299c2dca2411eee6
parent bbf352a2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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,
+5 −4
Original line number Diff line number Diff line
@@ -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;