Commit f79c51b6 authored by Ehimare Okoyomon's avatar Ehimare Okoyomon Committed by Commit Bot

Fix unnecessary toggle changed calls on incognito ntp

Add a check to only call the cookie controls service if the new state is
different from the previous state, because calling setChecked
programmatically triggers onCheckedChanged.

Bug: 1040091
Change-Id: I639a08cf47e365a3542c94b18ba680defca55b99
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132209Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755398}
parent 9fd7d0b6
......@@ -119,8 +119,7 @@ public class IncognitoCookieControlsManager
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mEnforcement == CookieControlsEnforcement.NO_ENFORCEMENT
&& (buttonView.getId() == R.id.cookie_controls_card_toggle)) {
if (isChecked != mChecked && (buttonView.getId() == R.id.cookie_controls_card_toggle)) {
mServiceBridge.handleCookieControlsToggleChanged(isChecked);
}
}
......
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