diff options
-rw-r--r-- | jni/com_android_bluetooth_btservice_AdapterService.cpp | 6 | ||||
-rw-r--r-- | src/com/android/bluetooth/btservice/AdapterService.java | 2 | ||||
-rw-r--r-- | src/com/android/bluetooth/btservice/AdapterState.java | 7 |
3 files changed, 8 insertions, 7 deletions
diff --git a/jni/com_android_bluetooth_btservice_AdapterService.cpp b/jni/com_android_bluetooth_btservice_AdapterService.cpp index cb917976e..f2c767fa5 100644 --- a/jni/com_android_bluetooth_btservice_AdapterService.cpp +++ b/jni/com_android_bluetooth_btservice_AdapterService.cpp @@ -864,13 +864,13 @@ 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) ? JNI_TRUE : JNI_FALSE; return result; } @@ -1354,7 +1354,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 54d883c82..f84409c93 100644 --- a/src/com/android/bluetooth/btservice/AdapterService.java +++ b/src/com/android/bluetooth/btservice/AdapterService.java @@ -2167,7 +2167,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 3469068c4..8127dd807 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; @@ -258,9 +259,9 @@ final class AdapterState extends StateMachine { removeMessages(START_TIMEOUT); //Enable - boolean ret = adapterService.enableNative(); - if (!ret) { - Log.e(TAG, "Error while turning Bluetooth On"); + boolean isGuest = UserManager.get(mAdapterService).isGuestUser(); + if (!adapterService.enableNative(isGuest)) { + Log.e(TAG, "Error while turning Bluetooth on"); notifyAdapterStateChange(BluetoothAdapter.STATE_OFF); transitionTo(mOffState); } else { |