<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2022 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<configuration description="Config for E2E HealthFitness Controller test cases">
    <option name="test-suite-tag" value="e2e-ui" />
    <option name="config-descriptor:metadata" key="component" value="framework" />
    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true" />
        <option name="test-file-name" value="HealthConnectUIE2ETests.apk" />
        <option name="test-file-name" value="HealthFitnessCtsTestApp.apk"/>
        <option name="test-file-name" value="HealthFitnessCtsTestApp2.apk"/>
        <option name="test-file-name" value="HealthFitnessCtsSystemTestApp.apk"/>
        <option name="test-file-name" value="CtsHealthConnectTestAppAWithNormalReadWritePermission.apk"/>
        <option name="test-file-name" value="CtsHealthConnectTestAppBWithNormalReadWritePermission.apk"/>
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
        <!-- Disable KeyguardSliceProvider b/397607594 -->
        <option name="run-command" value="pm disable com.android.systemui/.keyguard.KeyguardSliceProvider" />
        <!-- Reset display and font and disable animations -->
        <option name="run-command" value="settings put system font_scale 0.85" />
        <option name="run-command" value="wm density reset" />
        <option name="run-command" value="wm size reset" />

        <!-- Skip health connect onboarding! -->
        <option name="run-command" value="am start -a android.health.connect.action.SKIP_HEALTH_CONNECT_ONBOARDING" />
        <!-- Dimiss keyguard -->
        <option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
        <option name="run-command" value="wm dismiss-keyguard" />
        <!-- disable DeprecatedAbi warning -->
        <option name="run-command" value="setprop debug.wm.disable_deprecated_abi_dialog 1" />
        <option name="run-command"
                value="cmd overlay enable com.android.internal.systemui.navbar.gestural"/>
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
        <option name="force-skip-system-props" value="true" />
        <option name="screen-always-on" value="on" />
        <option name="set-global-setting" key="animator_duration_scale" value="0.0" />
        <option name="set-global-setting" key="transition_animation_scale" value="0.0" />
        <option name="set-global-setting" key="window_animation_scale" value="0.0" />
        <option name="restore-settings" value="true" />
    </target_preparer>
    <option
        name="config-descriptor:metadata"
        key="mainline-param"
        value="com.google.android.healthfitness.apex" />

    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="android.healthconnect.cts.ui.e2e" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
        <option name="hidden-api-checks" value="false" />
        <option name="device-listeners" value="android.device.collectors.ScreenshotOnFailureCollector"/>
    </test>

    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
        <!-- Collect the files generated on error -->
        <option name="pull-pattern-keys" value="android.device.collectors.ScreenshotOnFailureCollector.*\.png"/>
        <option name="collect-on-run-ended-only" value="false" />
    </metrics_collector>

    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
        <option name="mainline-module-package-name" value="com.google.android.healthfitness" />
    </object>

</configuration>
