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

Commit 01d25a9e authored by /e/ robot's avatar /e/ robot
Browse files

Merge remote-tracking branch 'origin/lineage-20.0' into v1-t

parents cdec2a3a 3af7ee5c
Loading
Loading
Loading
Loading
+28 −8
Original line number Diff line number Diff line
@@ -4575,6 +4575,17 @@ public class AudioService extends IAudioService.Stub
        return UserHandle.USER_SYSTEM;
    }
    private void sendVolumeChangedIntent(Intent intent, int streamType, int oldIndex, int index) {
        intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, streamType);
        intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, index);
        intent.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex);
        intent.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS,
                mStreamVolumeAlias[streamType]);
        AudioService.sVolumeLogger.log(new VolChangedBroadcastEvent(
                streamType, mStreamVolumeAlias[streamType], index));
        sendBroadcastToAll(intent);
    }
    // UI update and Broadcast Intent
    protected void sendVolumeUpdate(int streamType, int oldIndex, int index, int flags, int device)
    {
@@ -4584,6 +4595,20 @@ public class AudioService extends IAudioService.Stub
            flags &= ~AudioManager.FLAG_SHOW_UI;
        }
        mVolumeController.postVolumeChanged(streamType, flags);
        if (mIsSingleVolume) {
            if ((flags & AudioManager.FLAG_FIXED_VOLUME) == 0) {
                oldIndex = (oldIndex + 5) / 10;
                index = (index + 5) / 10;
                // log base stream changes to the event log
                if (mStreamVolumeAlias[streamType] == streamType) {
                    EventLogTags.writeVolumeChanged(streamType, oldIndex, index,
                            MAX_STREAM_VOLUME[streamType], "isSingleVolume=true");
                }
                Intent intent = new Intent(AudioManager.VOLUME_CHANGED_ACTION);
                sendVolumeChangedIntent(intent, streamType, oldIndex, index);
            }
        }
    }
    // Don't show volume UI when:
@@ -8312,7 +8337,8 @@ public class AudioService extends IAudioService.Stub
                    }
                }
            }
            if (changed) {
            if (changed && !mIsSingleVolume) {
                // If associated to volume group, update group cache
                updateVolumeGroupIndex(device, /* forceMuteState= */ false);
@@ -8329,13 +8355,7 @@ public class AudioService extends IAudioService.Stub
                // fire changed intents for all streams, but only when the device it changed on
                // is the current device
                if ((index != oldIndex) && isCurrentDevice) {
                    mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_VALUE, index);
                    mVolumeChanged.putExtra(AudioManager.EXTRA_PREV_VOLUME_STREAM_VALUE, oldIndex);
                    mVolumeChanged.putExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE_ALIAS,
                            mStreamVolumeAlias[mStreamType]);
                    AudioService.sVolumeLogger.log(new VolChangedBroadcastEvent(
                            mStreamType, mStreamVolumeAlias[mStreamType], index));
                    sendBroadcastToAll(mVolumeChanged);
                    sendVolumeChangedIntent(mVolumeChanged, mStreamType, oldIndex, index);
                }
            }
            return changed;