Simplify AbstractPreferences.

There's no need for a complicated re-implementation of copy
on write lists. Simple ArrayLists will suffice; all operations
are guarded by |lock| and we can return a copy of the list to
the Event processor thread to avoid concurrent modification of
the list while that thread is dispatching events.

Fixes various preference tests related to adding / removing
duplicate listeners.

A notable difference in behaviour here is that listeners are
now compared using their equals() method and not using reference
equality.

bug: 26023763
bug: 25996530

Change-Id: I57ee723cf926786e1f119ec1e7740c66162ab749
1 file changed