Enable hardware scan filter test on device which supports the feature.

Change-Id: I887e1d3cf294ef7418a18092c27a9e7e9aa89582
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 1a11a5e..55b4f8d 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -382,6 +382,17 @@
             <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleScannerTestActivity" />
         </activity>
 
+        <activity android:name=".bluetooth.BleScannerHardwareScanFilterActivity"
+                android:label="@string/ble_scanner_scan_filter_name"
+                android:configChanges="keyboardHidden|orientation|screenSize">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.cts.intent.category.MANUAL_TEST" />
+            </intent-filter>
+            <meta-data android:name="test_category" android:value="@string/bt_le" />
+            <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleScannerTestActivity" />
+        </activity>
+
         <activity android:name=".bluetooth.BleAdvertiserTestActivity"
                 android:label="@string/ble_advertiser_test_name"
                 android:configChanges="keyboardHidden|orientation|screenSize">
@@ -406,6 +417,17 @@
             <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleAdvertiserTestActivity" />
         </activity>
 
+        <activity android:name=".bluetooth.BleAdvertiserHardwareScanFilterActivity"
+                android:label="@string/ble_advertiser_scan_filter_name"
+                android:configChanges="keyboardHidden|orientation|screenSize">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.cts.intent.category.MANUAL_TEST" />
+            </intent-filter>
+            <meta-data android:name="test_category" android:value="@string/bt_le" />
+            <meta-data android:name="test_parent" android:value="com.android.cts.verifier.bluetooth.BleAdvertiserTestActivity" />
+        </activity>
+
         <activity android:name=".suid.SuidFilesActivity"
                 android:label="@string/suid_files"
                 android:configChanges="keyboardHidden|orientation|screenSize">
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java
index 637ef71..64c50bc 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleAdvertiserTestActivity.java
@@ -20,8 +20,12 @@
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
 
+import android.bluetooth.BluetoothAdapter;
 import android.os.Bundle;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class BleAdvertiserTestActivity extends PassFailButtons.TestListActivity {
 
     @Override
@@ -31,6 +35,14 @@
         setPassFailButtonClickListeners();
         setInfoResources(R.string.ble_advertiser_test_name, R.string.ble_advertiser_test_info, -1);
 
-        setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName()));
+        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+        List<String> disabledTest = new ArrayList<String>();
+        if (adapter == null || !adapter.isOffloadedFilteringSupported()) {
+            disabledTest.add(
+                    "com.android.cts.verifier.bluetooth.BleAdvertiserHardwareScanFilterActivity.");
+        }
+
+        setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
+                disabledTest.toArray(new String[disabledTest.size()])));
     }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java
index 1f54917..52933e0 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleScannerTestActivity.java
@@ -20,8 +20,12 @@
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
 
+import android.bluetooth.BluetoothAdapter;
 import android.os.Bundle;
 
+import java.util.ArrayList;
+import java.util.List;
+
 public class BleScannerTestActivity extends PassFailButtons.TestListActivity {
 
     @Override
@@ -31,6 +35,14 @@
         setPassFailButtonClickListeners();
         setInfoResources(R.string.ble_scanner_test_name,
                          R.string.ble_scanner_test_info, -1);
-        setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName()));
+        BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+        List<String> disabledTest = new ArrayList<String>();
+        if (adapter == null || !adapter.isOffloadedFilteringSupported()) {
+            disabledTest.add(
+                    "com.android.cts.verifier.bluetooth.BleScannerHardwareScanFilterActivity");
+        }
+
+        setTestListAdapter(new ManifestTestListAdapter(this, getClass().getName(),
+                disabledTest.toArray(new String[disabledTest.size()])));
     }
 }