2013-04-16 2 views
5

코드 수정없이 Android SDK 4.2 샘플 팩에서 Bluetooth Chat 샘플을 실행 중입니다. 내 타겟은 Android 4.2.2를 실행하는 Nexus 7입니다. 페어링 된 장치에 보안 연결을 시도하는 즉시 이러한 오류가 발생합니다. Insecure 연결도 실패하므로 비슷한 오류가 발생합니다. 때때로 BT를 다시 시작하면 연결이 성공합니다.Bluetooth Secureaccept() 실패, Nexus 7, Android 4.2.2

나는 이것을 연구했고 안드로이드 4에서 BT probs에 대한 많은 참고 자료를 보았지만 다음 4.2 릴리스에서 수정되었다고 생각했다. Nexus 7이 유일한 기기이기 때문에 다른 기기에서 Nexus 7이 발생하는지 궁금합니다.

이 문제의 해결 방법이 있습니까? 모든 안내에 미리 감사드립니다!

업데이트 : 추가 조사 후 BT 리소스 스택에 누수가 있음을 나타내는 this link이 발견되었습니다. 아직 수동으로 중지/다시 시작하여 해결할 수있는 4.2.2에 있습니다. 누구든지 프로그래밍 방식의 해결 방법을 찾았습니까?

04-16 08:50:48.505: E/BluetoothChat(28905): +++ ON CREATE +++ 
04-16 08:50:48.535: E/BluetoothChat(28905): ++ ON START ++ 
04-16 08:50:48.535: D/BluetoothChat(28905): setupChat() 
04-16 08:50:48.535: E/BluetoothChat(28905): + ON RESUME + 
04-16 08:50:48.535: D/BluetoothChatService(28905): start 
04-16 08:50:48.535: D/BluetoothChatService(28905): setState() 0 -> 1 
04-16 08:50:48.545: W/BluetoothAdapter(28905): getBluetoothService() called with no BluetoothManagerCallback 
04-16 08:50:48.545: D/BluetoothChatService(28905): Socket Type: SecureBEGIN mAcceptThreadThread[Thread-9834,5,main] 
04-16 08:50:48.545: W/BluetoothAdapter(28905): getBluetoothService() called with no BluetoothManagerCallback 
04-16 08:50:48.545: D/BluetoothChatService(28905): Socket Type: InsecureBEGIN mAcceptThreadThread[Thread-9835,5,main] 
04-16 08:50:48.555: I/BluetoothChat(28905): MESSAGE_STATE_CHANGE: 1 
04-16 08:50:48.615: D/libEGL(28905): loaded /system/lib/egl/libEGL_tegra.so 
04-16 08:50:48.635: D/libEGL(28905): loaded /system/lib/egl/libGLESv1_CM_tegra.so 
04-16 08:50:48.645: D/libEGL(28905): loaded /system/lib/egl/libGLESv2_tegra.so 
04-16 08:50:48.675: D/OpenGLRenderer(28905): Enabling debug mode 0 
04-16 08:52:08.625: E/BluetoothChat(28905): - ON PAUSE - 
04-16 08:52:08.755: D/dalvikvm(28905): GC_CONCURRENT freed 134K, 4% free 7529K/7792K, paused 3ms+3ms, total 29ms 
04-16 08:52:10.115: D/BluetoothChat(28905): onActivityResult -1 
04-16 08:52:10.115: D/BluetoothChatService(28905): connect to: C8:D1:5E:2F:12:E8 
04-16 08:52:10.115: D/BluetoothChatService(28905): setState() 1 -> 2 
04-16 08:52:10.115: I/BluetoothChatService(28905): BEGIN mConnectThread SocketType:Secure 
04-16 08:52:10.115: E/BluetoothChat(28905): + ON RESUME + 
04-16 08:52:10.125: W/BluetoothAdapter(28905): getBluetoothService() called with no BluetoothManagerCallback 
04-16 08:52:10.125: D/BluetoothSocket(28905): connect(), SocketState: INIT, mPfd: {ParcelFileDescriptor: FileDescriptor[54]} 
04-16 08:52:10.135: I/BluetoothChat(28905): MESSAGE_STATE_CHANGE: 2 
04-16 08:52:11.645: D/BluetoothChatService(28905): connected, Socket Type:Secure 
04-16 08:52:11.645: D/BluetoothChatService(28905): Socket TypeSecurecancel Thread[AcceptThreadSecure,5,main] 
04-16 08:52:11.645: D/BluetoothChatService(28905): Socket TypeInsecurecancel Thread[AcceptThreadInsecure,5,main] 
04-16 08:52:11.645: D/BluetoothChatService(28905): create ConnectedThread: Secure 
04-16 08:52:11.655: E/BluetoothChatService(28905): Socket Type: Insecureaccept() failed 
04-16 08:52:11.655: E/BluetoothChatService(28905): java.io.IOException: read failed, socket might closed or timeout, read ret: -1 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:492) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:469) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothSocket.accept(BluetoothSocket.java:393) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:131) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:117) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at com.example.android.BluetoothChat.BluetoothChatService$AcceptThread.run(BluetoothChatService.java:301) 
04-16 08:52:11.655: D/BluetoothChatService(28905): setState() 2 -> 3 
04-16 08:52:11.655: I/BluetoothChatService(28905): END mAcceptThread, socket Type: Insecure 
04-16 08:52:11.655: E/BluetoothChatService(28905): Socket Type: Secureaccept() failed 
04-16 08:52:11.655: E/BluetoothChatService(28905): java.io.IOException: read failed, socket might closed or timeout, read ret: -1 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:492) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothSocket.waitSocketSignal(BluetoothSocket.java:469) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothSocket.accept(BluetoothSocket.java:393) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:131) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at android.bluetooth.BluetoothServerSocket.accept(BluetoothServerSocket.java:117) 
04-16 08:52:11.655: E/BluetoothChatService(28905): at com.example.android.BluetoothChat.BluetoothChatService$AcceptThread.run(BluetoothChatService.java:301) 
04-16 08:52:11.655: I/BluetoothChatService(28905): END mAcceptThread, socket Type: Secure 
04-16 08:52:11.655: I/BluetoothChatService(28905): BEGIN mConnectedThread 
04-16 08:52:11.665: I/BluetoothChat(28905): MESSAGE_STATE_CHANGE: 3 
04-16 08:52:36.985: E/BluetoothChat(28905): - ON PAUSE - 
04-16 08:52:37.005: E/BluetoothChat(28905): -- ON STOP -- 
04-16 08:52:37.015: D/BluetoothChatService(28905): stop 
04-16 08:52:37.015: E/BluetoothChatService(28905): disconnected 
04-16 08:52:37.015: E/BluetoothChatService(28905): java.io.IOException: bt socket closed, read return: -1 
04-16 08:52:37.015: E/BluetoothChatService(28905): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:416) 
04-16 08:52:37.015: E/BluetoothChatService(28905): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96) 
04-16 08:52:37.015: E/BluetoothChatService(28905): at java.io.InputStream.read(InputStream.java:163) 
04-16 08:52:37.015: E/BluetoothChatService(28905): at com.example.android.BluetoothChat.BluetoothChatService$ConnectedThread.run(BluetoothChatService.java:454) 
04-16 08:52:37.015: D/BluetoothChatService(28905): setState() 3 -> 0 
04-16 08:52:37.015: E/BluetoothChat(28905): --- ON DESTROY --- 
04-16 08:52:37.015: D/BluetoothChatService(28905): start 
04-16 08:52:37.015: D/BluetoothChatService(28905): setState() 0 -> 1 
04-16 08:52:37.025: W/BluetoothAdapter(28905): getBluetoothService() called with no BluetoothManagerCallback 
04-16 08:52:37.045: D/BluetoothChatService(28905): Socket Type: SecureBEGIN mAcceptThreadThread[Thread-9842,5,main] 
04-16 08:52:37.115: W/BluetoothAdapter(28905): getBluetoothService() called with no BluetoothManagerCallback 
04-16 08:52:37.125: E/BluetoothChat(28905): +++ ON CREATE +++ 
04-16 08:52:37.125: D/BluetoothChatService(28905): start 
04-16 08:52:37.125: D/BluetoothChatService(28905): setState() 1 -> 1 
04-16 08:52:37.125: D/BluetoothChatService(28905): Socket Type: InsecureBEGIN mAcceptThreadThread[Thread-9843,5,main] 
04-16 08:52:37.155: E/BluetoothChat(28905): ++ ON START ++ 
04-16 08:52:37.155: D/BluetoothChat(28905): setupChat() 
04-16 08:52:37.155: E/BluetoothChat(28905): + ON RESUME + 
04-16 08:52:37.155: D/BluetoothChatService(28905): start 
04-16 08:52:37.155: D/BluetoothChatService(28905): setState() 0 -> 1 
04-16 08:52:37.165: W/BluetoothAdapter(28905): getBluetoothService() called with no BluetoothManagerCallback 
04-16 08:52:37.165: W/BluetoothAdapter(28905): getBluetoothService() called with no BluetoothManagerCallback 
04-16 08:52:37.165: D/BluetoothChatService(28905): Socket Type: SecureBEGIN mAcceptThreadThread[Thread-9844,5,main] 
04-16 08:52:37.175: D/BluetoothChatService(28905): Socket Type: InsecureBEGIN mAcceptThreadThread[Thread-9845,5,main] 
04-16 08:52:37.215: I/BluetoothChat(28905): MESSAGE_STATE_CHANGE: 0 
04-16 08:52:37.215: I/BluetoothChat(28905): MESSAGE_STATE_CHANGE: 1 
04-16 08:52:37.225: I/BluetoothChat(28905): MESSAGE_STATE_CHANGE: 1 
04-16 08:52:37.225: I/BluetoothChat(28905): MESSAGE_STATE_CHANGE: 1 

답변

2

내 질문을 확인하십시오. android bluetooth can't connect

코드 자체가 아니라 Android 자체에 문제가있는 것 같습니다.

+1

android 4.3은 아직 수정되지 않았습니다. –