summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJessica Wagantall <jwagantall@cyngn.com>2016-07-07 12:15:20 -0700
committerJessica Wagantall <jwagantall@cyngn.com>2016-07-07 14:15:53 -0700
commit80bd5e6284f38e7e2ccdf8cb43481f627cbfdf10 (patch)
tree0790321fd46d1bcb68deeed634becac8bd34f152
parent4924f5960eeb7c8333d2050b8196e96355055c07 (diff)
parent122feb9a0b04290f55183ff2f0384c6c53756bd8 (diff)
downloadandroid_packages_apps_Bluetooth-80bd5e6284f38e7e2ccdf8cb43481f627cbfdf10.tar.gz
android_packages_apps_Bluetooth-80bd5e6284f38e7e2ccdf8cb43481f627cbfdf10.tar.bz2
android_packages_apps_Bluetooth-80bd5e6284f38e7e2ccdf8cb43481f627cbfdf10.zip
Merge remote-tracking branch 'remotes/android-6.0.1_r52' into HEAD
Ticket: CYNGNOS-3020 Change-Id: Icb958f1b291af724f6ea2fc43b53321df67f3212
-rw-r--r--jni/com_android_bluetooth_btservice_AdapterService.cpp7
-rw-r--r--src/com/android/bluetooth/btservice/AdapterService.java2
-rw-r--r--src/com/android/bluetooth/btservice/AdapterState.java4
3 files changed, 7 insertions, 6 deletions
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp
index 88a6fe5e4..a6ffd193c 100644
--- a/jni/com_android_bluetooth_btservice_AdapterService.cpp
+++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp
@@ -770,13 +770,12 @@ static bool ssrcleanupNative(JNIEnv *env, jobject obj, jboolean cleanup) {
return JNI_TRUE;
}
-static jboolean enableNative(JNIEnv* env, jobject obj) {
+static jboolean enableNative(JNIEnv* env, jobject obj, jboolean isGuest) {
ALOGV("%s:",__FUNCTION__);
jboolean result = JNI_FALSE;
if (!sBluetoothInterface) return result;
-
- int ret = sBluetoothInterface->enable();
+ int ret = sBluetoothInterface->enable(isGuest == JNI_TRUE ? 1 : 0);
result = (ret == BT_STATUS_SUCCESS || ret == BT_STATUS_DONE) ? JNI_TRUE : JNI_FALSE;
return result;
}
@@ -1286,7 +1285,7 @@ static JNINativeMethod sMethods[] = {
{"initNative", "()Z", (void *) initNative},
{"cleanupNative", "()V", (void*) cleanupNative},
{"ssrcleanupNative", "(Z)V", (void*) ssrcleanupNative},
- {"enableNative", "()Z", (void*) enableNative},
+ {"enableNative", "(Z)Z", (void*) enableNative},
{"disableNative", "()Z", (void*) disableNative},
{"setAdapterPropertyNative", "(I[B)Z", (void*) setAdapterPropertyNative},
{"getAdapterPropertiesNative", "()Z", (void*) getAdapterPropertiesNative},
diff --git a/src/com/android/bluetooth/btservice/AdapterService.java b/src/com/android/bluetooth/btservice/AdapterService.java
index ba597c3e4..86b3cecac 100644
--- a/src/com/android/bluetooth/btservice/AdapterService.java
+++ b/src/com/android/bluetooth/btservice/AdapterService.java
@@ -2537,7 +2537,7 @@ public class AdapterService extends Service {
private native boolean initNative();
private native void cleanupNative();
/*package*/ native void ssrcleanupNative(boolean cleanup);
- /*package*/ native boolean enableNative();
+ /*package*/ native boolean enableNative(boolean startRestricted);
/*package*/ native boolean disableNative();
/*package*/ native boolean setAdapterPropertyNative(int type, byte[] val);
/*package*/ native boolean getAdapterPropertiesNative();
diff --git a/src/com/android/bluetooth/btservice/AdapterState.java b/src/com/android/bluetooth/btservice/AdapterState.java
index 54ecbe2c7..26c2821f9 100644
--- a/src/com/android/bluetooth/btservice/AdapterState.java
+++ b/src/com/android/bluetooth/btservice/AdapterState.java
@@ -20,6 +20,7 @@ import android.bluetooth.BluetoothAdapter;
import android.content.Context;
import android.content.Intent;
import android.os.Message;
+import android.os.UserManager;
import android.util.Log;
import com.android.internal.util.State;
@@ -360,7 +361,8 @@ final class AdapterState extends StateMachine {
removeMessages(BLE_START_TIMEOUT);
//Enable
- if (!adapterService.enableNative()) {
+ boolean isGuest = UserManager.get(mAdapterService).isGuestUser();
+ if (!adapterService.enableNative(isGuest)) {
errorLog("Error while turning Bluetooth on");
notifyAdapterStateChange(BluetoothAdapter.STATE_OFF);
transitionTo(mOffState);