Cros MultiDevice] Re-enroll device if SoftwareFeature supported state changes.
Create a class, DeviceReenroller, that compares GcmDeviceInfo's list of
supported SoftwareFeatures--eg., BETTER_TOGETHER_CLIENT or
MAGIC_TETHER_CLIENT--with those stored in the local device metadata on the
CryptAuth server. If a SoftwareFeature state has changed from supported to
unsupported, or vice versa, then re-enroll the device with CryptAuth. Finally,
after a successful re-enrollment, re-sync with CryptAuth and verify that the
local device metadata was updated correctly.
The flow is as follows:
1) The supported states of CrOS-relevant SoftwareFeatures are set in
//src/chrome/browser/chromeos/cryptauth/gcm_device_info_provider_impl.cc, based
on FeatureList flags.
2) This information is stored in GcmDeviceInfo, which is passed along to the
MultiDeviceSetupService via a ctor argument.
3) On creation, MultiDeviceSetupImpl creates a DeviceReenroller, providing it
   - a DeviceSyncClient, for communicating with CryptAuth to retrieve local
     device metadata, to re-enroll the device, and to sync the device;
   - and access to GcmDeviceInfo, in order to retrieve the latest list of
     supported SoftwareFeatures.
4) In the DeviceReenroller constructor, the supported software features from
the local device metadata are compared with the latest supported-state given
by GcmDeviceInfo's supported_software_features list.
5) If any supported-state changed, a re-enrollment is attempted via the
DeviceSyncClient.
6) If the re-enrollment is successful, a device sync is attempted via the
  DeviceSyncClient.
  - If the re-enrollment is unsuccessful, another attempt is scheduled to
    run after 5 minutes.
7) If the device sync is unsuccessful, another attempt is scheduled to
    run after 5 minutes.
Note that DeviceReenroller logic only runs when the MultiDeviceSetupService is
created, except for possibly retrying failed enrollments or syncs after some
delay. It does NOT act as an observer, checking for changes to GcmDeviceInfo's
supported features list, because we only expect this to change when Chrome
flags change, i.e., when the Chrome binary restarts.
Bug: 870770
Change-Id: I5f26a68448f3ee0e5dd8759aac12d05d1e4760a6
Reviewed-on: https://chromium-review.googlesource.com/1182419Reviewed-by:  Ryan Hansberry <hansberry@chromium.org>
Reviewed-by:
Ryan Hansberry <hansberry@chromium.org>
Reviewed-by:  Ryan Hamilton <rch@chromium.org>
Reviewed-by:
Ryan Hamilton <rch@chromium.org>
Reviewed-by:  Jeremy Klein <jlklein@chromium.org>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589387}
Jeremy Klein <jlklein@chromium.org>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589387}
Showing
This diff is collapsed.
Please register or sign in to comment