class UserConsentWatcher
Defined at line 32 of file ../../src/cobalt/bin/app/user_consent_watcher.h
Calls a callback with an updated CobaltServiceInterface::DataCollectionPolicy when the "user data
sharing consent" option changes. The callback will be called once when the Watcher connects to
the service (but not before), and each time the PrivacySettings change.
In case of failure, e.g., loss of connection, error returned, the data collection policy is set
to DO_NOT_UPLOAD regardless of its current state, and the connection to the service will be
severed. Following an exponential backoff, the connection will be re-established.
Wraps around fuchsia::settings::PrivacyPtr to handle establishing the connection, losing the
connection, waiting for the callback, etc.
Public Methods
void UserConsentWatcher (async_dispatcher_t * dispatcher, inspect::Node inspect_node, std::shared_ptr<sys::ServiceDirectory> services, std::function<void (const CobaltServiceInterface::DataCollectionPolicy &)> callback)
fuchsia.settings.Privacy is expected to be in |services|.
Defined at line 18 of file ../../src/cobalt/bin/app/user_consent_watcher.cc
void StartWatching ()
Connects to fuchsia.settings.Privacy and watches for "user data sharing consent" changes.
Defined at line 31 of file ../../src/cobalt/bin/app/user_consent_watcher.cc
bool IsConnected ()
Whether the watcher is currently connected to fuchsia.settings.Privacy.
Mostly for testing purposes.
Defined at line 46 of file ../../src/cobalt/bin/app/user_consent_watcher.h
const fuchsia::settings::PrivacySettings & privacy_settings ()
Mostly for testing purposes.
Defined at line 49 of file ../../src/cobalt/bin/app/user_consent_watcher.h