Loading android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +14 −14 Original line number Diff line number Diff line Loading @@ -186,15 +186,15 @@ public class BluetoothPbapService extends ProfileService { // process the intent from receiver private void parseIntent(final Intent intent) { String action = intent.getStringExtra("action"); String action = intent.getAction(); if (action == null) return; // Nothing to do if (VERBOSE) Log.v(TAG, "action: " + action); int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); if (VERBOSE) Log.v(TAG, "state: " + state); if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) && (state == BluetoothAdapter.STATE_TURNING_OFF)) { if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { if (state == BluetoothAdapter.STATE_TURNING_OFF) { // Send any pending timeout now, as this service will be destroyed. if (mSessionStatusHandler.hasMessages(USER_TIMEOUT)) { mSessionStatusHandler.removeMessages(USER_TIMEOUT); Loading @@ -203,6 +203,10 @@ public class BluetoothPbapService extends ProfileService { // Release all resources closeService(); return; } else if (state == BluetoothAdapter.STATE_ON) { // start RFCOMM listener mSessionStatusHandler.sendMessage(mSessionStatusHandler.obtainMessage(START_LISTENER)); } } if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) && mIsWaitingAuthorization) { Loading Loading @@ -612,8 +616,6 @@ public class BluetoothPbapService extends ProfileService { case START_LISTENER: if (mAdapter.isEnabled()) { startRfcommSocketListener(); } else { closeService();// release all resources } break; case USER_TIMEOUT: Loading Loading @@ -780,8 +782,6 @@ public class BluetoothPbapService extends ProfileService { mInterrupted = false; BluetoothPbapConfig.init(this); mAdapter = BluetoothAdapter.getDefaultAdapter(); // start RFCOMM listener mSessionStatusHandler.sendMessage(mSessionStatusHandler.obtainMessage(START_LISTENER)); return true; } Loading Loading
android/app/src/com/android/bluetooth/pbap/BluetoothPbapService.java +14 −14 Original line number Diff line number Diff line Loading @@ -186,15 +186,15 @@ public class BluetoothPbapService extends ProfileService { // process the intent from receiver private void parseIntent(final Intent intent) { String action = intent.getStringExtra("action"); String action = intent.getAction(); if (action == null) return; // Nothing to do if (VERBOSE) Log.v(TAG, "action: " + action); int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); if (VERBOSE) Log.v(TAG, "state: " + state); if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED) && (state == BluetoothAdapter.STATE_TURNING_OFF)) { if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { if (state == BluetoothAdapter.STATE_TURNING_OFF) { // Send any pending timeout now, as this service will be destroyed. if (mSessionStatusHandler.hasMessages(USER_TIMEOUT)) { mSessionStatusHandler.removeMessages(USER_TIMEOUT); Loading @@ -203,6 +203,10 @@ public class BluetoothPbapService extends ProfileService { // Release all resources closeService(); return; } else if (state == BluetoothAdapter.STATE_ON) { // start RFCOMM listener mSessionStatusHandler.sendMessage(mSessionStatusHandler.obtainMessage(START_LISTENER)); } } if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) && mIsWaitingAuthorization) { Loading Loading @@ -612,8 +616,6 @@ public class BluetoothPbapService extends ProfileService { case START_LISTENER: if (mAdapter.isEnabled()) { startRfcommSocketListener(); } else { closeService();// release all resources } break; case USER_TIMEOUT: Loading Loading @@ -780,8 +782,6 @@ public class BluetoothPbapService extends ProfileService { mInterrupted = false; BluetoothPbapConfig.init(this); mAdapter = BluetoothAdapter.getDefaultAdapter(); // start RFCOMM listener mSessionStatusHandler.sendMessage(mSessionStatusHandler.obtainMessage(START_LISTENER)); return true; } Loading