aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwsmlby <wsmlby@google.com>2014-09-05 21:50:46 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-09-05 21:50:47 +0000
commitffc0957f81303dbc65cbdb86c00259c965bbbb53 (patch)
tree03c87a604bf52c8ef0c6ee7effd6788ff626789b
parentba059b9c7e1d20bc65b2a77d1f699bfaf4e320dd (diff)
parente857d1d69015af90719053125923dcb680279d49 (diff)
downloadtradefederation-ffc0957f81303dbc65cbdb86c00259c965bbbb53.tar.gz
Merge "Add helper function for abi support."
-rw-r--r--src/com/android/tradefed/util/AbiFormatter.java31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/com/android/tradefed/util/AbiFormatter.java b/src/com/android/tradefed/util/AbiFormatter.java
index c48879f3b..9ebbb31de 100644
--- a/src/com/android/tradefed/util/AbiFormatter.java
+++ b/src/com/android/tradefed/util/AbiFormatter.java
@@ -16,7 +16,6 @@
package com.android.tradefed.util;
-import com.android.ddmlib.IDevice;
import com.android.tradefed.device.DeviceNotAvailableException;
import com.android.tradefed.device.ITestDevice;
@@ -69,21 +68,35 @@ public class AbiFormatter {
}
/**
- * Helper method to get the default abi name for the given abi
+ * Helper method to get the default abi name for the given bitness
* @param device
- * @param requestedAbi
+ * @param bitness
* @return the default abi name for the given abi
* @throws DeviceNotAvailableException
*/
- public static String getDefaultAbi(ITestDevice device, String requestedAbi)
+ public static String getDefaultAbi(ITestDevice device, String bitness)
throws DeviceNotAvailableException {
- String abiList = device.getProperty(PRODUCT_CPU_ABILIST_KEY + requestedAbi);
+ String []abis = getSupportedAbis(device, bitness);
+ if (abis.length > 0 && abis[0].length() > 0) {
+ return abis[0];
+ }
+ return null;
+ }
+
+ /**
+ * Helper method to get the list of supported abis for the given bitness
+ * @param device
+ * @param bitness, 32 or 64
+ * @return the supported abi list of that bitness
+ * @throws DeviceNotAvailableException
+ */
+ public static String[] getSupportedAbis(ITestDevice device, String bitness)
+ throws DeviceNotAvailableException {
+ String abiList = device.getProperty(PRODUCT_CPU_ABILIST_KEY + bitness);
if (abiList != null) {
String []abis = abiList.split(",");
- if (abis.length > 0 && abis[0].length() > 0) {
- return abis[0];
- }
+ return abis;
}
- return null;
+ return new String[0];
}
}