Use sendVolumeKeyEvent API instead of sendKeyEvent API

sendKeyEvent API always forwards the key control to the TV.
But for volume keys, we want it to be forwarded to the audio system if
system audio mode is on and if we are not a audio system itself.
sendVolumeKeyEvent can handle this logic.

Test: manual
Bug: 129116245
Change-Id: I6b81072ab49c092fac65cd542c19e611fc939cea
(cherry picked from commit ada40f59b63fe613448278a7cfbb7055146f8ccd)
This commit is contained in:
Amy
2019-06-13 15:06:15 -07:00
committed by Amy Zhang
parent b4d7700e7c
commit 94cdf3a2b5

View File

@@ -1917,8 +1917,8 @@ public class AudioService extends IAudioService.Stub
if (keyCode != KeyEvent.KEYCODE_UNKNOWN) { if (keyCode != KeyEvent.KEYCODE_UNKNOWN) {
final long ident = Binder.clearCallingIdentity(); final long ident = Binder.clearCallingIdentity();
try { try {
mHdmiPlaybackClient.sendKeyEvent(keyCode, true); mHdmiPlaybackClient.sendVolumeKeyEvent(keyCode, true);
mHdmiPlaybackClient.sendKeyEvent(keyCode, false); mHdmiPlaybackClient.sendVolumeKeyEvent(keyCode, false);
} finally { } finally {
Binder.restoreCallingIdentity(ident); Binder.restoreCallingIdentity(ident);
} }