Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5f6d404e authored by Donghyun Cho's avatar Donghyun Cho
Browse files

Clear calling identity before calling sendKeyEvent

When HdmiControlService#sendKeyEvent is called via AudioService,
permission check should be based on AudioService rather than the caller
of AudioService.

Bug: 27195998
Change-Id: I35f60813b3a48b2957f2bfd576a5f493d77691a7
parent 54f264fc
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -1388,8 +1388,13 @@ public class AudioService extends IAudioService.Stub {
                        synchronized (mHdmiPlaybackClient) {
                            int keyCode = (direction == -1) ? KeyEvent.KEYCODE_VOLUME_DOWN :
                                    KeyEvent.KEYCODE_VOLUME_UP;
                            final long ident = Binder.clearCallingIdentity();
                            try {
                                mHdmiPlaybackClient.sendKeyEvent(keyCode, true);
                                mHdmiPlaybackClient.sendKeyEvent(keyCode, false);
                            } finally {
                                Binder.restoreCallingIdentity(ident);
                            }
                        }
                    }
                }