Loading api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2224,6 +2224,7 @@ package android.hardware.hdmi { public class HdmiSwitchClient extends android.hardware.hdmi.HdmiClient { method public int getDeviceType(); method @NonNull public java.util.List<android.hardware.hdmi.HdmiPortInfo> 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); } Loading core/java/android/hardware/hdmi/HdmiSwitchClient.java +20 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,26 @@ public class HdmiSwitchClient extends HdmiClient { } } /** * Get the list of the HDMI input port configuration. * * <p>This returns an empty list when the current device does not have HDMI input. * * @return a list of {@link HdmiPortInfo} * * @hide */ @NonNull @SystemApi public List<HdmiPortInfo> getPortInfo() { try { return mService.getPortInfo(); } catch (RemoteException e) { Log.e("TAG", "Failed to call getPortInfo():", e); return Collections.<HdmiPortInfo>emptyList(); } } /** * Listener interface used to get the result of {@link #deviceSelect} or {@link #portSelect}. * Loading services/core/java/com/android/server/hdmi/HdmiControlService.java +18 −6 Original line number Diff line number Diff line Loading @@ -300,7 +300,9 @@ public class HdmiControlService extends SystemService { // HDMI port information. Stored in the unmodifiable list to keep the static information // from being modified. private List<HdmiPortInfo> mPortInfo; // This variable is null if the current device does not have hdmi input. @GuardedBy("mLock") private List<HdmiPortInfo> mPortInfo = null; // Map from path(physical address) to port ID. private UnmodifiableSparseIntArray mPortIdMap; Loading Loading @@ -827,7 +829,7 @@ public class HdmiControlService extends SystemService { // Build HDMI port info list with CEC port info plus MHL supported flag. We can just use // cec port info if we do not have have port that supports MHL. if (mhlSupportedPorts.isEmpty()) { mPortInfo = Collections.unmodifiableList(Arrays.asList(cecPortInfo)); setPortInfo(Collections.unmodifiableList(Arrays.asList(cecPortInfo))); return; } ArrayList<HdmiPortInfo> result = new ArrayList<>(cecPortInfo.length); Loading @@ -839,12 +841,20 @@ public class HdmiControlService extends SystemService { result.add(info); } } mPortInfo = Collections.unmodifiableList(result); setPortInfo(Collections.unmodifiableList(result)); } List<HdmiPortInfo> getPortInfo() { synchronized (mLock) { return mPortInfo; } } void setPortInfo(List<HdmiPortInfo> portInfo) { synchronized (mLock) { mPortInfo = portInfo; } } /** * Returns HDMI port information for the given port id. Loading Loading @@ -1641,7 +1651,9 @@ public class HdmiControlService extends SystemService { @Override public List<HdmiPortInfo> getPortInfo() { enforceAccessPermission(); return HdmiControlService.this.getPortInfo(); return HdmiControlService.this.getPortInfo() == null ? Collections.<HdmiPortInfo>emptyList() : HdmiControlService.this.getPortInfo(); } @Override Loading Loading @@ -2155,7 +2167,7 @@ public class HdmiControlService extends SystemService { synchronized (mLock) { if (!mHotplugEventListenerRecords.contains(record)) return; } for (HdmiPortInfo port : mPortInfo) { for (HdmiPortInfo port : getPortInfo()) { HdmiHotplugEvent event = new HdmiHotplugEvent(port.getId(), mCecController.isConnected(port.getId())); synchronized (mLock) { Loading Loading
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2224,6 +2224,7 @@ package android.hardware.hdmi { public class HdmiSwitchClient extends android.hardware.hdmi.HdmiClient { method public int getDeviceType(); method @NonNull public java.util.List<android.hardware.hdmi.HdmiPortInfo> 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); } Loading
core/java/android/hardware/hdmi/HdmiSwitchClient.java +20 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,26 @@ public class HdmiSwitchClient extends HdmiClient { } } /** * Get the list of the HDMI input port configuration. * * <p>This returns an empty list when the current device does not have HDMI input. * * @return a list of {@link HdmiPortInfo} * * @hide */ @NonNull @SystemApi public List<HdmiPortInfo> getPortInfo() { try { return mService.getPortInfo(); } catch (RemoteException e) { Log.e("TAG", "Failed to call getPortInfo():", e); return Collections.<HdmiPortInfo>emptyList(); } } /** * Listener interface used to get the result of {@link #deviceSelect} or {@link #portSelect}. * Loading
services/core/java/com/android/server/hdmi/HdmiControlService.java +18 −6 Original line number Diff line number Diff line Loading @@ -300,7 +300,9 @@ public class HdmiControlService extends SystemService { // HDMI port information. Stored in the unmodifiable list to keep the static information // from being modified. private List<HdmiPortInfo> mPortInfo; // This variable is null if the current device does not have hdmi input. @GuardedBy("mLock") private List<HdmiPortInfo> mPortInfo = null; // Map from path(physical address) to port ID. private UnmodifiableSparseIntArray mPortIdMap; Loading Loading @@ -827,7 +829,7 @@ public class HdmiControlService extends SystemService { // Build HDMI port info list with CEC port info plus MHL supported flag. We can just use // cec port info if we do not have have port that supports MHL. if (mhlSupportedPorts.isEmpty()) { mPortInfo = Collections.unmodifiableList(Arrays.asList(cecPortInfo)); setPortInfo(Collections.unmodifiableList(Arrays.asList(cecPortInfo))); return; } ArrayList<HdmiPortInfo> result = new ArrayList<>(cecPortInfo.length); Loading @@ -839,12 +841,20 @@ public class HdmiControlService extends SystemService { result.add(info); } } mPortInfo = Collections.unmodifiableList(result); setPortInfo(Collections.unmodifiableList(result)); } List<HdmiPortInfo> getPortInfo() { synchronized (mLock) { return mPortInfo; } } void setPortInfo(List<HdmiPortInfo> portInfo) { synchronized (mLock) { mPortInfo = portInfo; } } /** * Returns HDMI port information for the given port id. Loading Loading @@ -1641,7 +1651,9 @@ public class HdmiControlService extends SystemService { @Override public List<HdmiPortInfo> getPortInfo() { enforceAccessPermission(); return HdmiControlService.this.getPortInfo(); return HdmiControlService.this.getPortInfo() == null ? Collections.<HdmiPortInfo>emptyList() : HdmiControlService.this.getPortInfo(); } @Override Loading Loading @@ -2155,7 +2167,7 @@ public class HdmiControlService extends SystemService { synchronized (mLock) { if (!mHotplugEventListenerRecords.contains(record)) return; } for (HdmiPortInfo port : mPortInfo) { for (HdmiPortInfo port : getPortInfo()) { HdmiHotplugEvent event = new HdmiHotplugEvent(port.getId(), mCecController.isConnected(port.getId())); synchronized (mLock) { Loading