Re-root and use device remount APIs for SystemPreparer

This might improve success rates for remounting the device.
The command goes through shell with no inherent state, so it's
unclear how it can fail, but going through the official methods
might help.

Bug: 197552347

Test: atest --rerun-until-failure 100 \
    com.android.server.pm.test.OverlayActorVisibilityTest

Change-Id: I25c1f938064e72ddc288b12c048f0cd82217b583
This commit is contained in:
Winson
2022-04-05 09:33:17 -07:00
parent b9d928eae3
commit e593837a58

View File

@@ -21,7 +21,6 @@ import static org.junit.Assert.assertTrue;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.log.LogUtil;
import org.junit.Assert;
import org.junit.ClassRule;
@@ -369,7 +368,9 @@ public class SystemPreparer extends ExternalResource {
device.executeShellCommand("disable-verity");
device.reboot();
}
device.executeShellCommand("remount");
device.enableAdbRoot();
device.remountSystemWritable();
device.remountVendorWritable();
device.waitForDeviceAvailable();
}