From 81a472014a3b4b640134e19808899491797496f6 Mon Sep 17 00:00:00 2001 From: Patrick Rohr Date: Thu, 11 Sep 2025 11:47:56 -0700 Subject: [PATCH] Reduce log level for BluetoothSocket errors This exception is also logged when the other side disconnects gracefully (because there is no way to distinguish this case using the Bluetooth APIs). This change reduces the log level to a warning because it is almost always a red herring. Test: TH Flag: NONE yes Change-Id: I94f20be91ff8481fdd1a50fbbc27200c57885426 --- service/src/com/android/server/net/L2capPacketForwarder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service/src/com/android/server/net/L2capPacketForwarder.java b/service/src/com/android/server/net/L2capPacketForwarder.java index a2a04b16d1..d6072d3ae2 100644 --- a/service/src/com/android/server/net/L2capPacketForwarder.java +++ b/service/src/com/android/server/net/L2capPacketForwarder.java @@ -227,7 +227,10 @@ public class L2capPacketForwarder { mWriteFd.write(mBuffer, 0 /*off*/, readBytes); } catch (IOException|BufferUnderflowException e) { - Log.e(mLogTag, "L2capThread exception", e); + // This exception almost always indicates that the other side disconnected. + // Unfortunately, there is no way to distinguish between an EOF triggered by + // some disconnect or some actual error. + Log.w(mLogTag, "L2capThread exception", e); // Tear down the network on any error. mIsRunning = false; // Notify provider that forwarding has stopped.