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

Commit 8ebc9ed9 authored by Alex Dadukin's avatar Alex Dadukin Committed by Android (Google) Code Review
Browse files

Merge "Change log to enqueue inside EventLogger"

parents 13eefb98 650e9309
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -344,7 +344,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
        if (AudioService.DEBUG_COMM_RTE) {
        if (AudioService.DEBUG_COMM_RTE) {
            Log.v(TAG, "setCommunicationRouteForClient: device: " + device);
            Log.v(TAG, "setCommunicationRouteForClient: device: " + device);
        }
        }
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
        AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                                        "setCommunicationRouteForClient for pid: " + pid
                                        "setCommunicationRouteForClient for pid: " + pid
                                        + " device: " + device
                                        + " device: " + device
                                        + " from API: " + eventSource)).printLog(TAG));
                                        + " from API: " + eventSource)).printLog(TAG));
@@ -1212,7 +1212,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
        if (useCase == AudioSystem.FOR_MEDIA) {
        if (useCase == AudioSystem.FOR_MEDIA) {
            postReportNewRoutes(fromA2dp);
            postReportNewRoutes(fromA2dp);
        }
        }
        AudioService.sForceUseLogger.log(
        AudioService.sForceUseLogger.enqueue(
                new AudioServiceEvents.ForceUseEvent(useCase, config, eventSource));
                new AudioServiceEvents.ForceUseEvent(useCase, config, eventSource));
        new MediaMetrics.Item(MediaMetrics.Name.AUDIO_FORCE_USE + MediaMetrics.SEPARATOR
        new MediaMetrics.Item(MediaMetrics.Name.AUDIO_FORCE_USE + MediaMetrics.SEPARATOR
                + AudioSystem.forceUseUsageToString(useCase))
                + AudioSystem.forceUseUsageToString(useCase))
@@ -1230,7 +1230,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
    }
    }


    private void onSendBecomingNoisyIntent() {
    private void onSendBecomingNoisyIntent() {
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
        AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                "broadcast ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG));
                "broadcast ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG));
        mSystemServer.sendDeviceBecomingNoisyIntent();
        mSystemServer.sendDeviceBecomingNoisyIntent();
    }
    }
@@ -1468,7 +1468,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
                case MSG_L_BT_ACTIVE_DEVICE_CHANGE_EXT: {
                case MSG_L_BT_ACTIVE_DEVICE_CHANGE_EXT: {
                    final BtDeviceInfo info = (BtDeviceInfo) msg.obj;
                    final BtDeviceInfo info = (BtDeviceInfo) msg.obj;
                    if (info.mDevice == null) break;
                    if (info.mDevice == null) break;
                    AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                    AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                            "msg: onBluetoothActiveDeviceChange "
                            "msg: onBluetoothActiveDeviceChange "
                                    + " state=" + info.mState
                                    + " state=" + info.mState
                                    // only querying address as this is the only readily available
                                    // only querying address as this is the only readily available
@@ -1858,7 +1858,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
            Log.v(TAG, "onUpdateCommunicationRoute, preferredCommunicationDevice: "
            Log.v(TAG, "onUpdateCommunicationRoute, preferredCommunicationDevice: "
                    + preferredCommunicationDevice + " eventSource: " + eventSource);
                    + preferredCommunicationDevice + " eventSource: " + eventSource);
        }
        }
        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
        AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                "onUpdateCommunicationRoute, preferredCommunicationDevice: "
                "onUpdateCommunicationRoute, preferredCommunicationDevice: "
                + preferredCommunicationDevice + " eventSource: " + eventSource)));
                + preferredCommunicationDevice + " eventSource: " + eventSource)));


+14 −14
Original line number Original line Diff line number Diff line
@@ -309,7 +309,7 @@ public class AudioDeviceInventory {
            address = "";
            address = "";
        }
        }


        AudioService.sDeviceLogger.log(new EventLogger.StringEvent("BT connected:"
        AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent("BT connected:"
                        + " addr=" + address
                        + " addr=" + address
                        + " profile=" + btInfo.mProfile
                        + " profile=" + btInfo.mProfile
                        + " state=" + btInfo.mState
                        + " state=" + btInfo.mState
@@ -412,13 +412,13 @@ public class AudioDeviceInventory {
        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
        if (!BluetoothAdapter.checkBluetoothAddress(address)) {
            address = "";
            address = "";
        }
        }
        AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
        AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                "onBluetoothA2dpDeviceConfigChange addr=" + address
                "onBluetoothA2dpDeviceConfigChange addr=" + address
                    + " event=" + BtHelper.a2dpDeviceEventToString(event)));
                    + " event=" + BtHelper.a2dpDeviceEventToString(event)));


        synchronized (mDevicesLock) {
        synchronized (mDevicesLock) {
            if (mDeviceBroker.hasScheduledA2dpConnection(btDevice)) {
            if (mDeviceBroker.hasScheduledA2dpConnection(btDevice)) {
                AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                        "A2dp config change ignored (scheduled connection change)")
                        "A2dp config change ignored (scheduled connection change)")
                        .printLog(TAG));
                        .printLog(TAG));
                mmi.set(MediaMetrics.Property.EARLY_RETURN, "A2dp config change ignored")
                mmi.set(MediaMetrics.Property.EARLY_RETURN, "A2dp config change ignored")
@@ -460,7 +460,7 @@ public class AudioDeviceInventory {
                    BtHelper.getName(btDevice), a2dpCodec);
                    BtHelper.getName(btDevice), a2dpCodec);


            if (res != AudioSystem.AUDIO_STATUS_OK) {
            if (res != AudioSystem.AUDIO_STATUS_OK) {
                AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                        "APM handleDeviceConfigChange failed for A2DP device addr=" + address
                        "APM handleDeviceConfigChange failed for A2DP device addr=" + address
                                + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
                                + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
                        .printLog(TAG));
                        .printLog(TAG));
@@ -472,7 +472,7 @@ public class AudioDeviceInventory {
                                BluetoothProfile.A2DP, BluetoothProfile.STATE_DISCONNECTED,
                                BluetoothProfile.A2DP, BluetoothProfile.STATE_DISCONNECTED,
                                musicDevice, AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP));
                                musicDevice, AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP));
            } else {
            } else {
                AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
                AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                        "APM handleDeviceConfigChange success for A2DP device addr=" + address
                        "APM handleDeviceConfigChange success for A2DP device addr=" + address
                                + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
                                + " codec=" + AudioSystem.audioFormatToString(a2dpCodec))
                        .printLog(TAG));
                        .printLog(TAG));
@@ -522,7 +522,7 @@ public class AudioDeviceInventory {
                            AudioDeviceInventory.WiredDeviceConnectionState wdcs) {
                            AudioDeviceInventory.WiredDeviceConnectionState wdcs) {
        int type = wdcs.mAttributes.getInternalType();
        int type = wdcs.mAttributes.getInternalType();


        AudioService.sDeviceLogger.log(new AudioServiceEvents.WiredDevConnectEvent(wdcs));
        AudioService.sDeviceLogger.enqueue(new AudioServiceEvents.WiredDevConnectEvent(wdcs));


        MediaMetrics.Item mmi = new MediaMetrics.Item(mMetricsId
        MediaMetrics.Item mmi = new MediaMetrics.Item(mMetricsId
                + "onSetWiredDeviceConnectionState")
                + "onSetWiredDeviceConnectionState")
@@ -619,7 +619,7 @@ public class AudioDeviceInventory {
            @NonNull List<AudioDeviceAttributes> devices) {
            @NonNull List<AudioDeviceAttributes> devices) {
        final long identity = Binder.clearCallingIdentity();
        final long identity = Binder.clearCallingIdentity();


        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
        AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                                "setPreferredDevicesForStrategySync, strategy: " + strategy
                                "setPreferredDevicesForStrategySync, strategy: " + strategy
                                + " devices: " + devices)).printLog(TAG));
                                + " devices: " + devices)).printLog(TAG));
        final int status = mAudioSystem.setDevicesRoleForStrategy(
        final int status = mAudioSystem.setDevicesRoleForStrategy(
@@ -635,7 +635,7 @@ public class AudioDeviceInventory {
    /*package*/ int removePreferredDevicesForStrategySync(int strategy) {
    /*package*/ int removePreferredDevicesForStrategySync(int strategy) {
        final long identity = Binder.clearCallingIdentity();
        final long identity = Binder.clearCallingIdentity();


        AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
        AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                "removePreferredDevicesForStrategySync, strategy: "
                "removePreferredDevicesForStrategySync, strategy: "
                + strategy)).printLog(TAG));
                + strategy)).printLog(TAG));


@@ -1000,13 +1000,13 @@ public class AudioDeviceInventory {
        // TODO: log in MediaMetrics once distinction between connection failure and
        // TODO: log in MediaMetrics once distinction between connection failure and
        // double connection is made.
        // double connection is made.
        if (res != AudioSystem.AUDIO_STATUS_OK) {
        if (res != AudioSystem.AUDIO_STATUS_OK) {
            AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
            AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                    "APM failed to make available A2DP device addr=" + address
                    "APM failed to make available A2DP device addr=" + address
                            + " error=" + res).printLog(TAG));
                            + " error=" + res).printLog(TAG));
            // TODO: connection failed, stop here
            // TODO: connection failed, stop here
            // TODO: return;
            // TODO: return;
        } else {
        } else {
            AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
            AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                    "A2DP device addr=" + address + " now available").printLog(TAG));
                    "A2DP device addr=" + address + " now available").printLog(TAG));
        }
        }


@@ -1047,7 +1047,7 @@ public class AudioDeviceInventory {
        if (!deviceToRemoveKey
        if (!deviceToRemoveKey
                .equals(mApmConnectedDevices.get(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP))) {
                .equals(mApmConnectedDevices.get(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP))) {
            // removing A2DP device not currently used by AudioPolicy, log but don't act on it
            // removing A2DP device not currently used by AudioPolicy, log but don't act on it
            AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
            AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                    "A2DP device " + address + " made unavailable, was not used")).printLog(TAG));
                    "A2DP device " + address + " made unavailable, was not used")).printLog(TAG));
            mmi.set(MediaMetrics.Property.EARLY_RETURN,
            mmi.set(MediaMetrics.Property.EARLY_RETURN,
                    "A2DP device made unavailable, was not used")
                    "A2DP device made unavailable, was not used")
@@ -1062,13 +1062,13 @@ public class AudioDeviceInventory {
                AudioSystem.DEVICE_STATE_UNAVAILABLE, a2dpCodec);
                AudioSystem.DEVICE_STATE_UNAVAILABLE, a2dpCodec);


        if (res != AudioSystem.AUDIO_STATUS_OK) {
        if (res != AudioSystem.AUDIO_STATUS_OK) {
            AudioService.sDeviceLogger.log(new EventLogger.StringEvent(
            AudioService.sDeviceLogger.enqueue(new EventLogger.StringEvent(
                    "APM failed to make unavailable A2DP device addr=" + address
                    "APM failed to make unavailable A2DP device addr=" + address
                            + " error=" + res).printLog(TAG));
                            + " error=" + res).printLog(TAG));
            // TODO:  failed to disconnect, stop here
            // TODO:  failed to disconnect, stop here
            // TODO: return;
            // TODO: return;
        } else {
        } else {
            AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
            AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                    "A2DP device addr=" + address + " made unavailable")).printLog(TAG));
                    "A2DP device addr=" + address + " made unavailable")).printLog(TAG));
        }
        }
        mApmConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
        mApmConnectedDevices.remove(AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP);
@@ -1314,7 +1314,7 @@ public class AudioDeviceInventory {
                    && !mDeviceBroker.hasAudioFocusUsers()) {
                    && !mDeviceBroker.hasAudioFocusUsers()) {
                // no media playback, not a "becoming noisy" situation, otherwise it could cause
                // no media playback, not a "becoming noisy" situation, otherwise it could cause
                // the pausing of some apps that are playing remotely
                // the pausing of some apps that are playing remotely
                AudioService.sDeviceLogger.log((new EventLogger.StringEvent(
                AudioService.sDeviceLogger.enqueue((new EventLogger.StringEvent(
                        "dropping ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG));
                        "dropping ACTION_AUDIO_BECOMING_NOISY")).printLog(TAG));
                mmi.set(MediaMetrics.Property.DELAY_MS, 0).record(); // OK to return
                mmi.set(MediaMetrics.Property.DELAY_MS, 0).record(); // OK to return
                return 0;
                return 0;
+32 −31
Original line number Original line Diff line number Diff line
@@ -990,7 +990,7 @@ public class AudioService extends IAudioService.Stub
    public AudioService(Context context, AudioSystemAdapter audioSystem,
    public AudioService(Context context, AudioSystemAdapter audioSystem,
            SystemServerAdapter systemServer, SettingsAdapter settings, @Nullable Looper looper,
            SystemServerAdapter systemServer, SettingsAdapter settings, @Nullable Looper looper,
            AppOpsManager appOps) {
            AppOpsManager appOps) {
        sLifecycleLogger.log(new EventLogger.StringEvent("AudioService()"));
        sLifecycleLogger.enqueue(new EventLogger.StringEvent("AudioService()"));
        mContext = context;
        mContext = context;
        mContentResolver = context.getContentResolver();
        mContentResolver = context.getContentResolver();
        mAppOps = appOps;
        mAppOps = appOps;
@@ -1539,14 +1539,14 @@ public class AudioService extends IAudioService.Stub
        if (!mSystemReady ||
        if (!mSystemReady ||
                (AudioSystem.checkAudioFlinger() != AudioSystem.AUDIO_STATUS_OK)) {
                (AudioSystem.checkAudioFlinger() != AudioSystem.AUDIO_STATUS_OK)) {
            Log.e(TAG, "Audioserver died.");
            Log.e(TAG, "Audioserver died.");
            sLifecycleLogger.log(new EventLogger.StringEvent(
            sLifecycleLogger.enqueue(new EventLogger.StringEvent(
                    "onAudioServerDied() audioserver died"));
                    "onAudioServerDied() audioserver died"));
            sendMsg(mAudioHandler, MSG_AUDIO_SERVER_DIED, SENDMSG_NOOP, 0, 0,
            sendMsg(mAudioHandler, MSG_AUDIO_SERVER_DIED, SENDMSG_NOOP, 0, 0,
                    null, 500);
                    null, 500);
            return;
            return;
        }
        }
        Log.i(TAG, "Audioserver started.");
        Log.i(TAG, "Audioserver started.");
        sLifecycleLogger.log(new EventLogger.StringEvent(
        sLifecycleLogger.enqueue(new EventLogger.StringEvent(
                "onAudioServerDied() audioserver started"));
                "onAudioServerDied() audioserver started"));
        updateAudioHalPids();
        updateAudioHalPids();
@@ -1776,7 +1776,7 @@ public class AudioService extends IAudioService.Stub
        // did it work? check based on status
        // did it work? check based on status
        if (status != AudioSystem.AUDIO_STATUS_OK) {
        if (status != AudioSystem.AUDIO_STATUS_OK) {
            sLifecycleLogger.log(new EventLogger.StringEvent(
            sLifecycleLogger.enqueue(new EventLogger.StringEvent(
                    caller + ": initStreamVolume failed with " + status + " will retry")
                    caller + ": initStreamVolume failed with " + status + " will retry")
                    .printLog(ALOGE, TAG));
                    .printLog(ALOGE, TAG));
            sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
            sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
@@ -1790,7 +1790,7 @@ public class AudioService extends IAudioService.Stub
        }
        }
        // success
        // success
        sLifecycleLogger.log(new EventLogger.StringEvent(
        sLifecycleLogger.enqueue(new EventLogger.StringEvent(
                caller + ": initStreamVolume succeeded").printLog(ALOGI, TAG));
                caller + ": initStreamVolume succeeded").printLog(ALOGI, TAG));
    }
    }
@@ -1813,7 +1813,7 @@ public class AudioService extends IAudioService.Stub
            }
            }
        }
        }
        if (!success) {
        if (!success) {
            sLifecycleLogger.log(new EventLogger.StringEvent(
            sLifecycleLogger.enqueue(new EventLogger.StringEvent(
                    caller + ": initStreamVolume succeeded but invalid mix/max levels, will retry")
                    caller + ": initStreamVolume succeeded but invalid mix/max levels, will retry")
                    .printLog(ALOGW, TAG));
                    .printLog(ALOGW, TAG));
            sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
            sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
@@ -2764,7 +2764,7 @@ public class AudioService extends IAudioService.Stub
                "setPreferredDeviceForStrategy u/pid:%d/%d strat:%d dev:%s",
                "setPreferredDeviceForStrategy u/pid:%d/%d strat:%d dev:%s",
                Binder.getCallingUid(), Binder.getCallingPid(), strategy,
                Binder.getCallingUid(), Binder.getCallingPid(), strategy,
                devices.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
                devices.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.enqueue(new EventLogger.StringEvent(logString).printLog(TAG));
        if (devices.stream().anyMatch(device ->
        if (devices.stream().anyMatch(device ->
                device.getRole() == AudioDeviceAttributes.ROLE_INPUT)) {
                device.getRole() == AudioDeviceAttributes.ROLE_INPUT)) {
            Log.e(TAG, "Unsupported input routing in " + logString);
            Log.e(TAG, "Unsupported input routing in " + logString);
@@ -2784,7 +2784,7 @@ public class AudioService extends IAudioService.Stub
    public int removePreferredDevicesForStrategy(int strategy) {
    public int removePreferredDevicesForStrategy(int strategy) {
        final String logString =
        final String logString =
                String.format("removePreferredDeviceForStrategy strat:%d", strategy);
                String.format("removePreferredDeviceForStrategy strat:%d", strategy);
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.enqueue(new EventLogger.StringEvent(logString).printLog(TAG));
        final int status = mDeviceBroker.removePreferredDevicesForStrategySync(strategy);
        final int status = mDeviceBroker.removePreferredDevicesForStrategySync(strategy);
        if (status != AudioSystem.SUCCESS) {
        if (status != AudioSystem.SUCCESS) {
@@ -2850,7 +2850,7 @@ public class AudioService extends IAudioService.Stub
                "setPreferredDevicesForCapturePreset u/pid:%d/%d source:%d dev:%s",
                "setPreferredDevicesForCapturePreset u/pid:%d/%d source:%d dev:%s",
                Binder.getCallingUid(), Binder.getCallingPid(), capturePreset,
                Binder.getCallingUid(), Binder.getCallingPid(), capturePreset,
                devices.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
                devices.stream().map(e -> e.toString()).collect(Collectors.joining(",")));
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.enqueue(new EventLogger.StringEvent(logString).printLog(TAG));
        if (devices.stream().anyMatch(device ->
        if (devices.stream().anyMatch(device ->
                device.getRole() == AudioDeviceAttributes.ROLE_OUTPUT)) {
                device.getRole() == AudioDeviceAttributes.ROLE_OUTPUT)) {
            Log.e(TAG, "Unsupported output routing in " + logString);
            Log.e(TAG, "Unsupported output routing in " + logString);
@@ -2871,7 +2871,7 @@ public class AudioService extends IAudioService.Stub
    public int clearPreferredDevicesForCapturePreset(int capturePreset) {
    public int clearPreferredDevicesForCapturePreset(int capturePreset) {
        final String logString = String.format(
        final String logString = String.format(
                "removePreferredDeviceForCapturePreset source:%d", capturePreset);
                "removePreferredDeviceForCapturePreset source:%d", capturePreset);
        sDeviceLogger.log(new EventLogger.StringEvent(logString).printLog(TAG));
        sDeviceLogger.enqueue(new EventLogger.StringEvent(logString).printLog(TAG));
        final int status = mDeviceBroker.clearPreferredDevicesForCapturePresetSync(capturePreset);
        final int status = mDeviceBroker.clearPreferredDevicesForCapturePresetSync(capturePreset);
        if (status != AudioSystem.SUCCESS) {
        if (status != AudioSystem.SUCCESS) {
@@ -3043,7 +3043,8 @@ public class AudioService extends IAudioService.Stub
                + ", volControlStream=" + mVolumeControlStream
                + ", volControlStream=" + mVolumeControlStream
                + ", userSelect=" + mUserSelectedVolumeControlStream);
                + ", userSelect=" + mUserSelectedVolumeControlStream);
        if (direction != AudioManager.ADJUST_SAME) {
        if (direction != AudioManager.ADJUST_SAME) {
            sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_ADJUST_SUGG_VOL, suggestedStreamType,
            sVolumeLogger.enqueue(
                    new VolumeEvent(VolumeEvent.VOL_ADJUST_SUGG_VOL, suggestedStreamType,
                            direction/*val1*/, flags/*val2*/, new StringBuilder(callingPackage)
                            direction/*val1*/, flags/*val2*/, new StringBuilder(callingPackage)
                            .append("/").append(caller).append(" uid:").append(uid).toString()));
                            .append("/").append(caller).append(" uid:").append(uid).toString()));
        }
        }
@@ -3144,7 +3145,7 @@ public class AudioService extends IAudioService.Stub
            return;
            return;
        }
        }
        sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_ADJUST_STREAM_VOL, streamType,
        sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_ADJUST_STREAM_VOL, streamType,
                direction/*val1*/, flags/*val2*/, callingPackage));
                direction/*val1*/, flags/*val2*/, callingPackage));
        adjustStreamVolume(streamType, direction, flags, callingPackage, callingPackage,
        adjustStreamVolume(streamType, direction, flags, callingPackage, callingPackage,
                Binder.getCallingUid(), Binder.getCallingPid(), attributionTag,
                Binder.getCallingUid(), Binder.getCallingPid(), attributionTag,
@@ -3625,7 +3626,7 @@ public class AudioService extends IAudioService.Stub
        }
        }
        final VolumeGroupState vgs = sVolumeGroupStates.get(volumeGroup);
        final VolumeGroupState vgs = sVolumeGroupStates.get(volumeGroup);
        sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_SET_GROUP_VOL, attr, vgs.name(),
        sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_SET_GROUP_VOL, attr, vgs.name(),
                index/*val1*/, flags/*val2*/, callingPackage));
                index/*val1*/, flags/*val2*/, callingPackage));
        vgs.setVolumeIndex(index, flags);
        vgs.setVolumeIndex(index, flags);
@@ -3776,7 +3777,7 @@ public class AudioService extends IAudioService.Stub
                ? new VolumeEvent(VolumeEvent.VOL_SET_STREAM_VOL, streamType,
                ? new VolumeEvent(VolumeEvent.VOL_SET_STREAM_VOL, streamType,
                    index/*val1*/, flags/*val2*/, callingPackage)
                    index/*val1*/, flags/*val2*/, callingPackage)
                : new DeviceVolumeEvent(streamType, index, device, callingPackage);
                : new DeviceVolumeEvent(streamType, index, device, callingPackage);
        sVolumeLogger.log(event);
        sVolumeLogger.enqueue(event);
        setStreamVolume(streamType, index, flags, device,
        setStreamVolume(streamType, index, flags, device,
                callingPackage, callingPackage, attributionTag,
                callingPackage, callingPackage, attributionTag,
                Binder.getCallingUid(), callingOrSelfHasAudioSettingsPermission());
                Binder.getCallingUid(), callingOrSelfHasAudioSettingsPermission());
@@ -3977,7 +3978,7 @@ public class AudioService extends IAudioService.Stub
    private void updateHearingAidVolumeOnVoiceActivityUpdate() {
    private void updateHearingAidVolumeOnVoiceActivityUpdate() {
        final int streamType = getBluetoothContextualVolumeStream();
        final int streamType = getBluetoothContextualVolumeStream();
        final int index = getStreamVolume(streamType);
        final int index = getStreamVolume(streamType);
        sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_VOICE_ACTIVITY_HEARING_AID,
        sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_VOICE_ACTIVITY_HEARING_AID,
                mVoicePlaybackActive.get(), streamType, index));
                mVoicePlaybackActive.get(), streamType, index));
        mDeviceBroker.postSetHearingAidVolumeIndex(index * 10, streamType);
        mDeviceBroker.postSetHearingAidVolumeIndex(index * 10, streamType);
@@ -4018,7 +4019,7 @@ public class AudioService extends IAudioService.Stub
        if (AudioSystem.isSingleAudioDeviceType(
        if (AudioSystem.isSingleAudioDeviceType(
                absVolumeMultiModeCaseDevices, AudioSystem.DEVICE_OUT_HEARING_AID)) {
                absVolumeMultiModeCaseDevices, AudioSystem.DEVICE_OUT_HEARING_AID)) {
            final int index = getStreamVolume(streamType);
            final int index = getStreamVolume(streamType);
            sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_MODE_CHANGE_HEARING_AID,
            sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_MODE_CHANGE_HEARING_AID,
                    newMode, streamType, index));
                    newMode, streamType, index));
            mDeviceBroker.postSetHearingAidVolumeIndex(index * 10, streamType);
            mDeviceBroker.postSetHearingAidVolumeIndex(index * 10, streamType);
        }
        }
@@ -5419,7 +5420,7 @@ public class AudioService extends IAudioService.Stub
                        /*obj*/ null, /*delay*/ 0);
                        /*obj*/ null, /*delay*/ 0);
                int previousMode = mMode.getAndSet(mode);
                int previousMode = mMode.getAndSet(mode);
                // Note: newModeOwnerPid is always 0 when actualMode is MODE_NORMAL
                // Note: newModeOwnerPid is always 0 when actualMode is MODE_NORMAL
                mModeLogger.log(new PhoneStateEvent(requesterPackage, requesterPid,
                mModeLogger.enqueue(new PhoneStateEvent(requesterPackage, requesterPid,
                        requestedMode, pid, mode));
                        requestedMode, pid, mode));
                int streamType = getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
                int streamType = getActiveStreamType(AudioManager.USE_DEFAULT_STREAM_TYPE);
@@ -5562,7 +5563,7 @@ public class AudioService extends IAudioService.Stub
        }
        }
        if (direction != AudioManager.ADJUST_SAME) {
        if (direction != AudioManager.ADJUST_SAME) {
            sVolumeLogger.log(new VolumeEvent(VolumeEvent.VOL_ADJUST_VOL_UID, streamType,
            sVolumeLogger.enqueue(new VolumeEvent(VolumeEvent.VOL_ADJUST_VOL_UID, streamType,
                    direction/*val1*/, flags/*val2*/,
                    direction/*val1*/, flags/*val2*/,
                    new StringBuilder(packageName).append(" uid:").append(uid)
                    new StringBuilder(packageName).append(" uid:").append(uid)
                    .toString()));
                    .toString()));
@@ -6892,7 +6893,7 @@ public class AudioService extends IAudioService.Stub
        // verify arguments
        // verify arguments
        Objects.requireNonNull(device);
        Objects.requireNonNull(device);
        AudioManager.enforceValidVolumeBehavior(deviceVolumeBehavior);
        AudioManager.enforceValidVolumeBehavior(deviceVolumeBehavior);
        sVolumeLogger.log(new EventLogger.StringEvent("setDeviceVolumeBehavior: dev:"
        sVolumeLogger.enqueue(new EventLogger.StringEvent("setDeviceVolumeBehavior: dev:"
                + AudioSystem.getOutputDeviceName(device.getInternalType()) + " addr:"
                + AudioSystem.getOutputDeviceName(device.getInternalType()) + " addr:"
                + device.getAddress() + " behavior:"
                + device.getAddress() + " behavior:"
                + AudioDeviceVolumeManager.volumeBehaviorName(deviceVolumeBehavior)
                + AudioDeviceVolumeManager.volumeBehaviorName(deviceVolumeBehavior)
@@ -6948,7 +6949,7 @@ public class AudioService extends IAudioService.Stub
        }
        }
        // log event and caller
        // log event and caller
        sDeviceLogger.log(new EventLogger.StringEvent(
        sDeviceLogger.enqueue(new EventLogger.StringEvent(
                "Volume behavior " + deviceVolumeBehavior + " for dev=0x"
                "Volume behavior " + deviceVolumeBehavior + " for dev=0x"
                      + Integer.toHexString(audioSystemDeviceOut) + " from:" + caller));
                      + Integer.toHexString(audioSystemDeviceOut) + " from:" + caller));
        // make sure we have a volume entry for this device, and that volume is updated according
        // make sure we have a volume entry for this device, and that volume is updated according
@@ -7594,7 +7595,7 @@ public class AudioService extends IAudioService.Stub
            final int status = AudioSystem.initStreamVolume(
            final int status = AudioSystem.initStreamVolume(
                    streamType, mIndexMin / 10, mIndexMax / 10);
                    streamType, mIndexMin / 10, mIndexMax / 10);
            if (status != AudioSystem.AUDIO_STATUS_OK) {
            if (status != AudioSystem.AUDIO_STATUS_OK) {
                sLifecycleLogger.log(new EventLogger.StringEvent(
                sLifecycleLogger.enqueue(new EventLogger.StringEvent(
                         "VSS() stream:" + streamType + " initStreamVolume=" + status)
                         "VSS() stream:" + streamType + " initStreamVolume=" + status)
                        .printLog(ALOGE, TAG));
                        .printLog(ALOGE, TAG));
                sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
                sendMsg(mAudioHandler, MSG_REINIT_VOLUMES, SENDMSG_NOOP, 0, 0,
@@ -8013,7 +8014,7 @@ public class AudioService extends IAudioService.Stub
                }
                }
            }
            }
            if (changed) {
            if (changed) {
                sVolumeLogger.log(new VolumeEvent(
                sVolumeLogger.enqueue(new VolumeEvent(
                        VolumeEvent.VOL_MUTE_STREAM_INT, mStreamType, state));
                        VolumeEvent.VOL_MUTE_STREAM_INT, mStreamType, state));
            }
            }
            return changed;
            return changed;
@@ -8183,10 +8184,10 @@ public class AudioService extends IAudioService.Stub
            streamState.setIndex(index, update.mDevice, update.mCaller,
            streamState.setIndex(index, update.mDevice, update.mCaller,
                    // trusted as index is always validated before message is posted
                    // trusted as index is always validated before message is posted
                    true /*hasModifyAudioSettings*/);
                    true /*hasModifyAudioSettings*/);
            sVolumeLogger.log(new EventLogger.StringEvent(update.mCaller + " dev:0x"
            sVolumeLogger.enqueue(new EventLogger.StringEvent(update.mCaller + " dev:0x"
                    + Integer.toHexString(update.mDevice) + " volIdx:" + index));
                    + Integer.toHexString(update.mDevice) + " volIdx:" + index));
        } else {
        } else {
            sVolumeLogger.log(new EventLogger.StringEvent(update.mCaller
            sVolumeLogger.enqueue(new EventLogger.StringEvent(update.mCaller
                    + " update vol on dev:0x" + Integer.toHexString(update.mDevice)));
                    + " update vol on dev:0x" + Integer.toHexString(update.mDevice)));
        }
        }
        setDeviceVolume(streamState, update.mDevice);
        setDeviceVolume(streamState, update.mDevice);
@@ -8364,7 +8365,7 @@ public class AudioService extends IAudioService.Stub
                            .set(MediaMetrics.Property.FORCE_USE_MODE,
                            .set(MediaMetrics.Property.FORCE_USE_MODE,
                                    AudioSystem.forceUseConfigToString(config))
                                    AudioSystem.forceUseConfigToString(config))
                            .record();
                            .record();
                    sForceUseLogger.log(
                    sForceUseLogger.enqueue(
                            new AudioServiceEvents.ForceUseEvent(useCase, config, eventSource));
                            new AudioServiceEvents.ForceUseEvent(useCase, config, eventSource));
                    mAudioSystem.setForceUse(useCase, config);
                    mAudioSystem.setForceUse(useCase, config);
                }
                }
@@ -8633,7 +8634,7 @@ public class AudioService extends IAudioService.Stub
    private void avrcpSupportsAbsoluteVolume(String address, boolean support) {
    private void avrcpSupportsAbsoluteVolume(String address, boolean support) {
        // address is not used for now, but may be used when multiple a2dp devices are supported
        // address is not used for now, but may be used when multiple a2dp devices are supported
        sVolumeLogger.log(new EventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr="
        sVolumeLogger.enqueue(new EventLogger.StringEvent("avrcpSupportsAbsoluteVolume addr="
                + address + " support=" + support).printLog(TAG));
                + address + " support=" + support).printLog(TAG));
        mDeviceBroker.setAvrcpAbsoluteVolumeSupported(support);
        mDeviceBroker.setAvrcpAbsoluteVolumeSupported(support);
        setAvrcpAbsoluteVolumeSupported(support);
        setAvrcpAbsoluteVolumeSupported(support);
@@ -10668,7 +10669,7 @@ public class AudioService extends IAudioService.Stub
                pcb.asBinder().linkToDeath(app, 0/*flags*/);
                pcb.asBinder().linkToDeath(app, 0/*flags*/);
                // logging after registration so we have the registration id
                // logging after registration so we have the registration id
                mDynPolicyLogger.log((new EventLogger.StringEvent("registerAudioPolicy for "
                mDynPolicyLogger.enqueue((new EventLogger.StringEvent("registerAudioPolicy for "
                        + pcb.asBinder() + " u/pid:" + Binder.getCallingUid() + "/"
                        + pcb.asBinder() + " u/pid:" + Binder.getCallingUid() + "/"
                        + Binder.getCallingPid() + " with config:" + app.toCompactLogString()))
                        + Binder.getCallingPid() + " with config:" + app.toCompactLogString()))
                        .printLog(TAG));
                        .printLog(TAG));
@@ -10866,7 +10867,7 @@ public class AudioService extends IAudioService.Stub
    private void unregisterAudioPolicyInt(@NonNull IAudioPolicyCallback pcb, String operationName) {
    private void unregisterAudioPolicyInt(@NonNull IAudioPolicyCallback pcb, String operationName) {
        mDynPolicyLogger.log((new EventLogger.StringEvent(operationName + " for "
        mDynPolicyLogger.enqueue((new EventLogger.StringEvent(operationName + " for "
                + pcb.asBinder()).printLog(TAG)));
                + pcb.asBinder()).printLog(TAG)));
        synchronized (mAudioPolicies) {
        synchronized (mAudioPolicies) {
            AudioPolicyProxy app = mAudioPolicies.remove(pcb.asBinder());
            AudioPolicyProxy app = mAudioPolicies.remove(pcb.asBinder());
@@ -11394,7 +11395,7 @@ public class AudioService extends IAudioService.Stub
        }
        }
        public void binderDied() {
        public void binderDied() {
            mDynPolicyLogger.log((new EventLogger.StringEvent("AudioPolicy "
            mDynPolicyLogger.enqueue((new EventLogger.StringEvent("AudioPolicy "
                    + mPolicyCallback.asBinder() + " died").printLog(TAG)));
                    + mPolicyCallback.asBinder() + " died").printLog(TAG)));
            release();
            release();
        }
        }
+8 −8

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Original line Diff line number Diff line
@@ -245,7 +245,7 @@ public final class FadeOutManager {
                return;
                return;
            }
            }
            try {
            try {
                PlaybackActivityMonitor.sEventLogger.log(
                PlaybackActivityMonitor.sEventLogger.enqueue(
                        (new PlaybackActivityMonitor.FadeOutEvent(apc, skipRamp)).printLog(TAG));
                        (new PlaybackActivityMonitor.FadeOutEvent(apc, skipRamp)).printLog(TAG));
                apc.getPlayerProxy().applyVolumeShaper(
                apc.getPlayerProxy().applyVolumeShaper(
                        FADEOUT_VSHAPE,
                        FADEOUT_VSHAPE,
@@ -262,7 +262,7 @@ public final class FadeOutManager {
                final AudioPlaybackConfiguration apc = players.get(piid);
                final AudioPlaybackConfiguration apc = players.get(piid);
                if (apc != null) {
                if (apc != null) {
                    try {
                    try {
                        PlaybackActivityMonitor.sEventLogger.log(
                        PlaybackActivityMonitor.sEventLogger.enqueue(
                                (new EventLogger.StringEvent("unfading out piid:"
                                (new EventLogger.StringEvent("unfading out piid:"
                                        + piid)).printLog(TAG));
                                        + piid)).printLog(TAG));
                        apc.getPlayerProxy().applyVolumeShaper(
                        apc.getPlayerProxy().applyVolumeShaper(
Loading