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

Commit a45ebad5 authored by Chun-Wei Wang's avatar Chun-Wei Wang Committed by Android (Google) Code Review
Browse files

Merge "Enable root before listing files"

parents 815545a3 e712ea68
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
     * @param files the paths of files which might contain wildcards
     */
    private void deleteFiles(String... files) throws Exception {
        try {
            getDevice().enableAdbRoot();
            boolean found = false;
            for (String file : files) {
                CommandResult result = getDevice().executeShellV2Command("ls " + file);
@@ -116,17 +118,15 @@ public class StagedRollbackTest extends BaseHostJUnit4Test {
            }

            if (found) {
            try {
                getDevice().enableAdbRoot();
                getDevice().remountSystemWritable();
                for (String file : files) {
                    getDevice().executeShellCommand("rm -rf " + file);
                }
                getDevice().reboot();
            }
        } finally {
            getDevice().disableAdbRoot();
        }
            getDevice().reboot();
        }
    }

    private void waitForDeviceNotAvailable(long timeout, TimeUnit unit) {
+4 −3
Original line number Diff line number Diff line
@@ -112,6 +112,10 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test {
     * @param files the paths of files which might contain wildcards
     */
    private void deleteFiles(String... files) throws Exception {
        if (!getDevice().isAdbRoot()) {
            getDevice().enableAdbRoot();
        }

        boolean found = false;
        for (String file : files) {
            CommandResult result = getDevice().executeShellV2Command("ls " + file);
@@ -122,9 +126,6 @@ public class StagedInstallInternalTest extends BaseHostJUnit4Test {
        }

        if (found) {
            if (!getDevice().isAdbRoot()) {
                getDevice().enableAdbRoot();
            }
            getDevice().remountSystemWritable();
            for (String file : files) {
                getDevice().executeShellCommand("rm -rf " + file);