Merge "Improve diagnostics when cannot install wellbeing test apk" into sc-dev
diff --git a/tests/src/com/android/launcher3/util/TestUtil.java b/tests/src/com/android/launcher3/util/TestUtil.java
index 55e5744..67f3902 100644
--- a/tests/src/com/android/launcher3/util/TestUtil.java
+++ b/tests/src/com/android/launcher3/util/TestUtil.java
@@ -22,6 +22,8 @@
import androidx.test.uiautomator.UiDevice;
+import org.junit.Assert;
+
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -48,7 +50,10 @@
in.close();
out.close();
- UiDevice.getInstance(getInstrumentation()).executeShellCommand("pm install " + apkFilename);
+ final String result = UiDevice.getInstance(getInstrumentation())
+ .executeShellCommand("pm install " + apkFilename);
+ Assert.assertTrue("Failed to install wellbeing test apk; make sure the device is rooted",
+ "Success".equals(result.replaceAll("\\s+", "")));
}
public static void uninstallDummyApp() throws IOException {