summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/btservice
diff options
context:
space:
mode:
authorSrinu Jella <sjella@codeaurora.org>2013-10-21 11:12:24 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:25:39 -0600
commit3a94fa0de7e0cace5b8ded0a8a439ec4479fa7dd (patch)
treec40125e7aa02ea1c652e94669137f9571cee8165 /src/com/android/bluetooth/btservice
parent5e7a10563cd2f7f5a92a2343d91ec88641577dc3 (diff)
downloadandroid_packages_apps_Bluetooth-3a94fa0de7e0cace5b8ded0a8a439ec4479fa7dd.tar.gz
android_packages_apps_Bluetooth-3a94fa0de7e0cace5b8ded0a8a439ec4479fa7dd.tar.bz2
android_packages_apps_Bluetooth-3a94fa0de7e0cace5b8ded0a8a439ec4479fa7dd.zip
Socket: Add Get/Set socket option to the Blueooth Socket (4/4)
Add Get/Set socket option for the Bluetooth socket.These APIs will be called from the frameworks CRs-Fixed: 557180 Change-Id: I5ceef23d49e382089f479e8d618eec1dbc6ed5fb
Diffstat (limited to 'src/com/android/bluetooth/btservice')
-rw-r--r--src/com/android/bluetooth/btservice/AdapterService.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java
index 1c3e2b5b9..94a590dff 100644
--- a/src/com/android/bluetooth/btservice/AdapterService.java
+++ b/src/com/android/bluetooth/btservice/AdapterService.java
@@ -1252,6 +1252,29 @@ public class AdapterService extends Service {
return service.sdpSearch(device,uuid);
}
+ public int setSocketOpt(int type, int channel, int optionName, byte [] optionVal,
+ int optionLen) {
+ if (!Utils.checkCaller()) {
+ Log.w(TAG,"setSocketOpt(): not allowed for non-active user");
+ return -1;
+ }
+
+ AdapterService service = getService();
+ if (service == null) return -1;
+ return service.setSocketOpt(type, channel, optionName, optionVal, optionLen);
+ }
+
+ public int getSocketOpt(int type, int channel, int optionName, byte [] optionVal) {
+ if (!Utils.checkCaller()) {
+ Log.w(TAG,"getSocketOpt(): not allowed for non-active user");
+ return -1;
+ }
+
+ AdapterService service = getService();
+ if (service == null) return -1;
+ return service.getSocketOpt(type, channel, optionName, optionVal);
+ }
+
public boolean configHciSnoopLog(boolean enable) {
if (Binder.getCallingUid() != Process.SYSTEM_UID) {
EventLog.writeEvent(0x534e4554 /* SNET */, "Bluetooth", Binder.getCallingUid(),
@@ -2002,6 +2025,19 @@ public class AdapterService extends Service {
return ParcelFileDescriptor.adoptFd(fd);
}
+ int setSocketOpt(int type, int channel, int optionName, byte [] optionVal,
+ int optionLen) {
+ enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+
+ return setSocketOptNative(type, channel, optionName, optionVal, optionLen);
+ }
+
+ int getSocketOpt(int type, int channel, int optionName, byte [] optionVal) {
+ enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
+
+ return getSocketOptNative(type, channel, optionName, optionVal);
+ }
+
boolean configHciSnoopLog(boolean enable) {
enforceCallingOrSelfPermission(BLUETOOTH_PERM, "Need BLUETOOTH permission");
return configHciSnoopLogNative(enable);
@@ -2323,6 +2359,12 @@ public class AdapterService extends Service {
private native int createSocketChannelNative(int type, String serviceName,
byte[] uuid, int port, int flag);
+ private native int setSocketOptNative(int fd, int type, int optionName,
+ byte [] optionVal, int optionLen);
+
+ private native int getSocketOptNative(int fd, int type, int optionName,
+ byte [] optionVal);
+
/*package*/ native boolean configHciSnoopLogNative(boolean enable);
/*package*/ native boolean factoryResetNative();