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

Commit 0fae15b8 authored by Wenhao Wang's avatar Wenhao Wang
Browse files

[IntrusionLogging] Refactor the onNewSingleData

The new version onNewSingleData sends event to tranport directly.

Bug: 416710031
Test: atest android.security.cts.IntrusionDetectionManagerTest
Ignore-AOSP-First: security feature
Flag: EXEMPT: bugfix in localized component
Change-Id: I301b84b29ab01fa97d7358382d7a9105db68621e
parent 21c5f04f
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -36,14 +36,11 @@ public class DataAggregator {
    private static final int MSG_BATCH_DATA = 1;
    private static final int MSG_DISABLE = 2;

    private static final int STORED_EVENTS_SIZE_LIMIT = 4;

    private final IntrusionDetectionService mIntrusionDetectionService;
    private final ArrayList<DataSource> mDataSources;
    private final AtomicBoolean mIsLoggingInitialized = new AtomicBoolean(false);

    private Context mContext;
    private List<IntrusionDetectionEvent> mStoredEvents = new ArrayList<>();
    private ServiceThread mHandlerThread;
    private Handler mHandler;

@@ -104,12 +101,9 @@ public class DataAggregator {
    }

    private void onNewSingleData(IntrusionDetectionEvent event) {
        if (mStoredEvents.size() < STORED_EVENTS_SIZE_LIMIT) {
            mStoredEvents.add(event);
        } else {
            mIntrusionDetectionService.addNewData(mStoredEvents);
            mStoredEvents = new ArrayList<>();
        }
        List<IntrusionDetectionEvent> events = new ArrayList<>();
        events.add(event);
        mIntrusionDetectionService.addNewData(events);
    }

    private void onNewBatchData(List<IntrusionDetectionEvent> events) {