From 200bbee338a81301be764b8c4147469e9e9902e1 Mon Sep 17 00:00:00 2001 From: Paul Colta Date: Sat, 5 Nov 2022 14:20:05 +0100 Subject: [PATCH] HDMICEC: Expose HdmiControlManager#getPortInfo API Introduce the API HdmiControlManager#getPortInfo. Deprecate HdmiSwitchClient#getPortInfo. Bug: 237067393 Test: m && atest android.hardware.hdmi.cts.HdmiControlManagerTest Change-Id: I7a3c16f862c8ffdfd0bc69637469761728be7a8a --- core/api/system-current.txt | 3 ++- .../hardware/hdmi/HdmiControlManager.java | 16 ++++++++++++++++ .../android/hardware/hdmi/HdmiSwitchClient.java | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 70b89b8af0448..7d2d770fa8638 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -4085,6 +4085,7 @@ package android.hardware.hdmi { method @RequiresPermission(android.Manifest.permission.HDMI_CEC) public int getHdmiCecVolumeControlEnabled(); method public int getPhysicalAddress(); method @Nullable public android.hardware.hdmi.HdmiPlaybackClient getPlaybackClient(); + method @NonNull public java.util.List getPortInfo(); method @NonNull @RequiresPermission(android.Manifest.permission.HDMI_CEC) public String getPowerControlMode(); method @NonNull @RequiresPermission(android.Manifest.permission.HDMI_CEC) public String getPowerStateChangeOnActiveSourceLost(); method @NonNull @RequiresPermission(android.Manifest.permission.HDMI_CEC) public int getRoutingControl(); @@ -4388,7 +4389,7 @@ package android.hardware.hdmi { public class HdmiSwitchClient extends android.hardware.hdmi.HdmiClient { method public int getDeviceType(); - method @NonNull public java.util.List getPortInfo(); + method @Deprecated @NonNull public java.util.List getPortInfo(); method public void selectPort(int, @NonNull android.hardware.hdmi.HdmiSwitchClient.OnSelectListener); method public void selectPort(int, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.hdmi.HdmiSwitchClient.OnSelectListener); } diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java index 3e509e4d1c2f0..cca8688a3a261 100644 --- a/core/java/android/hardware/hdmi/HdmiControlManager.java +++ b/core/java/android/hardware/hdmi/HdmiControlManager.java @@ -1290,6 +1290,22 @@ public final class HdmiControlManager { } } + /** + * Get the list of the HDMI ports configuration. + * + *

This returns an empty list when the current device does not have HDMI ports. + * + * @return a list of {@link HdmiPortInfo} + */ + @NonNull + public List getPortInfo() { + try { + return mService.getPortInfo(); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } + /** * Power off the target device by sending CEC commands. Note that this device can't be the * current device itself. diff --git a/core/java/android/hardware/hdmi/HdmiSwitchClient.java b/core/java/android/hardware/hdmi/HdmiSwitchClient.java index 0fb5894dc4d95..8aaeec3a98fee 100644 --- a/core/java/android/hardware/hdmi/HdmiSwitchClient.java +++ b/core/java/android/hardware/hdmi/HdmiSwitchClient.java @@ -184,7 +184,10 @@ public class HdmiSwitchClient extends HdmiClient { *

This returns an empty list when the current device does not have HDMI input. * * @return a list of {@link HdmiPortInfo} + * + * @deprecated Please use {@link HdmiControlManager#getPortInfo()} instead. */ + @Deprecated @NonNull public List getPortInfo() { try {