Commit 346f4c6d authored by Sky Malice's avatar Sky Malice Committed by Commit Bot

[Feed] Fix handling of pref change.

Previously we assumed the PrefChangeRegistrar would only notify on an
actual change, and an assert was in the code to verify this was the
case. However, that assumption turned out to be incorrect, and this
notification was called during sign in/out when the value was staying
true.

This would cause the entire article section of the NTP to be removed
until chrome was restarted. Typically occur for dasher accounts.

Bug: 934335
Change-Id: I67a6dbfe17a73208b85f91ce195e1d4ceb589563
Reviewed-on: https://chromium-review.googlesource.com/c/1481731Reviewed-by: default avatarFilip Gorski <fgorski@chromium.org>
Commit-Queue: Sky Malice <skym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634312}
parent fd6d643c
......@@ -221,15 +221,16 @@ public class FeedProcessScopeFactory {
}
private static void articlesEnabledPrefChange() {
// Should only be subscribed while it was enabled. A change should mean articles are now
// disabled.
assert !PrefServiceBridge.getInstance().getBoolean(Pref.NTP_ARTICLES_SECTION_ENABLED);
// There have been quite a few crashes/bugs that happen when code does not correctly handle
// the scenario where Feed suddenly becomes disabled and the above getters start returning
// nulls. Having this log a warning helps diagnose this pattern from the logcat.
Log.w(TAG, "Disabling Feed because of policy.");
sEverDisabledForPolicy = true;
destroy();
// Cannot assume this is called because of an actual change. May be going from true to true.
if (!PrefServiceBridge.getInstance().getBoolean(Pref.NTP_ARTICLES_SECTION_ENABLED)) {
// There have been quite a few crashes/bugs that happen when code does not correctly
// handle the scenario where Feed suddenly becomes disabled and the above getters start
// returning nulls. Having this log a warning helps diagnose this pattern from the
// logcat.
Log.w(TAG, "Disabling Feed because of policy.");
sEverDisabledForPolicy = true;
destroy();
}
}
/** Clears out all static state. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment