[autotest] Fix a bug in handling Launch Control builds in suite scheduler.

Launch Control branches are merged in
BaseEvents.launch_control_branches_targets property. That allows
each event only query Launch Control once to get all latest
builds. However, when a task tries to run, it should only process
the builds matches the branches specified in task config.

BUG=b:32809999
TEST=unittest, local suite scheduler run
/usr/local/autotest/site_utils/suite_scheduler/suite_scheduler.py \
      -d /usr/local/autotest/logs -f dshi/test_ss_2.ini  \
      -r /tmp/_autotmp_ZnjRQH_suite_scheduler

[Android_WiFi_Sanity_Bullhead]
run_on: nightly
hour: 4
suite: android_wifi
os_type: android
branches: git_nyc-mr1-release
targets: bullhead-userdebug
pool: suites
no_delay: True

[Android_Bluetooth_Nightly_Bullhead_O]
run_on: nightly
hour: 4
suite: android_bluetooth
os_type: android
branches: git_oc-release
boards: bullhead-2
targets: bullhead-userdebug
pool: suites
no_delay: True

Change-Id: Ie7b9110f02942ae99edf79f55d1091512267f2a6
Reviewed-on: https://chromium-review.googlesource.com/411969
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Kris Rambish <krisr@chromium.org>
diff --git a/site_utils/suite_scheduler/task.py b/site_utils/suite_scheduler/task.py
index 94dc571..0036a1d 100644
--- a/site_utils/suite_scheduler/task.py
+++ b/site_utils/suite_scheduler/task.py
@@ -1008,6 +1008,15 @@
         """
         logging.info('Running %s on %s', self._name, board)
         for build in launch_control_builds:
+            # Filter out builds don't match the branches setting.
+            # Launch Control branches are merged in
+            # BaseEvents.launch_control_branches_targets property. That allows
+            # each event only query Launch Control once to get all latest
+            # builds. However, when a task tries to run, it should only process
+            # the builds matches the branches specified in task config.
+            if not any([branch in build
+                        for branch in self._launch_control_branches]):
+                continue
             try:
                 self._ScheduleSuite(scheduler, None, None, None,
                                     test_source_build=build,