public static void event(Call call, String event, Object data) { if (call == null) { Log.i(TAG, "Non-call EVENT: %s, %s", event, data); return; } synchronized (mCallEventRecords) { if (!mCallEventRecordMap.containsKey(call)) { // First remove the oldest entry if no new ones exist. if (mCallEventRecords.remainingCapacity() == 0) { CallEventRecord record = mCallEventRecords.poll(); if (record != null) { mCallEventRecordMap.remove(record.getCall()); } } // Now add a new entry CallEventRecord newRecord = new CallEventRecord(call); mCallEventRecords.add(newRecord); mCallEventRecordMap.put(call, newRecord); } CallEventRecord record = mCallEventRecordMap.get(call); record.addEvent(event, data); } }
public void addEvent(String event, Object data) { mEvents.add(new CallEvent(event, System.currentTimeMillis(), data)); Log.i("Event", "Call %d: %s, %s", mId, event, data); }