Watcher/Watchable classes for PackageManagerService

Bug: 161323622

The Watcher and Watchable classes provide Observer/Observable
functionality for PackageManagerService.  Watchers register with
Watchables to be notified when the Watchable changes.

WatchedArrayMap and WatchedSparseArray provide ArrayMap and
SparseArray functionality, respectively.  Each is a Watchable that
automatically watches any Watchables that are stored in it. It is
important that the arrays watch stored elements only if the array
itself is being watched.

WatchedSparseBooleanArray is a simple Watchable version of
SparseBooleanArray.

This CL adds the new classes and a test class but does not use them
otherwise.

Test: atest
 * FrameworksServicesTests:WatcherTest

Change-Id: I381595c075b74099c52e9e17a9a2c32f87db563d
7 files changed