aboutsummaryrefslogtreecommitdiff
path: root/src/com/android/tradefed/targetprep
diff options
context:
space:
mode:
authorGuang Zhu <guangzhu@google.com>2017-01-03 17:59:55 -0800
committerGuang Zhu <guangzhu@google.com>2017-01-05 10:14:33 -0800
commit91fdf44e35897eceaa614d78300d5b370a2795aa (patch)
treea788f4957a36838b212c8b94f498a4499e96ded8 /src/com/android/tradefed/targetprep
parent0c7950f1f51ff8ad502da252c549f56130319c1a (diff)
downloadtradefederation-91fdf44e35897eceaa614d78300d5b370a2795aa.tar.gz
add new zip extraction util methods to cover file permissions
- the new util methods are meant to provide same interface as before (modulus using a different ZipFile class) - existing uses of the util methods are migrated Bug: 33942619 Test: new & existing unit tests Change-Id: I9b53cd822ef282e90832cc18c47d4672a6a375d5
Diffstat (limited to 'src/com/android/tradefed/targetprep')
-rw-r--r--src/com/android/tradefed/targetprep/CdmaDeviceFlasher.java7
-rw-r--r--src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java7
2 files changed, 8 insertions, 6 deletions
diff --git a/src/com/android/tradefed/targetprep/CdmaDeviceFlasher.java b/src/com/android/tradefed/targetprep/CdmaDeviceFlasher.java
index db2d14663..85da73ea6 100644
--- a/src/com/android/tradefed/targetprep/CdmaDeviceFlasher.java
+++ b/src/com/android/tradefed/targetprep/CdmaDeviceFlasher.java
@@ -23,11 +23,12 @@ import com.android.tradefed.device.ITestDevice;
import com.android.tradefed.util.FileUtil;
import com.android.tradefed.util.IRunUtil;
import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.ZipUtil;
+import com.android.tradefed.util.ZipUtil2;
+
+import org.apache.commons.compress.archivers.zip.ZipFile;
import java.io.File;
import java.io.IOException;
-import java.util.zip.ZipFile;
/**
* A class that flashes an image on a physical Android device with a CDMA radio.
@@ -141,7 +142,7 @@ public class CdmaDeviceFlasher extends FastbootDeviceFlasher {
protected File extractSystemZip(IDeviceBuildInfo deviceBuild) throws IOException {
File updateDir = FileUtil.createTempDir(LOG_TAG);
ZipFile updater = new ZipFile(deviceBuild.getDeviceImageFile().getAbsolutePath());
- ZipUtil.extractZip(updater, updateDir);
+ ZipUtil2.extractZip(updater, updateDir);
return updateDir;
}
diff --git a/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java b/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java
index b0c20c396..f45b6676c 100644
--- a/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java
+++ b/src/com/android/tradefed/targetprep/FastbootDeviceFlasher.java
@@ -26,7 +26,9 @@ import com.android.tradefed.util.CommandStatus;
import com.android.tradefed.util.FileUtil;
import com.android.tradefed.util.IRunUtil;
import com.android.tradefed.util.RunUtil;
-import com.android.tradefed.util.ZipUtil;
+import com.android.tradefed.util.ZipUtil2;
+
+import org.apache.commons.compress.archivers.zip.ZipFile;
import java.io.File;
import java.io.IOException;
@@ -35,7 +37,6 @@ import java.util.Collection;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import java.util.zip.ZipFile;
/**
* A class that relies on fastboot to flash an image on physical Android hardware.
@@ -485,7 +486,7 @@ public class FastbootDeviceFlasher implements IDeviceFlasher {
File userdataImg = null;
try {
try {
- userdataImg = ZipUtil.extractFileFromZip(
+ userdataImg = ZipUtil2.extractFileFromZip(
new ZipFile(deviceBuild.getDeviceImageFile()), "userdata.img");
} catch (IOException ioe) {
throw new TargetSetupError("failed to extract userdata.img from image file", ioe,