diff options
| author | 2019-10-21 16:36:44 +0800 | |
|---|---|---|
| committer | 2019-10-22 09:43:38 +0800 | |
| commit | c6efb184cd405ec57fffe7001c2996e79254daff (patch) | |
| tree | 1a2162a3a3ba549dc1ee9dea2982ce2ee5078670 | |
| parent | d648abd6906706867a40d1e2d90a90b011b4c332 (diff) | |
Don't assume how many crashes to trigger rollback (1/n)
Set the device property so we know exactly how many crashes we need
to trigger rollback.
Bug: 143052400
Test: atest StagedRollbackTest
Change-Id: I0455d3ad6848bf3bfdbb238cfbf6b067deb89957
| -rw-r--r-- | tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java index cdc21ef8f971..f06b18a0605d 100644 --- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java +++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java @@ -32,6 +32,7 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageInstaller; import android.content.rollback.RollbackInfo; import android.content.rollback.RollbackManager; +import android.provider.DeviceConfig; import android.text.TextUtils; import androidx.test.InstrumentationRegistry; @@ -64,6 +65,8 @@ public class StagedRollbackTest { private static final String NETWORK_STACK_CONNECTOR_CLASS = "android.net.INetworkStackConnector"; + private static final String PROPERTY_WATCHDOG_TRIGGER_FAILURE_COUNT = + "watchdog_trigger_failure_count"; private static final String MODULE_META_DATA_PACKAGE = getModuleMetadataPackageName(); @@ -76,7 +79,8 @@ public class StagedRollbackTest { Manifest.permission.INSTALL_PACKAGES, Manifest.permission.DELETE_PACKAGES, Manifest.permission.TEST_MANAGE_ROLLBACKS, - Manifest.permission.FORCE_STOP_PACKAGES); + Manifest.permission.FORCE_STOP_PACKAGES, + Manifest.permission.WRITE_DEVICE_CONFIG); } /** @@ -128,7 +132,10 @@ public class StagedRollbackTest { */ @Test public void testBadApkOnly_Phase3() throws Exception { - // Crash TestApp.A PackageWatchdog#TRIGGER_FAILURE_COUNT times to trigger rollback + DeviceConfig.setProperty(DeviceConfig.NAMESPACE_ROLLBACK, + PROPERTY_WATCHDOG_TRIGGER_FAILURE_COUNT, + Integer.toString(5), false); + RollbackUtils.sendCrashBroadcast(TestApp.A, 5); // We expect the device to be rebooted automatically. Wait for that to happen. |