[LG Optimus 2x] sibbor:
In-Call Volume Fixer (APK)

EDIT: for the APK see the attachment at the end of the post.

Currently some CM7 users are having issues with the in-call volume - it's too loud when the call connects. The workaround for this issue is to max out the volume and then lower it to a level that fits you.

Therefore I've made a small app, with a weird name that does just that for you. The app is a service, listening for phone calls in the background. When a phone call is connected it'll automatically max your volume and then reset it back to your original volume.

NOTE: This is only a temporarily fix until the root cause of this issue is fixed.

Here's the logcat of my 2X when starting and connecting a call:

08-12 13:25:19.225: INFO/ActivityManager(1138): Starting: Intent { act=android.intent.action.CALL_PRIVILEGED dat=tel:xxx-xxx-xxxx flg=0x10000000 cmp=com.android.phone/.PrivilegedOutgoingCallBroadcaster } from pid 9893
08-12 13:25:19.265: DEBUG/PhoneUtils(1290): checkAndCopyPhoneProviderExtras: some or all extras are missing.
08-12 13:25:19.295: DEBUG/PhoneUtils(1290): checkAndCopyPhoneProviderExtras: some or all extras are missing.
08-12 13:25:19.295: INFO/ActivityManager(1138): Starting: Intent { act=android.phone.extra.NEW_CALL_INTENT dat=tel:xxx-xxx-xxxx flg=0x10000000 cmp=com.android.phone/.SipCallOptionHandler (has extras) } from pid 1290
08-12 13:25:19.335: VERBOSE/SipCallOptionHandler(1290): Call option is SIP_ADDRESS_ONLY
08-12 13:25:19.335: INFO/ActivityManager(1138): Starting: Intent { act=android.intent.action.CALL dat=tel:xxx-xxx-xxxx flg=0x10000000 cmp=com.android.phone/.InCallScreen (has extras) } from pid 1290
08-12 13:25:19.345: INFO/AudioService(1138): AudioFocus requestAudioFocus() from AudioFocus_For_Phone_Ring_And_Calls
08-12 13:25:19.345: INFO/ActivityManager(1138): Start proc com.sibbor.optimus.callvolumefix for broadcast com.sibbor.optimus.callvolumefix/.CallReceiver: pid=23892 uid=10100 gids={1015}
08-12 13:25:19.355: DEBUG/AudioHardwareInterface(1029): setMode(IN_CALL)
08-12 13:25:19.355: DEBUG/(1035): @@(Audiofx_transport)@@ SetMode() Mode = 4 CHR_TEST!!
08-12 13:25:19.355: DEBUG/(1035): @@(Audiofx_transport)@@ SetInput() Mode = 4, InputSelect =0 CHR_TEST!!
08-12 13:25:19.355: DEBUG/(1035): @@(Audiofx_transport)@@ SetOutput() - hDriver->Mode = 4, OutputSelect = 512 CHR_TEST!!
08-12 13:25:19.355: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 2, IsEnable = 1 CHR_TEST!!
08-12 13:25:19.355: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 1, IsEnable = 1 CHR_TEST!!
08-12 13:25:19.355: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 8, IsEnable = 1 CHR_TEST!!
08-12 13:25:19.355: DEBUG/(1035): @@(Audiofx_transport)@@ SetAudioPort() PortDirection = 2, IsEnable =1 CHR_TEST!!
08-12 13:25:19.355: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:19.355: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() speaker device not found
08-12 13:25:19.355: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:19.355: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() speaker device not found
08-12 13:25:19.355: DEBUG/AudioFlinger(1029): setParameters(): io 1, keyvalue routing=1, tid 1111, calling tid 1029
08-12 13:25:19.355: WARN/(1029): @@(Device.cpp-hal)@@ setOutputDevice(), device = 1
08-12 13:25:19.355: DEBUG/AudioFlinger(1029): setParameters(): io 0, keyvalue nv_a2dp_routing=0, tid 1111, calling tid 1029
08-12 13:25:19.355: WARN/(1029): @@(Device.cpp-hal)@@ setOutputDevice(), device is 0 return
08-12 13:25:19.375: DEBUG/(1035): @@(Audiofx_transport)@@ SetAudioPort() PortDirection = 1, IsEnable =1 CHR_TEST!!
08-12 13:25:19.405: INFO/power(1138): *** set_screen_state 1
08-12 13:25:19.425: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxIoProperty_OutputSelect(I2S) : OutputSelect = 512 CHR_TEST!!
08-12 13:25:19.425: DEBUG/(1035): @@(Audiofx_transport)@@ SetOutput() - hDriver->Mode = 4, OutputSelect = 512 CHR_TEST!!
08-12 13:25:19.425: DEBUG/(1035): @@(Audiofx_transport)@@ SetInput() Mode = 4, InputSelect =1 CHR_TEST!!
08-12 13:25:19.425: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxIoProperty_OutputSelect(Spdif) : OutputSelect = 0 CHR_TEST!!
08-12 13:25:19.425: DEBUG/(1035): @@(Audiofx_transport)@@ SetOutput() - hDriver->Mode = 4, OutputSelect = 512 CHR_TEST!!
08-12 13:25:19.465: DEBUG/AccelerometerListener(1290): enable(true)
08-12 13:25:19.475: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:19.475: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:19.475: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:19.475: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:19.495: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:19.525: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:19.525: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:19.525: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:19.525: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:19.535: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:19.575: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:19.575: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:19.575: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:19.575: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:19.585: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
[B]08-12 13:25:19.635: DEBUG/CallVolume(23892): ----- VolumeFixer: start -----[/B]
08-12 13:25:19.645: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=-1, LeftVolume=6, RightVolume=6, Mute=0 CHR_TEST!!
08-12 13:25:19.645: DEBUG/(1035): @@(Audiofx_transport)@@ CodecSetOutputVolume() : OutputSelect = -1 CHR_TEST!!
08-12 13:25:19.645: DEBUG/(1035): @@(Audiofx_transport)@@ CodecSetOutputVolume() : is called only while Mode = InCall!! CHR_TEST!!
08-12 13:25:19.675: WARN/IInputConnectionWrapper(9893): showStatusIcon on inactive InputConnection
[B]08-12 13:25:19.715: DEBUG/CallVolume(23892): sibbor's brillant app changed volume [max]: 5[/B]
08-12 13:25:19.725: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=-1, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:19.725: DEBUG/(1035): @@(Audiofx_transport)@@ CodecSetOutputVolume() : OutputSelect = -1 CHR_TEST!!
08-12 13:25:19.725: DEBUG/(1035): @@(Audiofx_transport)@@ CodecSetOutputVolume() : is called only while Mode = InCall!! CHR_TEST!!
08-12 13:25:19.735: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:19.735: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:19.735: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:19.735: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:19.775: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
[B]08-12 13:25:19.785: DEBUG/CallVolume(23892): sibbor's brillant app changed volume [back] to: 0
08-12 13:25:19.785: DEBUG/CallVolume(23892): ----- VolumeFixer: end -----[/B]
08-12 13:25:20.175: DEBUG/AccelerometerListener(1290): orientation: horizontal
08-12 13:25:21.845: DEBUG/dalvikvm(1256): GC_CONCURRENT freed 720K, 53% free 3246K/6855K, external 1646K/1947K, paused 5ms+7ms
08-12 13:25:22.455: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:22.455: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:22.455: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:22.455: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:22.465: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:24.015: DEBUG/dalvikvm(1444): GC_CONCURRENT freed 569K, 50% free 3508K/6919K, external 1243K/1755K, paused 2ms+2ms
08-12 13:25:24.785: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:24.785: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:24.785: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:24.785: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:24.795: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:27.985: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:27.985: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:27.985: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:27.985: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:27.985: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:28.055: VERBOSE/NotificationService(1138): Active profile: Default
08-12 13:25:28.055: INFO/PROFILE(1138): Group: Gmail containing : com.android.phone : false
08-12 13:25:28.055: INFO/PROFILE(1138): Group: Phone containing : com.android.phone : true
08-12 13:25:28.055: VERBOSE/NotificationService(1138): Pkg: com.android.phone group: Phone
08-12 13:25:28.055: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:28.365: INFO/AudioService(1138): AudioFocus abandonAudioFocus() from AudioFocus_For_Phone_Ring_And_Calls
08-12 13:25:28.375: INFO/PowerManagerService(1138): clearUserActivity for 10000ms from now
08-12 13:25:28.405: DEBUG/AudioFlinger(1029): setParameters(): io 0, keyvalue nv_a2dp_routing=0, tid 1111, calling tid 1029
08-12 13:25:28.405: WARN/(1029): @@(Device.cpp-hal)@@ setOutputDevice(), device is 0 return
08-12 13:25:28.425: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxEventPowerStateChange - NvAudioFxPowerState_Full CHR_TEST!!
08-12 13:25:28.425: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 2, IsEnable = 1 CHR_TEST!!
08-12 13:25:28.425: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 1, IsEnable = 1 CHR_TEST!!
08-12 13:25:28.425: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 8, IsEnable = 1 CHR_TEST!!
08-12 13:25:28.425: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxEventPowerStateChange - NvAudioFxPowerState_Low CHR_TEST!!
08-12 13:25:28.465: INFO/dalvikvm(9893): Jit: resizing JitTable from 8192 to 16384
08-12 13:25:28.515: DEBUG/AudioFlinger(1029): setParameters(): io 0, keyvalue nv_a2dp_routing=0, tid 1111, calling tid 1029
08-12 13:25:28.515: WARN/(1029): @@(Device.cpp-hal)@@ setOutputDevice(), device is 0 return
08-12 13:25:28.615: INFO/ActivityManager(1138): Starting: Intent { act=android.intent.action.VIEW typ=vnd.android.cursor.dir/calls flg=0x10000 cmp=com.android.contacts/.DialtactsActivity } from pid 1290
08-12 13:25:28.625: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.625: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() speaker device not found
08-12 13:25:28.625: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.625: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() speaker device not found
08-12 13:25:28.625: DEBUG/AudioFlinger(1029): setParameters(): io 0, keyvalue nv_a2dp_routing=0, tid 1111, calling tid 1029
08-12 13:25:28.625: WARN/(1029): @@(Device.cpp-hal)@@ setOutputDevice(), device is 0 return
08-12 13:25:28.635: DEBUG/AudioHardwareInterface(1029): setMode(NORMAL)
08-12 13:25:28.635: DEBUG/(1035): @@(Audiofx_transport)@@ SetMode() Mode = 0 CHR_TEST!!
08-12 13:25:28.635: DEBUG/(1035): @@(Audiofx_transport)@@ CodecSetOutputVolume() : OutputSelect = 0 CHR_TEST!!
08-12 13:25:28.635: DEBUG/(1035): @@(Audiofx_transport)@@ CodecSetOutputVolume() : Normal Mode Default Codec Volume Setting!! CHR_TEST!!
08-12 13:25:28.635: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.635: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.635: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.635: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.635: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.635: ERROR/AudioPolicyManager(1029): getDeviceForStrategy() device2 0
08-12 13:25:28.635: DEBUG/AudioFlinger(1029): setParameters(): io 1, keyvalue routing=1, tid 1111, calling tid 1029
08-12 13:25:28.635: INFO/ActivityManager(1138): moveTaskToBack: 119
08-12 13:25:28.645: WARN/(1029): @@(Device.cpp-hal)@@ setOutputDevice(), device = 1
08-12 13:25:28.645: DEBUG/AudioFlinger(1029): setParameters(): io 0, keyvalue nv_a2dp_routing=0, tid 1111, calling tid 1029
08-12 13:25:28.645: WARN/(1029): @@(Device.cpp-hal)@@ setOutputDevice(), device is 0 return
08-12 13:25:28.645: DEBUG/AudioFlinger(1029): setParameters(): io 0, keyvalue RINGTONE_VOLUME=100, tid 1111, calling tid 1029
08-12 13:25:28.685: DEBUG/AccelerometerListener(1290): enable(false)
08-12 13:25:28.695: DEBUG/(1035): @@(Audiofx_transport)@@ SetInput() Mode = 0, InputSelect =0 CHR_TEST!!
08-12 13:25:28.695: DEBUG/(1035): @@(Audiofx_transport)@@ SetOutput() - hDriver->Mode = 0, OutputSelect = 512 CHR_TEST!!
08-12 13:25:28.705: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 2, IsEnable = 1 CHR_TEST!!
08-12 13:25:28.705: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 1, IsEnable = 1 CHR_TEST!!
08-12 13:25:28.705: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 8, IsEnable = 1 CHR_TEST!!
08-12 13:25:28.715: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 2, IsEnable = 0 CHR_TEST!!
08-12 13:25:28.715: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 4, IsEnable = 0 CHR_TEST!!
08-12 13:25:28.735: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxIoProperty_OutputSelect(I2S) : OutputSelect = 512 CHR_TEST!!
08-12 13:25:28.735: DEBUG/(1035): @@(Audiofx_transport)@@ SetOutput() - hDriver->Mode = 0, OutputSelect = 512 CHR_TEST!!
08-12 13:25:28.735: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxIoProperty_OutputSelect(Spdif) : OutputSelect = 0 CHR_TEST!!
08-12 13:25:28.735: DEBUG/(1035): @@(Audiofx_transport)@@ SetOutput() - hDriver->Mode = 0, OutputSelect = 512 CHR_TEST!!
08-12 13:25:28.735: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=2, LeftVolume=0, RightVolume=0, Mute=0 CHR_TEST!!
08-12 13:25:28.865: INFO/ActivityManager(1138): Displayed com.android.contacts/.DialtactsActivity: +209ms (total +9s617ms)
08-12 13:25:31.315: DEBUG/dalvikvm(1444): GC_CONCURRENT freed 568K, 50% free 3511K/6919K, external 1243K/1755K, paused 3ms+3ms
08-12 13:25:31.605: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxEventPowerStateChange - NvAudioFxPowerState_Full CHR_TEST!!
08-12 13:25:32.455: INFO/TelephonyRegistry(1138): notifyServiceState: 0 home Sweden 3G Sweden3G 24005 HSPA CSS not supported -1 -1RoamInd: -1DefRoamInd: -1EmergOnly: false
08-12 13:25:32.465: INFO/TelephonyRegistry(1138): notifyDataConnection: state=2 isDataConnectivityPossible=true reason=null interfaceName=vsnet0 networkType=10
08-12 13:25:32.628: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread() - NvAudioFxEventPowerStateChange - NvAudioFxPowerState_Off CHR_TEST!!
08-12 13:25:32.628: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 2, IsEnable = 0 CHR_TEST!!
08-12 13:25:32.635: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 8, IsEnable = 0 CHR_TEST!!
08-12 13:25:32.635: DEBUG/(1035): @@(Audiofx_transport)@@ SetAudioPort() PortDirection = 1, IsEnable =0 CHR_TEST!!
08-12 13:25:32.635: DEBUG/(1035): @@(Audiofx_transport)@@ SetAudioPort() PortDirection = 2, IsEnable =0 CHR_TEST!!
08-12 13:25:32.635: DEBUG/(1035): @@(Audiofx_transport)@@ SetPower() Port = 1, IsEnable = 0 CHR_TEST!!
08-12 13:25:33.775: DEBUG/dalvikvm(1444): GC_CONCURRENT freed 568K, 50% free 3521K/6919K, external 1243K/1755K, paused 3ms+2ms

EDIT: this shows LeftVolume=6, RightVolume=6 (interval 1-6?), which I assume is the highest volume? According to my app the highest volume is 5 (interval 0-5). I ask you Ricardo, if there anyway this produces the high level of sound? Shouldn't it use the remembered [preferred] volume level from the previous call and initialize it accordingly.

08-12 13:25:19.645: DEBUG/(1035): @@(Audiofx_transport)@@ NvAudioFxNotifierThread()-IoDeviceVolume, IoDevice=-1, LeftVolume=6, RightVolume=6, Mute=0 CHR_TEST!!