shill: cellular: Consolidate singletons passed through constructors

The following are singletons that were stored individually by many
classes, passed down constructors as the objects were created. Move
singletons to ModemInfo, and pass only a ModemInfo object down.
Singletons: ControlInterface, EventDispatcher, Metrics, Manager, GLib,
ActivatingIccidStore, CellularOperatorInfo, and mobile_provider_db.
Classes who stored all these singletons: ModemInfo, Cellular,
ModemManager (and flavours), Modem (and flavours), CellularCpability
(and flavours).

BUG=chromium:222543
TEST=(1) Build and run unit tests. (2) Test on device that LTE
activation and cellular functionality related to refactored singletons
still works. (3) Run autotest: network_3GSmokeTest.

Change-Id: I0c2866e0cd0bab63e3c3078ff73361322a8f509b
Reviewed-on: https://gerrit.chromium.org/gerrit/46485
Reviewed-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/modem_info.h b/modem_info.h
index 681df41..ae0191f 100644
--- a/modem_info.h
+++ b/modem_info.h
@@ -27,7 +27,7 @@
 // Manages modem managers.
 class ModemInfo {
  public:
-  ModemInfo(ControlInterface *control_interface,
+  ModemInfo(ControlInterface *control,
             EventDispatcher *dispatcher,
             Metrics *metrics,
             Manager *manager,
@@ -39,6 +39,44 @@
 
   virtual void OnDeviceInfoAvailable(const std::string &link_name);
 
+  ControlInterface *control_interface() const { return control_interface_; }
+  EventDispatcher *dispatcher() const { return dispatcher_; }
+  Metrics *metrics() const { return metrics_; }
+  Manager *manager() const { return manager_; }
+  GLib *glib() const { return glib_; }
+  ActivatingIccidStore *activating_iccid_store() const {
+    return activating_iccid_store_.get();
+  }
+  CellularOperatorInfo *cellular_operator_info() const {
+    return cellular_operator_info_.get();
+  }
+  mobile_provider_db *provider_db() const { return provider_db_; }
+
+ protected:
+  // Write accessors for unit-tests.
+  void set_control_interface(ControlInterface *control) {
+    control_interface_ = control;
+  }
+  void set_event_dispatcher(EventDispatcher *dispatcher) {
+    dispatcher_ = dispatcher;
+  }
+  void set_metrics(Metrics *metrics) {
+    metrics_ = metrics;
+  }
+  void set_manager(Manager *manager) {
+    manager_ = manager;
+  }
+  void set_glib(GLib *glib) {
+    glib_ = glib;
+  }
+  void set_activating_iccid_store(
+      ActivatingIccidStore *activating_iccid_store);
+  void set_cellular_operator_info(
+      CellularOperatorInfo *cellular_operator_info);
+  void set_mobile_provider_db(mobile_provider_db *provider_db) {
+    provider_db_ = provider_db;
+  }
+
  private:
   friend class ModemInfoTest;
   FRIEND_TEST(ModemInfoTest, RegisterModemManager);