Skip to content
Snippets Groups Projects
Unverified Commit eb9d0c00 authored by akwizgran's avatar akwizgran
Browse files

Report Bluetooth LE and Wi-Fi Direct support.

parent 07853488
No related branches found
No related tags found
No related merge requests found
......@@ -33,6 +33,7 @@ import static android.bluetooth.BluetoothAdapter.SCAN_MODE_CONNECTABLE;
import static android.bluetooth.BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE;
import static android.content.Context.ACTIVITY_SERVICE;
import static android.content.Context.CONNECTIVITY_SERVICE;
import static android.content.Context.WIFI_P2P_SERVICE;
import static android.content.Context.WIFI_SERVICE;
import static android.net.ConnectivityManager.TYPE_MOBILE;
import static android.net.ConnectivityManager.TYPE_WIFI;
......@@ -162,6 +163,12 @@ public class BriarReportPrimer implements ReportPrimer {
else wifiStatus += "not connected";
customData.put("Wi-Fi status", wifiStatus);
// Is wifi direct supported?
String wifiDirectStatus = "Supported";
if (ctx.getSystemService(WIFI_P2P_SERVICE) == null)
wifiDirectStatus = "Not supported";
customData.put("Wi-Fi Direct", wifiDirectStatus);
if (wm != null) {
WifiInfo wifiInfo = wm.getConnectionInfo();
if (wifiInfo != null) {
......@@ -189,6 +196,13 @@ public class BriarReportPrimer implements ReportPrimer {
// Is Bluetooth discoverable?
boolean btDiscoverable = bt != null &&
bt.getScanMode() == SCAN_MODE_CONNECTABLE_DISCOVERABLE;
// Is Bluetooth LE scanning and advertising supported?
boolean btLeApi = false, btLeScan = false, btLeAdvertise = false;
if (bt != null && Build.VERSION.SDK_INT >= 21) {
btLeApi = true;
btLeScan = bt.getBluetoothLeScanner() != null;
btLeAdvertise = bt.getBluetoothLeAdvertiser() != null;
}
String btStatus;
if (btAvailable) btStatus = "Available, ";
......@@ -200,6 +214,14 @@ public class BriarReportPrimer implements ReportPrimer {
if (btDiscoverable) btStatus += "discoverable";
else btStatus += "not discoverable";
customData.put("Bluetooth status", btStatus);
if (btLeApi) {
String btLeStatus;
if (btLeScan) btLeStatus = "Scanning, ";
else btLeStatus = "No scanning, ";
if (btLeAdvertise) btLeStatus += "advertising";
else btLeStatus += "no advertising";
customData.put("Bluetooth LE status", btLeStatus);
}
if (bt != null)
customData.put("Bluetooth address",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment