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

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

Don't return from inside log tag enforced blocks

A few places in our code have return statements guarded by whether or
not DEBUG or VERBOSE logging is enabled. This is very dangerous and
allows for logic to be determined by log level settings. These are
certainly not intended and the return statements should be moved _out_
of the blocks, and be based on the conditions that caused that log.

Tag: #stability
Flag: EXEMPT, logical no-op, as logging flags were defaulted to true
Bug: 319446509
Test: atest HeadsetClientStateMachineTest.java
Test: atest LeAudioServiceTest.java
Change-Id: I2ae4e0a4c8042c7792460358ae98af367a65195a
parent 6144da32
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -1372,12 +1372,10 @@ public class HeadsetClientStateMachine extends StateMachine {
        @Override
        public synchronized boolean processMessage(Message message) {
            logD("Connected process message: " + message.what);
            if (DBG) {
            if (mCurrentDevice == null) {
                Log.e(TAG, "ERROR: mCurrentDevice is null in Connected");
                return NOT_HANDLED;
            }
            }

            switch (message.what) {
                case CONNECT:
@@ -1886,12 +1884,10 @@ public class HeadsetClientStateMachine extends StateMachine {
        @Override
        public synchronized boolean processMessage(Message message) {
            logD("AudioOn process message: " + message.what);
            if (DBG) {
            if (mCurrentDevice == null) {
                Log.e(TAG, "ERROR: mCurrentDevice is null in Connected");
                return NOT_HANDLED;
            }
            }

            switch (message.what) {
                case DISCONNECT:
+2 −2
Original line number Diff line number Diff line
@@ -2195,8 +2195,8 @@ public class LeAudioService extends ProfileService {
        if (mAudioServersScanner == null || mScanCallback == null) {
            if (DBG) {
                Log.d(TAG, "stopAudioServersBackgroundScan: already stopped");
                return;
            }
            return;
        }

        try {
@@ -2230,8 +2230,8 @@ public class LeAudioService extends ProfileService {
            if (mScanCallback != null) {
                if (DBG) {
                    Log.d(TAG, "startAudioServersBackgroundScan: Scanning already enabled");
                    return;
                }
                return;
            }
            mScanCallback = new AudioServerScanCallback();
        }