threadnetwork: Avoid execute command if service does not exist

We might run VTS when the thread_network service is not available. This
patch prevents shell commands from being executed if the service is
absent.

Bug: 374009923
Bug: 355317617
Bug: 376750874
Test: atest VtsHalThreadNetworkTargetTest
Change-Id: I94dd7e2e7585e061f53291c47e46841e5e670b6c
(cherry picked from commit ae9ea3c896)
This commit is contained in:
shihchienc
2024-10-17 06:22:13 +00:00
committed by Patrick Chang
parent d93bf85e1e
commit 0afad08ea2

View File

@@ -13,11 +13,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
<configuration description="Runs VtsHalThreadNetworkTargetTest.">
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="run-command" value="cmd thread_network force-stop-ot-daemon enabled" />
<option name="run-command" value="if pm list features |grep 'android.hardware.thread_network'; then cmd thread_network force-stop-ot-daemon enabled; fi" />
<option name="run-command" value="cmd bluetooth_manager enable" />
<option name="teardown-command" value="cmd thread_network force-stop-ot-daemon disabled" />
<option name="teardown-command" value="if pm list features |grep 'android.hardware.thread_network'; then cmd thread_network force-stop-ot-daemon disabled; fi" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />