Bluetooth: SAP: Introduce a property to signify the SAP profile status
Introduced a property "bluetooth.sap.status" to convey the SAP
profile status, based on the status init.qcom.rc will start/stop
the sapd which is required for SAP profile to work.
Change-Id: Id3a0df5901bf72b5718c0ea7cba5fb790125a42b
diff --git a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
index 90d4376..f95fa39 100644
--- a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
+++ b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
@@ -45,7 +45,7 @@
import java.util.HashSet;
import java.util.List;
import android.bluetooth.BluetoothAdapter;
-import android.os.SystemService;
+import android.os.SystemProperties;
import android.app.Service;
import android.bluetooth.IBluetooth;
import android.bluetooth.BluetoothServerSocket;
@@ -253,6 +253,11 @@
public static final String EXTRA_BLUETOOTH_DEVICE =
"org.codeaurora.bluetooth.sap.bluetoothdevice";
+ /**
+ * String signifies the SAP profile status
+ */
+ public static final String BLUETOOTH_SAP_PROFILE_STATUS = "bluetooth.sap.status";
+
public static final ParcelUuid SAP = ParcelUuid.fromString(SAP_UUID);
private static final Object mAcceptLock = new Object();
@@ -405,7 +410,7 @@
}
Log.v(TAG, "Starting SAP server process");
- SystemService.start("bt-sap");
+ SystemProperties.set(BLUETOOTH_SAP_PROFILE_STATUS, "running");
mSapHandler.sendMessage(mSapHandler
.obtainMessage(MESSAGE_START_LISTENER));
@@ -422,7 +427,7 @@
if (mSapEnable) {
Log.v(TAG, "Stopping SAP server process");
- SystemService.stop("bt-sap");
+ SystemProperties.set(BLUETOOTH_SAP_PROFILE_STATUS, "stopped");
synchronized(mConnection) {
try {