Ensure getBugreportz/logBugreport are safe calls
Ensure we can properly fallback to standard bugreport if
bugreportz fails.
Bug: 30835654
Change-Id: Icf209ac82c9799372244af0f3d0f9aa37842e398
diff --git a/src/com/android/tradefed/device/NativeDevice.java b/src/com/android/tradefed/device/NativeDevice.java
index aba0649..e57de24 100644
--- a/src/com/android/tradefed/device/NativeDevice.java
+++ b/src/com/android/tradefed/device/NativeDevice.java
@@ -2038,10 +2038,15 @@
*/
@Override
public InputStreamSource getBugreportz() {
- checkApiLevelAgainst("getBugreportz", 24);
- File bugreportZip = getBugreportzInternal();
- if (bugreportZip != null) {
- return new FileInputStreamSource(bugreportZip, true);
+ try {
+ checkApiLevelAgainst("getBugreportz", 24);
+ File bugreportZip = getBugreportzInternal();
+ if (bugreportZip != null) {
+ return new FileInputStreamSource(bugreportZip, true);
+ }
+ } catch (IllegalArgumentException e) {
+ CLog.e("API level error when checking bugreportz support.");
+ CLog.e(e);
}
return null;
}