commit | 71769f69ccafcc9d6879b1871c9c5e59b55e6d58 | [log] [tgz] |
---|---|---|
author | TreeHugger Robot <treehugger-gerrit@google.com> | Tue Aug 31 17:51:46 2021 +0000 |
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | Tue Aug 31 17:51:46 2021 +0000 |
tree | 0437a8be7ca0d7a20b696ec45c26af536e4efa50 | |
parent | bf572e27cc7ed53e9364d18b82469ddee6fd38c8 [diff] | |
parent | be4a3ad3c43bb8112210c15e0ad53d506eb95158 [diff] |
Merge "fix statsd tests hasFeature detection" into stage-aosp-sc-ts-dev am: bce23124c8 am: 1c4a42845d am: be4a3ad3c4 Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/15684468 Change-Id: If01ab425d1ab972ebaae24786714fae942097d93
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/DeviceUtils.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/DeviceUtils.java index cac353e..10eec55 100644 --- a/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/DeviceUtils.java +++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/DeviceUtils.java
@@ -43,6 +43,7 @@ import java.io.FileNotFoundException; import java.util.Map; +import java.util.StringTokenizer; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -243,7 +244,15 @@ */ public static boolean hasFeature(ITestDevice device, String feature) throws Exception { final String features = device.executeShellCommand("pm list features"); - return features.contains(feature); + StringTokenizer featureToken = new StringTokenizer(features, "\n"); + + while(featureToken.hasMoreTokens()) { + if (("feature:" + feature).equals(featureToken.nextToken())) { + return true; + } + } + + return false; } /**