diff options
| author | 2021-02-03 11:53:44 +0530 | |
|---|---|---|
| committer | 2021-03-08 13:32:09 +0000 | |
| commit | aa27088a4858d15d83c71e69248e41b0c78cb7e1 (patch) | |
| tree | 18c835fef510dd87637c356c30e886fa14195ed7 | |
| parent | 48cbc2b34a3f0cb9d814f0be9890205ba7d2332b (diff) | |
HDMICEC: Add setarc shell command
Add command to set the ARC mode ON or OFF on TV devices.
Bug: 177973980
Test: adb shell cmd hdmi_control setarc on
Change-Id: I1f9882f21245c7580f24678acac558e5a847d524
| -rw-r--r-- | services/core/java/com/android/server/hdmi/HdmiControlShellCommand.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlShellCommand.java b/services/core/java/com/android/server/hdmi/HdmiControlShellCommand.java index 740407c42178..e2330849d66d 100644 --- a/services/core/java/com/android/server/hdmi/HdmiControlShellCommand.java +++ b/services/core/java/com/android/server/hdmi/HdmiControlShellCommand.java @@ -86,6 +86,8 @@ final class HdmiControlShellCommand extends ShellCommand { pw.println(" Send a Vendor Command to the given target device"); pw.println(" setsystemaudiomode, setsam [on|off]"); pw.println(" Sets the System Audio Mode feature on or off on TV devices"); + pw.println(" setarc [on|off]"); + pw.println(" Sets the ARC feature on or off on TV devices"); } private int handleShellCommand(String cmd) throws RemoteException { @@ -100,6 +102,8 @@ final class HdmiControlShellCommand extends ShellCommand { case "setsystemaudiomode": case "setsam": return setSystemAudioMode(pw); + case "setarc": + return setArcMode(pw); } getErrPrintWriter().println("Unhandled command: " + cmd); @@ -188,6 +192,27 @@ final class HdmiControlShellCommand extends ShellCommand { return mCecResult.get() == HdmiControlManager.RESULT_SUCCESS ? 0 : 1; } + private int setArcMode(PrintWriter pw) throws RemoteException { + if (1 > getRemainingArgsCount()) { + throw new IllegalArgumentException( + "Please indicate if ARC mode should be turned \"on\" or \"off\"."); + } + + String arg = getNextArg(); + if (arg.equals("on")) { + pw.println("Setting ARC mode on"); + mBinderService.setArcMode(true); + } else if (arg.equals("off")) { + pw.println("Setting ARC mode off"); + mBinderService.setArcMode(false); + } else { + throw new IllegalArgumentException( + "Please indicate if ARC mode should be turned \"on\" or \"off\"."); + } + + return 0; + } + private boolean receiveCallback(String command) { try { if (!mLatch.await(HdmiConfig.TIMEOUT_MS, TimeUnit.MILLISECONDS)) { |