Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f07259db authored by Sal Savage's avatar Sal Savage
Browse files

Refactor OBEX logging to be unguarded

With the recent addition of a process minimum default log level, the
Android Log framework will now enforce the set log level against the
various log invocations we make in code. We no longer need to guard log
invocations on our own.

Tag: #refactor
Flag: EXEMPT, logging only change
Bug: 315046089
Test: atest BluetoothInstrumentationTests
Change-Id: Ie016a24f62b8df73dac0e2e6281ec626e382ff2e
parent 26253d1c
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import java.io.IOException;
public class ObexRejectServer extends ServerRequestHandler implements Handler.Callback {

    private static final String TAG = "ObexRejectServer";
    private static final boolean V = true;
    private final int mResult;
    private final HandlerThread mHandlerThread;
    private final Handler mMessageHandler;
@@ -64,9 +63,7 @@ public class ObexRejectServer extends ServerRequestHandler implements Handler.Ca
    // OBEX operation handlers
    @Override
    public int onConnect(HeaderSet request, HeaderSet reply) {
        if (V) {
        Log.i(TAG, "onConnect() returning error");
        }
        return mResult;
    }

@@ -83,9 +80,7 @@ public class ObexRejectServer extends ServerRequestHandler implements Handler.Ca

    @Override
    public boolean handleMessage(Message msg) {
        if (V) {
        Log.i(TAG, "Handling message ID: " + msg.what);
        }
        switch (msg.what) {
            case MSG_ID_TIMEOUT:
                shutdown();
+3 −10
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import java.io.IOException;
 */
public class ObexServerSockets {
    private static final String TAG = "ObexServerSockets";
    private static final boolean D = true; // TODO: set this to false!

    private final IObexConnectionHandler mConHandler;
    /* The wrapped sockets */
@@ -108,9 +107,7 @@ public class ObexServerSockets {
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    private static ObexServerSockets create(IObexConnectionHandler validator, int rfcommChannel,
            int l2capPsm, boolean isSecure) {
        if (D) {
        Log.d(TAG, "create(rfcomm = " + rfcommChannel + ", l2capPsm = " + l2capPsm + ")");
        }
        BluetoothAdapter bt = BluetoothAdapter.getDefaultAdapter();
        if (bt == null) {
            throw new RuntimeException("No bluetooth adapter...");
@@ -154,9 +151,7 @@ public class ObexServerSockets {
                    break;
                }
                try {
                    if (D) {
                    Log.v(TAG, "waiting 300 ms...");
                    }
                    Thread.sleep(300);
                } catch (InterruptedException e) {
                    Log.e(TAG, "create() was interrupted");
@@ -167,9 +162,7 @@ public class ObexServerSockets {
        }

        if (initSocketOK) {
            if (D) {
            Log.d(TAG, "Succeed to create listening sockets ");
            }
            ObexServerSockets sockets = new ObexServerSockets(validator, rfcommSocket, l2capSocket);
            sockets.startAccept();
            return sockets;