Better LocalLog

This patch fixes the following issues in LocalLog:
  - reverseDump() uses a descending iterator with linear complexity
    instead of a quadratic loop using get(index) on a linked list.
  - reverseDump() is added to ReadOnlyLocalLog.
  - synchronized section in log() is restricted to mutation of internal
    list.
  - formatting of the log message does not create an internal
    StringBuilder.
  - the instance variable mNow is removed: it was only used inside log()
    as a local variable.
  - remaining instance variables are qualified with final.
  - the linked list is replaced by a fixed capacity array-backed queue.

Test: added unit tests
Change-Id: I1a54f0ad26dd35448d3297ea24df1fd626d20ef3
2 files changed