question: public boolean tasks ( ) { log . info ( "Starting BluetoothSpeaker tasks." ) ; log . info ( "mServerSocket:" + ( mServerSocket == null ) + " mBluetoothAdapter:" + ( mBluetoothAdapter != null ) + " mConnectionAcceptingThread:" + ( mBluetoothAdapter != null ) ) ; if ( mServerSocket == null && mBluetoothAdapter != null && mBluetoothAdapter . isEnabled ( ) && ( mConnectionAcceptingThread == null || ! mConnectionAcceptingThread . isAlive ( ) ) ) { try { log . info ( "No ServerSocket, creating a new one." ) ; createListeningSocket ( ) ; spawnConnectionAcceptingThread ( ) ; } catch ( IOException e ) { log . error ( "Tasks: failed to create listening BT server socket. " , e ) ; log . error ( "Can't receive incoming connections." ) ; return false ; } } if ( mBluetoothAdapter == null || ! mBluetoothAdapter . isEnabled ( ) ) { log . info ( "bluetooth tasks failed, bluetooth disabled" ) ; return false ; } log . info ( "finished BluetoothSpeaker tasks." ) ; return true ; }
target:  Called periodically by the background tasks method of the murmur Service. Recreates the listening socket and thread if they're not active. The listening thread might be inactive if Bluetooth was turned off previously. return true if state allow for proper bluetooth handling or false if process should be terminated