shill: Manager: Limit log messages for service state changes

At the normal debug log level, only report service state in
Manager::UpdateService under 2 conditions:

  - An inactive service becomes active
  - An active service changes states (including to an inactive
    state).

Notably, this removes log messages when other attributes of the
service change (for example signal strength of WiFi services).
To do this, track the states of all watched (active) services, and
use this to decide whether to output at the normal INFO log level
or at a debugging level.

BUG=chromium:458224
TEST=New unit test.

Change-Id: Id2fb7075854c34d8f1d08095d573c5e5e66d39fb
Reviewed-on: https://chromium-review.googlesource.com/249420
Reviewed-by: Rebecca Silberstein <silberst@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/manager.h b/manager.h
index d366a0a..f73ee4e 100644
--- a/manager.h
+++ b/manager.h
@@ -520,7 +520,6 @@
   std::vector<std::string> UninitializedTechnologies(Error *error);
   RpcIdentifiers EnumerateDevices(Error *error);
   RpcIdentifiers EnumerateProfiles(Error *error);
-  // TODO(cmasone): This should be implemented by filtering |services_|.
   RpcIdentifiers EnumerateWatchedServices(Error *error);
   std::string GetActiveProfileRpcIdentifier(Error *error);
   std::string GetCheckPortalList(Error *error);
@@ -751,6 +750,9 @@
   // Stores the state of the highest ranked connected service.
   std::string connection_state_;
 
+  // Stores the most recent state of all watched services.
+  std::map<std::string, Service::ConnectState> watched_service_states_;
+
   // Device claimer is a remote application/service that claim/release devices
   // from/to shill. To reduce complexity, only allow one device claimer at a
   // time.