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

Commit 946b94aa authored by Sal Savage's avatar Sal Savage
Browse files

Don't check against log enforcement variables when event logging

The native calls that the Java Log framework relies on will do this
checking for us now that we have a process minimum set.

Tag: #refactor
Bug: 315046089
Flag: EXEMPT, logging only change
Test: atest BassClientServiceTest.Java
Test: atest TbsGattTest.java
Test: atest MediaControlProfileTest.java
Test: atest MediaControlGattServiceTest.java
Test: atest MediaPlayerListTest.java
Test: atest MediaPlayerWrapperTest.java
Test: atest AvrcpVolumeManagerTest.java
Change-Id: Ifead6790e3395429906f34cd721282e93b0d848a
parent 036e3ffc
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -60,16 +60,9 @@ public class BluetoothEventLogger {

    /** Add the event record and log debug message */
    public synchronized void logd(String tag, String msg) {
        logd(true, tag, msg);
    }

    /** Add the event record and log debug message */
    public synchronized void logd(boolean debug, String tag, String msg) {
        add(msg);
        if (debug) {
        Log.d(tag, msg);
    }
    }

    /** Add the event record and log warning message */
    public synchronized void logw(String tag, String msg) {
+2 −2
Original line number Diff line number Diff line
@@ -842,11 +842,11 @@ public class MediaPlayerList {
                }
            }
            if (isActive != mAudioPlaybackIsActive) {
                mAudioPlaybackStateLogger.logd(DEBUG, TAG, "onPlaybackConfigChanged: "
                mAudioPlaybackStateLogger.logd(TAG, "onPlaybackConfigChanged: "
                        + (mAudioPlaybackIsActive ? "Active" : "Non-active") + " -> "
                        + (isActive ? "Active" : "Non-active"));
                if (isActive) {
                    mAudioPlaybackStateLogger.logd(DEBUG, TAG, "onPlaybackConfigChanged: "
                    mAudioPlaybackStateLogger.logd(TAG, "onPlaybackConfigChanged: "
                            + "active config: " + activeConfig);
                }
                mAudioPlaybackIsActive = isActive;
+0 −1
Original line number Diff line number Diff line
@@ -457,7 +457,6 @@ public class AvrcpTargetService extends ProfileService {
        BluetoothDevice activeDevice = getA2dpActiveDevice();
        MediaPlayerWrapper player = mMediaPlayerList.getActivePlayer();
        mMediaKeyEventLogger.logd(
                DEBUG,
                TAG,
                "sendMediaKeyEvent:"
                        + " device="
+2 −2
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ class AvrcpVolumeManager extends AudioDeviceCallback {

    void setVolume(@NonNull BluetoothDevice device, int avrcpVolume) {
        int deviceVolume = avrcpToSystemVolume(avrcpVolume);
        mVolumeEventLogger.logd(DEBUG, TAG, "setVolume:"
        mVolumeEventLogger.logd(TAG, "setVolume:"
                        + " device=" + device
                        + " avrcpVolume=" + avrcpVolume
                        + " deviceVolume=" + deviceVolume
@@ -196,7 +196,7 @@ class AvrcpVolumeManager extends AudioDeviceCallback {
            return;
        }
        int avrcpVolume = systemToAvrcpVolume(deviceVolume);
        mVolumeEventLogger.logd(DEBUG, TAG, "sendVolumeChanged:"
        mVolumeEventLogger.logd(TAG, "sendVolumeChanged:"
                        + " device=" + device
                        + " avrcpVolume=" + avrcpVolume
                        + " deviceVolume=" + deviceVolume
+19 −29
Original line number Diff line number Diff line
@@ -336,7 +336,7 @@ public class BassClientService extends ProfileService {
                }
            }
        }
        sEventLogger.logd(DBG, TAG, "Broadcast Source Unsynced: scanDelegator= " + scanDelegator
        sEventLogger.logd(TAG, "Broadcast Source Unsynced: scanDelegator= " + scanDelegator
                + ", syncHandle= " + syncHandle);
    }

@@ -354,7 +354,7 @@ public class BassClientService extends ProfileService {
                mActiveSourceMap.get(scanDelegator).add(syncHandle);
            }
        }
        sEventLogger.logd(DBG, TAG, "Broadcast Source Synced: scanDelegator= " + scanDelegator
        sEventLogger.logd(TAG, "Broadcast Source Synced: scanDelegator= " + scanDelegator
                + ", syncHandle= " + syncHandle);
    }

@@ -895,7 +895,7 @@ public class BassClientService extends ProfileService {
                return;
            }

            sEventLogger.logd(DBG, TAG, "Broadcast timeout: " + mBroadcastId);
            sEventLogger.logd(TAG, "Broadcast timeout: " + mBroadcastId);
            mLocalBroadcastReceivers.remove(mBroadcastId);
            leAudioService.stopBroadcast(mBroadcastId);
        }
@@ -983,7 +983,6 @@ public class BassClientService extends ProfileService {
        }

        sEventLogger.logd(
                DBG,
                TAG,
                "connectionStateChanged: fromState= "
                        + BluetoothProfile.getConnectionStateName(fromState)
@@ -1298,7 +1297,7 @@ public class BassClientService extends ProfileService {
                            | ((broadcastIdArray[1] & 0xff) << 8)
                            | (broadcastIdArray[0] & 0xff));

                    sEventLogger.logd(DBG, TAG, "Broadcast Source Found: Broadcast ID: "
                    sEventLogger.logd(TAG, "Broadcast Source Found: Broadcast ID: "
                            + broadcastId);

                    if (broadcastId != BassConstants.INVALID_BROADCAST_ID
@@ -1343,7 +1342,7 @@ public class BassClientService extends ProfileService {
                                serviceData, serviceDataMask).build());
            }
            scanner.startScan(filters, settings, mSearchScanCallback);
            sEventLogger.logd(DBG, TAG, "startSearchingForSources");
            sEventLogger.logd(TAG, "startSearchingForSources");
            mCallbacks.notifySearchStarted(BluetoothStatusCodes.REASON_LOCAL_APP_REQUEST);
        }
    }
@@ -1371,7 +1370,7 @@ public class BassClientService extends ProfileService {
            }
            scanner.stopScan(mSearchScanCallback);
            mSearchScanCallback = null;
            sEventLogger.logd(DBG, TAG, "stopSearchingForSources");
            sEventLogger.logd(TAG, "stopSearchingForSources");
            mCallbacks.notifySearchStopped(BluetoothStatusCodes.REASON_LOCAL_APP_REQUEST);
        }
    }
@@ -1402,7 +1401,7 @@ public class BassClientService extends ProfileService {
        }

        synchronized (mStateMachines) {
            sEventLogger.logd(DBG, TAG, "Select Broadcast Source");
            sEventLogger.logd(TAG, "Select Broadcast Source");

            BassClientStateMachine stateMachine = getOrCreateStateMachine(sink);
            Message message = stateMachine.obtainMessage(
@@ -1474,7 +1473,6 @@ public class BassClientService extends ProfileService {
                Integer sourceId = getSourceIdToRemove(device);
                if (sourceId != BassConstants.INVALID_SOURCE_ID) {
                    sEventLogger.logd(
                            DBG,
                            TAG,
                            "Switch Broadcast Source: device: "
                                    + device
@@ -1534,7 +1532,6 @@ public class BassClientService extends ProfileService {
            }

            sEventLogger.logd(
                    DBG,
                    TAG,
                    "Add Broadcast Source: device: "
                            + device
@@ -1547,7 +1544,7 @@ public class BassClientService extends ProfileService {
            message.obj = sourceMetadata;
            stateMachine.sendMessage(message);
            if (code != null && code.length != 0) {
                sEventLogger.logd(DBG, TAG, "Set Broadcast Code (Add Source context)");
                sEventLogger.logd(TAG, "Set Broadcast Code (Add Source context)");

                message = stateMachine.obtainMessage(BassClientStateMachine.SET_BCAST_CODE);
                message.obj = sourceMetadata;
@@ -1619,7 +1616,6 @@ public class BassClientService extends ProfileService {
            }

            sEventLogger.logd(
                    DBG,
                    TAG,
                    "Modify Broadcast Source: device: "
                            + device
@@ -1635,7 +1631,7 @@ public class BassClientService extends ProfileService {
            message.obj = updatedMetadata;
            stateMachine.sendMessage(message);
            if (code != null && code.length != 0) {
                sEventLogger.logd(DBG, TAG, "Set Broadcast Code (Modify Source context)");
                sEventLogger.logd(TAG, "Set Broadcast Code (Modify Source context)");
                message = stateMachine.obtainMessage(BassClientStateMachine.SET_BCAST_CODE);
                message.obj = updatedMetadata;
                message.arg1 = BassClientStateMachine.ARGTYPE_METADATA;
@@ -1688,7 +1684,6 @@ public class BassClientService extends ProfileService {
                    stateMachine.getCurrentBroadcastMetadata(sourceId);
            if (metaData != null && stateMachine.isSyncedToTheSource(sourceId)) {
                sEventLogger.logd(
                        DBG,
                        TAG,
                        "Remove Broadcast Source(Force lost PA sync): device: "
                                + device
@@ -1708,7 +1703,6 @@ public class BassClientService extends ProfileService {
            }

            sEventLogger.logd(
                    DBG,
                    TAG,
                    "Remove Broadcast Source: device: " + device + ", sourceId: " + sourceId);

@@ -1813,7 +1807,7 @@ public class BassClientService extends ProfileService {

        if (store && !mPausedBroadcastSinks.isEmpty()) {
            Log.w(TAG, "stopSourceReceivers(), paused broadcast sinks are replaced");
            sEventLogger.logd(DBG, TAG, "Clear broadcast sinks paused cache");
            sEventLogger.logd(TAG, "Clear broadcast sinks paused cache");
            mPausedBroadcastSinks.clear();
        }

@@ -1830,7 +1824,7 @@ public class BassClientService extends ProfileService {
                }

                if (store && !mPausedBroadcastSinks.contains(device)) {
                    sEventLogger.logd(DBG, TAG, "Add broadcast sink to paused cache: " + device);
                    sEventLogger.logd(TAG, "Add broadcast sink to paused cache: " + device);
                    mPausedBroadcastSinks.add(device);
                }

@@ -1993,29 +1987,29 @@ public class BassClientService extends ProfileService {

    /** Request receivers to suspend broadcast sources synchronization */
    public void suspendReceiversSourceSynchronization(int broadcastId) {
        sEventLogger.logd(DBG, TAG, "Suspend receivers source synchronization: " + broadcastId);
        sEventLogger.logd(TAG, "Suspend receivers source synchronization: " + broadcastId);
        stopSourceReceivers(broadcastId, true);
    }

    /** Request all receivers to suspend broadcast sources synchronization */
    public void suspendAllReceiversSourceSynchronization() {
        sEventLogger.logd(DBG, TAG, "Suspend all receivers source synchronization");
        sEventLogger.logd(TAG, "Suspend all receivers source synchronization");
        stopSourceReceivers(BassConstants.INVALID_BROADCAST_ID, true);
    }

    /** Request receivers to stop broadcast sources synchronization and remove them */
    public void stopReceiversSourceSynchronization(int broadcastId) {
        sEventLogger.logd(DBG, TAG, "Stop receivers source synchronization: " + broadcastId);
        sEventLogger.logd(TAG, "Stop receivers source synchronization: " + broadcastId);
        stopSourceReceivers(broadcastId, false);
    }

    /** Request receivers to resume broadcast source synchronization */
    public void resumeReceiversSourceSynchronization() {
        sEventLogger.logd(DBG, TAG, "Resume receivers source synchronization");
        sEventLogger.logd(TAG, "Resume receivers source synchronization");

        while (!mPausedBroadcastSinks.isEmpty()) {
            BluetoothDevice sink = mPausedBroadcastSinks.remove();
            sEventLogger.logd(DBG, TAG, "Remove broadcast sink from paused cache: " + sink);
            sEventLogger.logd(TAG, "Remove broadcast sink from paused cache: " + sink);
            BluetoothLeBroadcastMetadata metadata = mBroadcastMetadataMap.get(sink);

            if (metadata != null) {
@@ -2062,7 +2056,7 @@ public class BassClientService extends ProfileService {
                }

                if (mLocalBroadcastReceivers.remove(broadcastId) != null) {
                    sEventLogger.logd(DBG, TAG, "Broadcast ID: " + broadcastId + ", stopped");
                    sEventLogger.logd(TAG, "Broadcast ID: " + broadcastId + ", stopped");
                }
                break;
            case BROADCAST_STATE_CONFIGURING:
@@ -2226,7 +2220,7 @@ public class BassClientService extends ProfileService {
        }

        void notifySearchStarted(int reason) {
            sEventLogger.logd(DBG, TAG, "notifySearchStarted: reason: " + reason);
            sEventLogger.logd(TAG, "notifySearchStarted: reason: " + reason);
            obtainMessage(MSG_SEARCH_STARTED, reason, 0).sendToTarget();
        }

@@ -2236,7 +2230,7 @@ public class BassClientService extends ProfileService {
        }

        void notifySearchStopped(int reason) {
            sEventLogger.logd(DBG, TAG, "notifySearchStopped: reason: " + reason);
            sEventLogger.logd(TAG, "notifySearchStopped: reason: " + reason);
            obtainMessage(MSG_SEARCH_STOPPED, reason, 0).sendToTarget();
        }

@@ -2247,7 +2241,6 @@ public class BassClientService extends ProfileService {

        void notifySourceFound(BluetoothLeBroadcastMetadata source) {
            sEventLogger.logd(
                    DBG,
                    TAG,
                    "invokeCallback: MSG_SOURCE_FOUND"
                            + ", source: "
@@ -2268,7 +2261,6 @@ public class BassClientService extends ProfileService {
            sService.localNotifySourceAdded(sink, recvState);

            sEventLogger.logd(
                    DBG,
                    TAG,
                    "notifySourceAdded: "
                            + "source: "
@@ -2292,7 +2284,6 @@ public class BassClientService extends ProfileService {

        void notifySourceModified(BluetoothDevice sink, int sourceId, int reason) {
            sEventLogger.logd(
                    DBG,
                    TAG,
                    "notifySourceModified: "
                            + "source: "
@@ -2313,7 +2304,6 @@ public class BassClientService extends ProfileService {

        void notifySourceRemoved(BluetoothDevice sink, int sourceId, int reason) {
            sEventLogger.logd(
                    DBG,
                    TAG,
                    "notifySourceRemoved: "
                            + "source: "
Loading