1 package com.android.internal.logging.testing; 2 3 import android.metrics.LogMaker; 4 5 import com.android.internal.logging.MetricsLogger; 6 7 import java.util.LinkedList; 8 import java.util.Queue; 9 10 /** 11 * Fake logger that queues up logged events for inspection. 12 * 13 * @hide. 14 */ 15 @android.ravenwood.annotation.RavenwoodKeepWholeClass 16 public class FakeMetricsLogger extends MetricsLogger { 17 private Queue<LogMaker> logs = new LinkedList<>(); 18 19 @Override saveLog(LogMaker log)20 protected void saveLog(LogMaker log) { 21 logs.offer(log); 22 } 23 getLogs()24 public Queue<LogMaker> getLogs() { 25 return logs; 26 } 27 reset()28 public void reset() { 29 logs.clear(); 30 } 31 } 32