Commit c8e82c98 authored by Francois Beaufort's avatar Francois Beaufort Committed by Chromium LUCI CQ

[WebNFC] Notify client once when error happens

Instead of calling `mClient.onError(error)` as many times as the number
of watchers, this CL makes sure we only call it once as the client takes
care of dispatching to all readers.

Bug: 520391
Change-Id: I82f2cf985d86e824c8a8cb9cbec85b7016334484
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2557018Reviewed-by: default avatarRijubrata Bhaumik <rijubrata.bhaumik@intel.com>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: François Beaufort <beaufort.francois@gmail.com>
Cr-Commit-Position: refs/heads/master@{#832234}
parent 6231ee5e
...@@ -560,9 +560,7 @@ public class NfcImpl implements Nfc { ...@@ -560,9 +560,7 @@ public class NfcImpl implements Nfc {
* Notify all active watchers that an error happened when trying to read the tag coming nearby. * Notify all active watchers that an error happened when trying to read the tag coming nearby.
*/ */
private void notifyErrorToAllWatchers(NdefError error) { private void notifyErrorToAllWatchers(NdefError error) {
for (int i = 0; i < mWatchIds.size(); i++) { if (mWatchIds.size() != 0) mClient.onError(error);
mClient.onError(error);
}
} }
/** /**
......
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