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

Commit 73521a2d authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Set the AVRCP absolute volume control initial volume to 50% for all devices

* Introduced a new configuration value named
  "a2dp_absolute_volume_initial_threshold_percent" that can be used to
  specify the absolute volume control initial value as a percent of
  the maximum volume level.

  Valid values are in the [0, 100] interval, and the default value is 50%.

* Marked the existing configuration "a2dp_absolute_volume_initial_threshold"
  as @deprecated.

Bug: 65754094
Test: Manual test with devices that have different numbers of volume steps
Change-Id: I449c5de52c68e66a3c01721bf6324f3090cfc33c
(cherry picked from commit b8cff95f)
parent e9ab672a
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -58,11 +58,15 @@

    <bool name="headset_client_initial_audio_route_allowed">true</bool>

    <!-- For AVRCP absolute volume feature. If the threshold is non-zero,
         restrict the initial volume to the threshold.
         Valid value is 1-14, and recommended value is 8 -->
    <!-- @deprecated: use a2dp_absolute_volume_initial_threshold_percent
         instead. -->
    <integer name="a2dp_absolute_volume_initial_threshold">8</integer>

    <!-- AVRCP absolute volume initial value as percent of the maximum value.
         Valid values are in the interval [0, 100].
         Recommended value is 50. -->
    <integer name="a2dp_absolute_volume_initial_threshold_percent">50</integer>

    <!-- For A2DP sink ducking volume feature. -->
    <integer name="a2dp_sink_duck_percent">25</integer>

+7 −0
Original line number Diff line number Diff line
@@ -279,6 +279,13 @@ public final class Avrcp {
        Resources resources = context.getResources();
        if (resources != null) {
            mAbsVolThreshold = resources.getInteger(R.integer.a2dp_absolute_volume_initial_threshold);

            // Update the threshold if the threshold_percent is valid
            int threshold_percent =
                    resources.getInteger(R.integer.a2dp_absolute_volume_initial_threshold_percent);
            if (threshold_percent >= 0 && threshold_percent <= 100) {
                mAbsVolThreshold = (threshold_percent * mAudioStreamMax) / 100;
            }
        }

        // Register for package removal intent broadcasts for media button receiver persistence