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

Commit 0bd272f1 authored by Matthew Sedam's avatar Matthew Sedam
Browse files

Add clear() to ContextHubEventLogger

Test: unit tests
Bug: 217576459
Change-Id: If9aab16975807e8fa482f4be0f389bb81c1d52cd
parent 997a17f0
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ package com.android.server.location.contexthub;
import android.hardware.location.NanoAppMessage;
import android.util.Log;

import java.util.Collection;

/**
 * A class to log events and useful metrics within the Context Hub service.
 *
@@ -216,6 +218,18 @@ public class ContextHubEventLogger {
        return sInstance;
    }

    /**
     * Clears all queues of events.
     */
    public synchronized void clear() {
        for (Collection<?> deque:
                new Collection<?>[] {mNanoappLoadEventQueue, mNanoappUnloadEventQueue,
                                     mMessageFromNanoappQueue, mMessageToNanoappQueue,
                                     mContextHubRestartEventQueue}) {
            deque.clear();
        }
    }

    /**
     * Logs a nanoapp load event
     *