<?xml version="1.0" encoding="utf-8"?>

<!--
  ~ Copyright (C) 2025 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="Runs Developer Verification CTS root tests base template">
    <option name="test-suite-tag" value="apct" />
    <option name="test-suite-tag" value="apct-instrumentation" />

    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>

    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="push-file" key="CtsRootVerifierProviderOverlay.apk" value="/product/overlay/CtsRootVerifierProviderOverlay.apk" />
        <option name="push-file" key="CtsRootVerifierApp.apk" value="/system/priv-app/CtsRootVerifierApp/CtsRootVerifierApp.apk" />
        <option name="push-file" key="CtsRootDelegateApp.apk" value="/system/priv-app/CtsRootDelegateApp/CtsRootDelegateApp.apk" />
        <option name="push-file" key="developer-verification-cts-root-permission.xml" value="/system/etc/permissions/developer-verification-cts-root-permission.xml" />
        <option name="push-file" key="CtsRootEmptyTestApp.apk" value="/data/local/tmp/cts-root/CtsRootEmptyTestApp.apk" />
        <option name="cleanup" value="true" />
        <option name="remount-system" value="true" />
    </target_preparer>

    <!-- Reboot the system so that the test will install the privileged verifier app and read the newly pushed allowlist. -->
    <target_preparer class="com.android.tradefed.targetprep.RebootTargetPreparer" />

    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true" />
        <option name="test-file-name" value="{MODULE}.apk" />
        <!-- Install non-privileged installer app.-->
        <option name="test-file-name" value="CtsRootInstallerAppTarget36.apk" />
    </target_preparer>

    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
        <option name="package" value="android.content.pm.cts_root" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
        <option name="restart" value="false" />
        <option name="instrumentation-arg" key="is_installer_privileged" value="false"/>
        <option name="instrumentation-arg" key="installer_package_name" value="android.content.pm.cts_root.installerapp"/>
    </test>
</configuration>
