summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author JW Wang <wangchun@google.com> 2019-10-24 16:35:38 +0800
committer JW Wang <wangchun@google.com> 2019-10-24 18:19:18 +0800
commit9ba5f6b80ae400a9a0d85c6cbf7a54516bc3f70d (patch)
tree53b1ae7a58f98b3fc8c8f752f739e1039c601231
parentd304b60c3cbf25a19cdeaf224729831cc2b71f7e (diff)
Close the returned file descriptior (1/n)
As suggested by the comment: https://cs.corp.google.com/android/frameworks/base/core/java/android/app/UiAutomation.java?rcl=55a225ade4016b9dde04a3d4b4d25db761b1ccbf&l=1127 Bug: 143211397 Test: atest StagedRollbackTest Change-Id: I45a5e5fe2188f3172b42f868fe2c4853173451bd
-rw-r--r--tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
index 79b8b4623cd8..b17a1d987ac9 100644
--- a/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
+++ b/tests/RollbackTest/RollbackTest/src/com/android/tests/rollback/StagedRollbackTest.java
@@ -32,6 +32,7 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.rollback.RollbackInfo;
import android.content.rollback.RollbackManager;
+import android.os.ParcelFileDescriptor;
import android.provider.DeviceConfig;
import android.text.TextUtils;
@@ -46,6 +47,8 @@ import com.android.cts.rollback.lib.Rollback;
import com.android.cts.rollback.lib.RollbackUtils;
import com.android.internal.R;
+import libcore.io.IoUtils;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -332,7 +335,8 @@ public class StagedRollbackTest {
}
private void runShellCommand(String cmd) {
- InstrumentationRegistry.getInstrumentation().getUiAutomation()
+ ParcelFileDescriptor pfd = InstrumentationRegistry.getInstrumentation().getUiAutomation()
.executeShellCommand(cmd);
+ IoUtils.closeQuietly(pfd);
}
}