Add fs-checkpoint checking logic InstallUtilsHost
This is a partial cherry-pick of the change
Ie8be624c03f2d9b7c7a4fbeda58d0493de8bac0d
Test: atest sdkextension_e2e_tests
Change-Id: I84f955c0a922c5372ca8f4452c8cd6c5930539ad
Merged-In: Ie8be624c03f2d9b7c7a4fbeda58d0493de8bac0d
(cherry picked from commit 13866a821de6427a8842d82786b71b4bcd75eea7)
diff --git a/libs/install/src/com/android/cts/install/lib/host/InstallUtilsHost.java b/libs/install/src/com/android/cts/install/lib/host/InstallUtilsHost.java
index 59c38ad..41b568b 100644
--- a/libs/install/src/com/android/cts/install/lib/host/InstallUtilsHost.java
+++ b/libs/install/src/com/android/cts/install/lib/host/InstallUtilsHost.java
@@ -16,7 +16,11 @@
package com.android.cts.install.lib.host;
+import static com.google.common.truth.Truth.assertWithMessage;
+
import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.util.CommandResult;
+import com.android.tradefed.util.CommandStatus;
/**
* Utilities to facilitate installation in tests on host side.
@@ -35,4 +39,14 @@
public boolean isApexUpdateSupported() throws Exception {
return mTest.getDevice().getBooleanProperty("ro.apex.updatable", false);
}
+
+ /**
+ * Return {@code true} if and only if device supports file system checkpoint.
+ */
+ public boolean isCheckpointSupported() throws Exception {
+ CommandResult result = mTest.getDevice().executeShellV2Command("sm supports-checkpoint");
+ assertWithMessage("Failed to check if fs checkpointing is supported : %s",
+ result.getStderr()).that(result.getStatus()).isEqualTo(CommandStatus.SUCCESS);
+ return "true".equals(result.getStdout().trim());
+ }
}