Remove extraneous increment of counter in loop
While checking for package to be uninstalled, the loop incremented i
twice, resulting in half the number of attempts than intended.
Test: atest CtsHostsideNetworkPolicyTests:\
HostsideRestrictBackgroundNetworkTests
Bug: 334171080
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:a5bcf8079ddedf75e0426050024ec3b86f3ad095)
Merged-In: I1fbd979eb7584de52063ef33bd8c993c139e40ee
Change-Id: I1fbd979eb7584de52063ef33bd8c993c139e40ee
diff --git a/tests/cts/hostside-network-policy/src/com/android/cts/netpolicy/HostsideNetworkPolicyTestCase.java b/tests/cts/hostside-network-policy/src/com/android/cts/netpolicy/HostsideNetworkPolicyTestCase.java
index b662aa1..6de6b17 100644
--- a/tests/cts/hostside-network-policy/src/com/android/cts/netpolicy/HostsideNetworkPolicyTestCase.java
+++ b/tests/cts/hostside-network-policy/src/com/android/cts/netpolicy/HostsideNetworkPolicyTestCase.java
@@ -106,8 +106,7 @@
uninstallPackage(getTestInformation(), packageName, shouldSucceed);
}
- protected void assertPackageUninstalled(String packageName) throws DeviceNotAvailableException,
- InterruptedException {
+ protected void assertPackageUninstalled(String packageName) throws DeviceNotAvailableException {
final String command = "cmd package list packages " + packageName;
final int max_tries = 5;
for (int i = 1; i <= max_tries; i++) {
@@ -128,7 +127,6 @@
if (!found) {
return;
}
- i++;
Log.v(TAG, "Package " + packageName + " not uninstalled yet (" + result
+ "); sleeping 1s before polling again");
RunUtil.getDefault().sleep(1000);