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

Commit 4b923c4b authored by Vasu Nori's avatar Vasu Nori Committed by Vasu Nori
Browse files

consider the situations where the device has only one volume level set.

Bug: 65125561
Test: runtest bluetooth -c
com.android.bluetooth.hfpclient.HeadsetClientStateMachineTest doesn't
crash now

Change-Id: I3474e60f04732c60de215a41125a9436c5ff122c
parent 0bda2f3f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -751,7 +751,7 @@ public class HeadsetClientStateMachine extends StateMachine {
    }

    static int amToHfVol(int amVol) {
        int amRange = mMaxAmVcVol - mMinAmVcVol;
        int amRange = (mMaxAmVcVol > mMinAmVcVol) ? (mMaxAmVcVol - mMinAmVcVol) : 1;
        int hfRange = MAX_HFP_SCO_VOICE_CALL_VOLUME - MIN_HFP_SCO_VOICE_CALL_VOLUME;
        int hfOffset = (hfRange * (amVol - mMinAmVcVol)) / amRange;
        int hfVol = MIN_HFP_SCO_VOICE_CALL_VOLUME + hfOffset;