Switch to system user before CtsBackupTestCases and
CtsBackupHostTestCases module

Backup tests are not fully supported in secondary user and only works
for system users. Tests in this module will fail for devices in headless
user mode which by default runs in secondary user, such as automotive
devices.

Bug: 130183386, Bug: 130185764
Test: atest CtsBackupTestCases, atest CtsBackupHostTestCases
Change-Id: Ic85de6f9d1a536522d0acb3524c96b72caf4d40b
diff --git a/hostsidetests/backup/AndroidTest.xml b/hostsidetests/backup/AndroidTest.xml
index 4a11ba0..959ae6e 100644
--- a/hostsidetests/backup/AndroidTest.xml
+++ b/hostsidetests/backup/AndroidTest.xml
@@ -19,6 +19,12 @@
     <!-- Backup of instant apps is not supported. -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <!-- Run this module in system user because backup tests are not fully supported in secondary user.
+         For devices running on secondary user, such as automotive devices, these tests will fail.
+         This should be removed when backup tests are fully functional for secondary users. -->
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsFullbackupApp.apk" />
diff --git a/tests/backup/AndroidTest.xml b/tests/backup/AndroidTest.xml
index a7081d6..fdaac0e 100644
--- a/tests/backup/AndroidTest.xml
+++ b/tests/backup/AndroidTest.xml
@@ -20,6 +20,12 @@
     <!-- Backup of instant apps is not supported. -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <!-- Run this module in system user because backup tests are not fully supported in secondary user.
+         For devices running on secondary user, such as automotive devices, these tests will fail.
+         This should be removed when backup tests are fully functional for secondary users. -->
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsFullBackupApp.apk" />