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

Commit dbb8e0a8 authored by Sal Savage's avatar Sal Savage Committed by Gerrit Code Review
Browse files

Merge changes I06b0847b,I501b345c,Ifead6790,I3b65b38e into main

* changes:
  Use test local tags for determining test log line output
  Let the logging framework enforce state machine log levels
  Don't check against log enforcement variables when event logging
  Set the stack's default logging level to match "log.tag.bluetooth"
parents 2e919fc3 d96e2939
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
@@ -2269,6 +2269,34 @@ int register_com_android_bluetooth_btservice_AdapterService(JNIEnv* env) {
 * JNI Initialization
 */
jint JNI_OnLoad(JavaVM* jvm, void* /* reserved */) {
  /* Set the default logging level for the process using the tag
   *  "log.tag.bluetooth" and/or "persist.log.tag.bluetooth" via the android
   * logging framework.
   */
  const char* stack_default_log_tag = "bluetooth";
  int default_prio = ANDROID_LOG_INFO;
  if (__android_log_is_loggable(ANDROID_LOG_VERBOSE, stack_default_log_tag,
                                default_prio)) {
    __android_log_set_minimum_priority(ANDROID_LOG_VERBOSE);
    log::info("Set stack default log level to 'VERBOSE'");
  } else if (__android_log_is_loggable(ANDROID_LOG_DEBUG, stack_default_log_tag,
                                       default_prio)) {
    __android_log_set_minimum_priority(ANDROID_LOG_DEBUG);
    log::info("Set stack default log level to 'DEBUG'");
  } else if (__android_log_is_loggable(ANDROID_LOG_INFO, stack_default_log_tag,
                                       default_prio)) {
    __android_log_set_minimum_priority(ANDROID_LOG_INFO);
    log::info("Set stack default log level to 'INFO'");
  } else if (__android_log_is_loggable(ANDROID_LOG_WARN, stack_default_log_tag,
                                       default_prio)) {
    __android_log_set_minimum_priority(ANDROID_LOG_WARN);
    log::info("Set stack default log level to 'WARN'");
  } else if (__android_log_is_loggable(ANDROID_LOG_ERROR, stack_default_log_tag,
                                       default_prio)) {
    __android_log_set_minimum_priority(ANDROID_LOG_ERROR);
    log::info("Set stack default log level to 'ERROR'");
  }

  JNIEnv* e;
  int status;

+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) {
+5 −1
Original line number Diff line number Diff line
@@ -105,7 +105,11 @@ final class A2dpStateMachine extends StateMachine {
    A2dpStateMachine(BluetoothDevice device, A2dpService a2dpService,
                     A2dpNativeInterface a2dpNativeInterface, Looper looper) {
        super(TAG, looper);
        setDbg(DBG);

        // Let the logging framework enforce the log level. TAG is set above in the parent
        // constructor.
        setDbg(true);

        mDevice = device;
        mA2dpService = a2dpService;
        mA2dpNativeInterface = a2dpNativeInterface;
+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="
Loading