Loading android/app/src/com/android/bluetooth/btservice/AdapterService.java +12 −17 Original line number Diff line number Diff line Loading @@ -94,7 +94,6 @@ import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Base64; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import com.android.bluetooth.BluetoothMetricsProto; Loading Loading @@ -1283,10 +1282,8 @@ public class AdapterService extends Service { PendingIntent pendingIntent, AttributionSource attributionSource) { if (mBluetoothServerSockets.containsKey(uuid.getUuid())) { Slog.d(TAG, String.format( "Cannot start RFCOMM listener: UUID %s already in use.", uuid.getUuid())); Log.d(TAG, String.format( "Cannot start RFCOMM listener: UUID %s already in use.", uuid.getUuid())); return BluetoothStatusCodes.RFCOMM_LISTENER_START_FAILED_UUID_IN_USE; } Loading @@ -1304,10 +1301,8 @@ public class AdapterService extends Service { RfcommListenerData listenerData = mBluetoothServerSockets.get(uuid.getUuid()); if (listenerData == null) { Slog.d(TAG, String.format( "Cannot stop RFCOMM listener: UUID %s is not registered.", uuid.getUuid())); Log.d(TAG, String.format( "Cannot stop RFCOMM listener: UUID %s is not registered.", uuid.getUuid())); return BluetoothStatusCodes.RFCOMM_LISTENER_OPERATION_FAILED_NO_MATCHING_SERVICE_RECORD; } Loading Loading @@ -1346,7 +1341,7 @@ public class AdapterService extends Service { return socketInfo; } mHandler.removeCallbacksAndEqualMessages(socket); mHandler.removeCallbacksAndMessages(socket); socketInfo.bluetoothDevice = socket.getRemoteDevice(); socketInfo.pfd = socket.getParcelFileDescriptor(); Loading @@ -1365,7 +1360,7 @@ public class AdapterService extends Service { if (mBluetoothServerSockets.containsKey(uuid)) { // The uuid still being in the map indicates that the accept failure is // unexpected. Try and restart the listener. Slog.e(TAG, "Failed to accept socket on " + listenerData.mServerSocket, e); Log.e(TAG, "Failed to accept socket on " + listenerData.mServerSocket, e); restartRfcommListener(listenerData, uuid); } return; Loading @@ -1375,7 +1370,7 @@ public class AdapterService extends Service { try { listenerData.mPendingIntent.send(); } catch (PendingIntent.CanceledException e) { Slog.e(TAG, "PendingIntent for RFCOMM socket notifications cancelled.", e); Log.e(TAG, "PendingIntent for RFCOMM socket notifications cancelled.", e); // The pending intent was cancelled, close the server as there is no longer any way // to notify the app that registered the listener. listenerData.closeServerAndPendingSockets(mHandler); Loading @@ -1399,7 +1394,7 @@ public class AdapterService extends Service { listenerData.mPendingIntent, listenerData.mAttributionSource); } catch (IOException e) { Slog.e(TAG, "Failed to recreate rfcomm server socket", e); Log.e(TAG, "Failed to recreate rfcomm server socket", e); mBluetoothServerSockets.remove(uuid); } Loading @@ -1412,7 +1407,7 @@ public class AdapterService extends Service { try { socket.close(); } catch (IOException e) { Slog.e(TAG, "Failed to close bt socket", e); Log.e(TAG, "Failed to close bt socket", e); // We don't care if closing the socket failed, just continue on. } } Loading Loading @@ -1471,16 +1466,16 @@ public class AdapterService extends Service { try { mServerSocket.close(); } catch (IOException e) { Slog.e(TAG, "Failed to call close on rfcomm server socket", e); Log.e(TAG, "Failed to call close on rfcomm server socket", e); result = BluetoothStatusCodes.RFCOMM_LISTENER_FAILED_TO_CLOSE_SERVER_SOCKET; } mPendingSockets.forEach( pendingSocket -> { handler.removeCallbacksAndEqualMessages(pendingSocket); handler.removeCallbacksAndMessages(pendingSocket); try { pendingSocket.close(); } catch (IOException e) { Slog.e(TAG, "Failed to close socket", e); Log.e(TAG, "Failed to close socket", e); } }); mPendingSockets.clear(); Loading android/app/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public class LeAudioBroadcasterNativeInterface { private LeAudioBroadcasterNativeInterface() { mAdapter = BluetoothAdapter.getDefaultAdapter(); if (mAdapter == null) { Log.wtfStack(TAG, "No Bluetooth Adapter Available"); Log.wtf(TAG, "No Bluetooth Adapter Available"); } } Loading Loading
android/app/src/com/android/bluetooth/btservice/AdapterService.java +12 −17 Original line number Diff line number Diff line Loading @@ -94,7 +94,6 @@ import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Base64; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import com.android.bluetooth.BluetoothMetricsProto; Loading Loading @@ -1283,10 +1282,8 @@ public class AdapterService extends Service { PendingIntent pendingIntent, AttributionSource attributionSource) { if (mBluetoothServerSockets.containsKey(uuid.getUuid())) { Slog.d(TAG, String.format( "Cannot start RFCOMM listener: UUID %s already in use.", uuid.getUuid())); Log.d(TAG, String.format( "Cannot start RFCOMM listener: UUID %s already in use.", uuid.getUuid())); return BluetoothStatusCodes.RFCOMM_LISTENER_START_FAILED_UUID_IN_USE; } Loading @@ -1304,10 +1301,8 @@ public class AdapterService extends Service { RfcommListenerData listenerData = mBluetoothServerSockets.get(uuid.getUuid()); if (listenerData == null) { Slog.d(TAG, String.format( "Cannot stop RFCOMM listener: UUID %s is not registered.", uuid.getUuid())); Log.d(TAG, String.format( "Cannot stop RFCOMM listener: UUID %s is not registered.", uuid.getUuid())); return BluetoothStatusCodes.RFCOMM_LISTENER_OPERATION_FAILED_NO_MATCHING_SERVICE_RECORD; } Loading Loading @@ -1346,7 +1341,7 @@ public class AdapterService extends Service { return socketInfo; } mHandler.removeCallbacksAndEqualMessages(socket); mHandler.removeCallbacksAndMessages(socket); socketInfo.bluetoothDevice = socket.getRemoteDevice(); socketInfo.pfd = socket.getParcelFileDescriptor(); Loading @@ -1365,7 +1360,7 @@ public class AdapterService extends Service { if (mBluetoothServerSockets.containsKey(uuid)) { // The uuid still being in the map indicates that the accept failure is // unexpected. Try and restart the listener. Slog.e(TAG, "Failed to accept socket on " + listenerData.mServerSocket, e); Log.e(TAG, "Failed to accept socket on " + listenerData.mServerSocket, e); restartRfcommListener(listenerData, uuid); } return; Loading @@ -1375,7 +1370,7 @@ public class AdapterService extends Service { try { listenerData.mPendingIntent.send(); } catch (PendingIntent.CanceledException e) { Slog.e(TAG, "PendingIntent for RFCOMM socket notifications cancelled.", e); Log.e(TAG, "PendingIntent for RFCOMM socket notifications cancelled.", e); // The pending intent was cancelled, close the server as there is no longer any way // to notify the app that registered the listener. listenerData.closeServerAndPendingSockets(mHandler); Loading @@ -1399,7 +1394,7 @@ public class AdapterService extends Service { listenerData.mPendingIntent, listenerData.mAttributionSource); } catch (IOException e) { Slog.e(TAG, "Failed to recreate rfcomm server socket", e); Log.e(TAG, "Failed to recreate rfcomm server socket", e); mBluetoothServerSockets.remove(uuid); } Loading @@ -1412,7 +1407,7 @@ public class AdapterService extends Service { try { socket.close(); } catch (IOException e) { Slog.e(TAG, "Failed to close bt socket", e); Log.e(TAG, "Failed to close bt socket", e); // We don't care if closing the socket failed, just continue on. } } Loading Loading @@ -1471,16 +1466,16 @@ public class AdapterService extends Service { try { mServerSocket.close(); } catch (IOException e) { Slog.e(TAG, "Failed to call close on rfcomm server socket", e); Log.e(TAG, "Failed to call close on rfcomm server socket", e); result = BluetoothStatusCodes.RFCOMM_LISTENER_FAILED_TO_CLOSE_SERVER_SOCKET; } mPendingSockets.forEach( pendingSocket -> { handler.removeCallbacksAndEqualMessages(pendingSocket); handler.removeCallbacksAndMessages(pendingSocket); try { pendingSocket.close(); } catch (IOException e) { Slog.e(TAG, "Failed to close socket", e); Log.e(TAG, "Failed to close socket", e); } }); mPendingSockets.clear(); Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioBroadcasterNativeInterface.java +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ public class LeAudioBroadcasterNativeInterface { private LeAudioBroadcasterNativeInterface() { mAdapter = BluetoothAdapter.getDefaultAdapter(); if (mAdapter == null) { Log.wtfStack(TAG, "No Bluetooth Adapter Available"); Log.wtf(TAG, "No Bluetooth Adapter Available"); } } Loading