Bug 457778

Summary: Muting an incoming call incorrectly unmutes ringer
Product: [Applications] kdeconnect Reporter: Emily Ellis <emily>
Component: android-applicationAssignee: Albert Vaca Cintora <albertvaka>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Android 11.x   
Latest Commit: Version Fixed In:

Description Emily Ellis 2022-08-11 20:57:24 UTC
SUMMARY
When receiving a call with the ringer muted, and clicking the button to mute the call on the PC side, the phone's ringer is unmuted after the call.

STEPS TO REPRODUCE
1. Have ringer muted.
2. Receive call from obvious telemarketer. Click "mute call" in the PC-side notification.
3. Receive another call.

OBSERVED RESULT
The second call rings at maximum volume.

EXPECTED RESULT
The second call only vibrates, as that was what was set before the first call, and I did not intentionally change it.

SOFTWARE/OS VERSIONS
KDE Connect Linux: 22.04.3
KDE Connect Android: 1.19.1

ADDITIONAL INFORMATION
Scrolling through the source (https://github.com/KDE/kdeconnect-android/blob/305a1d4c78b96e59a57fbe7c119a36cf754605a0/src/org/kde/kdeconnect/Plugins/TelephonyPlugin/TelephonyPlugin.java), I believe what's happening is:
- At startup, the phone is muted, but `isMuted` is false (it is never set to `true` unless KDE Connect mutes the ringer itself).
- First call comes in, `unmuteRinger()` is called unconditionally (:175), but does nothing because `isMuted` is false (:217). This is actually the correct behavior, but for the wrong reason.
- I click the mute button. `muteRinger()` is called, it mutes the ringer (which was already muted) and sets `isMuted = true` (:236).
- I don't answer the call, it gets rejected, `unmuteRinger()` is called (:197). This time, `isMuted` matches the actual mute state of the phone, so `unmuteRinger()` unmutes the ringer.