CEC: Replace determistic mute commands

Compatibility issues on deterministic mute control commands
<MUTE_FUNCTION>/<RESTORE_AUDIO_VOLUME> are hard to get around.
This CL falls back to going with a non-deterministic one <MUTE>.

Bug: 24986703
Change-Id: Ia4cc0cf5ce6846a8d3bfbe638487b76a9986de89
(cherry picked from commit bae1d89e5734c9a4341681712deb63213b0b8452)
diff --git a/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java b/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java
index 2eca42b..adc1cd7 100644
--- a/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java
+++ b/services/core/java/com/android/server/hdmi/HdmiCecKeycode.java
@@ -448,4 +448,20 @@
     static boolean isSupportedKeycode(int androidKeycode) {
         return HdmiCecKeycode.androidKeyToCecKey(androidKeycode) != null;
     }
+
+    /**
+     * Returns CEC keycode to control audio mute status.
+     *
+     * @param muting {@code true} if audio is being muted
+     */
+    public static int getMuteKey(boolean muting) {
+        // CEC_KEYCODE_MUTE_FUNCTION, CEC_KEYCODE_RESTORE_VOLUME_FUNCTION are deterministic
+        // commands that ensures the status changes to what we want, while CEC_KEYCODE_MUTE
+        // simply toggles the status.
+        // The former is a better choice in this regard, but there are compatibility issues
+        // observed - many audio receivers don't recognize the commands. We fall back on
+        // CEC_KEYCODE_MUTE for now.
+        // return muting ? CEC_KEYCODE_MUTE_FUNCTION : CEC_KEYCODE_RESTORE_VOLUME_FUNCTION;
+        return CEC_KEYCODE_MUTE;
+    }
 }