Check FEATURE_BLUETOOTH for Companion Device Test in CTS-V

Issue:
 "Companion Device Test” does not check for Bluetooth Feature Presence.
  This causes the app to crash.

    AndroidRuntime: java.lang.RuntimeException: Unable to create service
    com.android.companiondevicemanager.DeviceDiscoveryService: java.lang.NullPointerException:
    Attempt to invoke virtual method 'android.bluetooth.le.BluetoothLeScanner
    android.bluetooth.BluetoothAdapter.getBluetoothLeScanner()' on a null object reference

Root Cause:
 In CN80G Batch SKU devices, Bluetooth feature is not present and hence this fails.

Fix:
 The fix should be in the test case to check for FEATURE_BLUETOOTH before running
 tests. If Feature not supported, the test case is not applicable.

 This patch is an indicative patch to request for waiver from Google for this failure

Change-Id: I132b57e8b5a6075da0db0395dc0333bdbbbf08ec
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
index 95c99b7..0fa6f72 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
@@ -25,6 +25,8 @@
 import android.os.Bundle;
 import android.util.Log;
 import android.widget.Toast;
+import android.content.Context;
+import android.content.pm.PackageManager;
 
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
@@ -61,6 +63,14 @@
     }
 
     private void test() {
+
+        if (!getApplicationContext().getPackageManager().
+                  hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
+            Log.d(LOG_TAG, "PackageManager.FEATURE_BLUETOOTH not supported. This test case is not applicable");
+            getPassButton().setEnabled(true);
+            return;
+        }
+
         mInitialAssociations = mCompanionDeviceManager.getAssociations();
 
         AssociationRequest request = new AssociationRequest.Builder()