Merge "Add hasMicrophone() to FeatureUtil used by followup GTS update" into oreo-mr1-cts-dev
am: 25c59eff96

Change-Id: I4b6c885c22a82da49cb8759873096bed22f96152
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/FeatureUtil.java b/common/device-side/util/src/com/android/compatibility/common/util/FeatureUtil.java
index 2fd609a..ebf881a 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/FeatureUtil.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/FeatureUtil.java
@@ -99,4 +99,9 @@
     public static boolean hasTelephony() {
         return hasSystemFeature(TELEPHONY_FEATURE);
     }
+
+    /** Returns true if the device has feature FEATURE_MICROPHONE */
+    public static boolean hasMicrophone() {
+        return hasSystemFeature(getPackageManager().FEATURE_MICROPHONE);
+    }
 }
diff --git a/common/host-side/util/src/com/android/compatibility/common/util/FeatureUtil.java b/common/host-side/util/src/com/android/compatibility/common/util/FeatureUtil.java
index 6fae219..87d257a 100644
--- a/common/host-side/util/src/com/android/compatibility/common/util/FeatureUtil.java
+++ b/common/host-side/util/src/com/android/compatibility/common/util/FeatureUtil.java
@@ -32,6 +32,7 @@
     public static final String TELEPHONY_FEATURE = "android.hardware.telephony";
     public static final String TV_FEATURE = "android.hardware.type.television";
     public static final String WATCH_FEATURE = "android.hardware.type.watch";
+    public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
 
     /** Returns true if the device has a given system feature */
     public static boolean hasSystemFeature(ITestDevice device, String feature)
@@ -95,4 +96,9 @@
     public static boolean hasTelephony(ITestDevice device) throws DeviceNotAvailableException {
         return hasSystemFeature(device, TELEPHONY_FEATURE);
     }
+
+    /** Returns true if the device has feature FEATURE_MICROPHONE */
+    public static boolean hasMicrophone(ITestDevice device) throws DeviceNotAvailableException {
+        return hasSystemFeature(device, FEATURE_MICROPHONE);
+    }
 }