diff options
author | Vasu Nori <vnori@norinori.mtv.corp.google.com> | 2017-09-13 12:38:47 -0700 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2018-01-28 13:07:53 +0100 |
commit | 425066dfea88832b242ed64ee3deafb032f1fd77 (patch) | |
tree | c3fa4ccf483fbcf200620fe3e20e29765dc0337c | |
parent | a7f8f1632728d511d14cc9f971afdf8a155b66f4 (diff) | |
download | android_packages_apps_Bluetooth-staging/lineage-15.1.tar.gz android_packages_apps_Bluetooth-staging/lineage-15.1.tar.bz2 android_packages_apps_Bluetooth-staging/lineage-15.1.zip |
consider the situations where the device has only one volume level set.staging/lineage-15.1
Bug: 65125561
Test: runtest bluetooth -c
com.android.bluetooth.hfpclient.HeadsetClientStateMachineTest doesn't
crash now
Change-Id: I3474e60f04732c60de215a41125a9436c5ff122c
-rwxr-xr-x | src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java b/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java index 180d91cd2..604ab5a49 100755 --- a/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +++ b/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java @@ -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; |