DescriptionFix policy invalidator lifecycle bugs for Android.
On Android, the user may disconnect from their Google account and reconnect multiple times within the same session. This case wasn't considered properly when developing the CloudPolicyInvalidator.
When the account is disconnected, the CloudPolicyCore is disconnected before the CloudPolicyStore is reset. When the store is reset, the invalidator unregisters for the policy object and makes a callback to indicate that invalidations are disabled. However, since the CloudPolicyCore is disconnected at this point, a crash is occurring because the code blindly attempts to use objects connected to the core.
Also, when the account becomes reconnected, the refresh scheduler is restarted. This caused the invalidator to be initialized again, which is unexpected.
The solution to these issues is to refactor the CloudPolicyInvalidator to support starting and stopping. The invalidator will listen to events published by the CloudPolicyCore to determine when to start and stop. The invalidator starts when the refresh scheduler starts and stops when it stops.
Also, when CloudPolicyInvalidator::Shutdown is called, outstanding weak pointers held in callbacks should be invalidated. This may not cause any issues since it is likely no messages are pumped on the thread in between the calls to Shutdown and the destructor, but should be fixed.
BUG=280345, 272574, 280536
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=221837
Patch Set 1 #Patch Set 2 : #
Total comments: 8
Patch Set 3 : #Patch Set 4 : #
Total comments: 24
Patch Set 5 : #Patch Set 6 : #
Total comments: 8
Patch Set 7 : #
Total comments: 2
Patch Set 8 : #Messages
Total messages: 14 (0 generated)
|