Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33203ef6 authored by Sal Savage's avatar Sal Savage
Browse files

Make BluetoothInstrumentationTests preparer multi-user aware

The current target_preparer only calls "svc bluetooth enable|disable"
under user 0. These calls will fail for multi-user builds where
Bluetooth is being ran/tested under a user that isn't user 0.

This change will make the preparer run the command under the current
user instead. It should solve considerable test flake and test coverage
statistic problems on multi-user builds.

Tag: #stability
Bug: 203807060
Test: atest BluetoothInstrumentationTests -- run on a car with user 10
Change-Id: I294ff9f2118e62824b6a2ee045b371434003a01a
parent ef2cf803
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,8 +22,8 @@
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
        <option name="run-command" value="settings put global ble_scan_always_enabled 0" />
        <option name="run-command" value="svc bluetooth disable" />
        <option name="teardown-command" value="svc bluetooth enable" />
        <option name="run-command" value="su u$(am get-current-user)_system svc bluetooth disable" />
        <option name="teardown-command" value="su u$(am get-current-user)_system svc bluetooth enable" />
        <option name="teardown-command" value="settings put global ble_scan_always_enabled 1" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.FolderSaver">