From f17b79fa6b1715d6dea68d6734f74498bcbd68f7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 9 Jan 2025 04:55:28 +0000 Subject: Add helper functions for testing trade-in mode. Trade-in mode is difficult to test in automation because it is inherently a user build feature. If it were enabled on ro.debuggable=1 builds, "TIM adb" would conflict with normal adb. So, it is one or the other, and we have to pick "normal adb" to not break all CI and developer workflows. To work around this, we are adding new APIs to ITradeInMode to enable testing TIM when ro.debuggable=1. This will allow us to test certain aspects of the SUW machinery and the "getstatus" command. We do this by setting a new persist property that is read on the next reboot. On next reboot, normal adb is forbidden from starting, and trade-in mode adb is allowed to start instead. disableTesting() unsets the persist property. These APIs are only allowed when ro.debuggable=1. Finally, we add a test method to schedule the same factory reset procedure that occurs within "tradeinmode evaluate". All the testing methods are restricted to ENTER_TRADE_IN_MODE privileges and require ro.debuggable=1. Test: adb shell tradeinmode testing start Bug: 379970773 Flag: com.android.tradeinmode.flags.enable_trade_in_mode Change-Id: I58234d4d2202e0be347e1a0486b7a0869a7867d2 --- packages/Shell/AndroidManifest.xml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'packages/Shell') diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 8fe3a0c4b4ae..55f7317f25e4 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -1015,6 +1015,9 @@ + + +