Loading android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -139,6 +139,9 @@ class AdapterProperties { case BluetoothPbapClient.ACTION_CONNECTION_STATE_CHANGED: case BluetoothPbapClient.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.PBAP_CLIENT, intent); sendConnectionStateChange(BluetoothProfile.PBAP_CLIENT, intent); break; break; case BluetoothPbap.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.PBAP, intent); break; default: default: Log.w(TAG, "Received unknown intent " + intent); Log.w(TAG, "Received unknown intent " + intent); break; break; Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +9 −9 Original line number Original line Diff line number Diff line Loading @@ -239,7 +239,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect private BluetoothPbapContentObserver mContactChangeObserver; private BluetoothPbapContentObserver mContactChangeObserver; public BluetoothPbapService() { public BluetoothPbapService() { mState = BluetoothPbap.STATE_DISCONNECTED; mState = BluetoothProfile.STATE_DISCONNECTED; mContext = this; mContext = this; } } Loading Loading @@ -480,7 +480,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect } } BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); mServerSession = new ServerSession(transport, mPbapServer, mAuth); mServerSession = new ServerSession(transport, mPbapServer, mAuth); setState(BluetoothPbap.STATE_CONNECTED); setState(BluetoothProfile.STATE_CONNECTED); mSessionStatusHandler.removeMessages(MSG_RELEASE_WAKE_LOCK); mSessionStatusHandler.removeMessages(MSG_RELEASE_WAKE_LOCK); mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler Loading Loading @@ -512,7 +512,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (mAdapter != null && mAdapter.isEnabled()) { if (mAdapter != null && mAdapter.isEnabled()) { startSocketListeners(); startSocketListeners(); } } setState(BluetoothPbap.STATE_DISCONNECTED); setState(BluetoothProfile.STATE_DISCONNECTED); } } private void notifyAuthKeyInput(final String key) { private void notifyAuthKeyInput(final String key) { Loading Loading @@ -732,7 +732,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect + result); + result); int prevState = mState; int prevState = mState; mState = state; mState = state; Intent intent = new Intent(BluetoothPbap.PBAP_STATE_CHANGED_ACTION); Intent intent = new Intent(BluetoothPbap.ACTION_CONNECTION_STATE_CHANGED); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, mState); intent.putExtra(BluetoothProfile.EXTRA_STATE, mState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); Loading Loading @@ -858,13 +858,13 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect Log.w(TAG, "Unable to unregister pbap receiver", e); Log.w(TAG, "Unable to unregister pbap receiver", e); } } mSessionStatusHandler.obtainMessage(SHUTDOWN).sendToTarget(); mSessionStatusHandler.obtainMessage(SHUTDOWN).sendToTarget(); setState(BluetoothPbap.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); setState(BluetoothProfile.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); return true; return true; } } protected void disconnect() { protected void disconnect() { synchronized (this) { synchronized (this) { if (mState == BluetoothPbap.STATE_CONNECTED) { if (mState == BluetoothProfile.STATE_CONNECTED) { if (mServerSession != null) { if (mServerSession != null) { mServerSession.close(); mServerSession.close(); mServerSession = null; mServerSession = null; Loading @@ -872,7 +872,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect closeConnectionSocket(); closeConnectionSocket(); setState(BluetoothPbap.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); setState(BluetoothProfile.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); } } } } } } Loading Loading @@ -906,7 +906,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect public int getState() { public int getState() { if (DEBUG) Log.d(TAG, "getState = " + mService.getState()); if (DEBUG) Log.d(TAG, "getState = " + mService.getState()); BluetoothPbapService service = getService(BLUETOOTH_PERM); BluetoothPbapService service = getService(BLUETOOTH_PERM); if (service == null) return BluetoothPbap.STATE_DISCONNECTED; if (service == null) return BluetoothProfile.STATE_DISCONNECTED; return service.getState(); return service.getState(); } } Loading @@ -922,7 +922,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (DEBUG) Log.d(TAG, "isConnected " + device); if (DEBUG) Log.d(TAG, "isConnected " + device); BluetoothPbapService service = getService(BLUETOOTH_PERM); BluetoothPbapService service = getService(BLUETOOTH_PERM); if (service == null) return false; if (service == null) return false; return service.getState() == BluetoothPbap.STATE_CONNECTED return service.getState() == BluetoothProfile.STATE_CONNECTED && service.getRemoteDevice().equals(device); && service.getRemoteDevice().equals(device); } } Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterProperties.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -139,6 +139,9 @@ class AdapterProperties { case BluetoothPbapClient.ACTION_CONNECTION_STATE_CHANGED: case BluetoothPbapClient.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.PBAP_CLIENT, intent); sendConnectionStateChange(BluetoothProfile.PBAP_CLIENT, intent); break; break; case BluetoothPbap.ACTION_CONNECTION_STATE_CHANGED: sendConnectionStateChange(BluetoothProfile.PBAP, intent); break; default: default: Log.w(TAG, "Received unknown intent " + intent); Log.w(TAG, "Received unknown intent " + intent); break; break; Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +9 −9 Original line number Original line Diff line number Diff line Loading @@ -239,7 +239,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect private BluetoothPbapContentObserver mContactChangeObserver; private BluetoothPbapContentObserver mContactChangeObserver; public BluetoothPbapService() { public BluetoothPbapService() { mState = BluetoothPbap.STATE_DISCONNECTED; mState = BluetoothProfile.STATE_DISCONNECTED; mContext = this; mContext = this; } } Loading Loading @@ -480,7 +480,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect } } BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); BluetoothObexTransport transport = new BluetoothObexTransport(mConnSocket); mServerSession = new ServerSession(transport, mPbapServer, mAuth); mServerSession = new ServerSession(transport, mPbapServer, mAuth); setState(BluetoothPbap.STATE_CONNECTED); setState(BluetoothProfile.STATE_CONNECTED); mSessionStatusHandler.removeMessages(MSG_RELEASE_WAKE_LOCK); mSessionStatusHandler.removeMessages(MSG_RELEASE_WAKE_LOCK); mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler mSessionStatusHandler.sendMessageDelayed(mSessionStatusHandler Loading Loading @@ -512,7 +512,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (mAdapter != null && mAdapter.isEnabled()) { if (mAdapter != null && mAdapter.isEnabled()) { startSocketListeners(); startSocketListeners(); } } setState(BluetoothPbap.STATE_DISCONNECTED); setState(BluetoothProfile.STATE_DISCONNECTED); } } private void notifyAuthKeyInput(final String key) { private void notifyAuthKeyInput(final String key) { Loading Loading @@ -732,7 +732,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect + result); + result); int prevState = mState; int prevState = mState; mState = state; mState = state; Intent intent = new Intent(BluetoothPbap.PBAP_STATE_CHANGED_ACTION); Intent intent = new Intent(BluetoothPbap.ACTION_CONNECTION_STATE_CHANGED); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_PREVIOUS_STATE, prevState); intent.putExtra(BluetoothProfile.EXTRA_STATE, mState); intent.putExtra(BluetoothProfile.EXTRA_STATE, mState); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice); Loading Loading @@ -858,13 +858,13 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect Log.w(TAG, "Unable to unregister pbap receiver", e); Log.w(TAG, "Unable to unregister pbap receiver", e); } } mSessionStatusHandler.obtainMessage(SHUTDOWN).sendToTarget(); mSessionStatusHandler.obtainMessage(SHUTDOWN).sendToTarget(); setState(BluetoothPbap.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); setState(BluetoothProfile.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); return true; return true; } } protected void disconnect() { protected void disconnect() { synchronized (this) { synchronized (this) { if (mState == BluetoothPbap.STATE_CONNECTED) { if (mState == BluetoothProfile.STATE_CONNECTED) { if (mServerSession != null) { if (mServerSession != null) { mServerSession.close(); mServerSession.close(); mServerSession = null; mServerSession = null; Loading @@ -872,7 +872,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect closeConnectionSocket(); closeConnectionSocket(); setState(BluetoothPbap.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); setState(BluetoothProfile.STATE_DISCONNECTED, BluetoothPbap.RESULT_CANCELED); } } } } } } Loading Loading @@ -906,7 +906,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect public int getState() { public int getState() { if (DEBUG) Log.d(TAG, "getState = " + mService.getState()); if (DEBUG) Log.d(TAG, "getState = " + mService.getState()); BluetoothPbapService service = getService(BLUETOOTH_PERM); BluetoothPbapService service = getService(BLUETOOTH_PERM); if (service == null) return BluetoothPbap.STATE_DISCONNECTED; if (service == null) return BluetoothProfile.STATE_DISCONNECTED; return service.getState(); return service.getState(); } } Loading @@ -922,7 +922,7 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect if (DEBUG) Log.d(TAG, "isConnected " + device); if (DEBUG) Log.d(TAG, "isConnected " + device); BluetoothPbapService service = getService(BLUETOOTH_PERM); BluetoothPbapService service = getService(BLUETOOTH_PERM); if (service == null) return false; if (service == null) return false; return service.getState() == BluetoothPbap.STATE_CONNECTED return service.getState() == BluetoothProfile.STATE_CONNECTED && service.getRemoteDevice().equals(device); && service.getRemoteDevice().equals(device); } } Loading