HDMICEC: Deprecate HdmiTvClient#getDeviceList

Move the implementation of the getDeviceList method from HdmiTvClient and HdmiSwitchClient to the HdmiClient abstract class in order to avoid duplicate code and to make it visible for HdmiPlaybackClient.

Add unit test for HdmiCecNetwork#getSafeCecDevicesLocked method which is
called by HdmiControlService#getDeviceList.

Bug: 196043550
Test: make && atest HdmiCecNetworkTest
Change-Id: If4727d582348022a0317d9fce6459d56a7affa5a
This commit is contained in:
Paul Colța
2021-08-11 15:53:54 +00:00
parent 62962cb74a
commit 35cc37299c
4 changed files with 14 additions and 1 deletions

View File

@@ -3638,7 +3638,7 @@ package android.hardware.hdmi {
public final class HdmiTvClient extends android.hardware.hdmi.HdmiClient {
method public void clearTimerRecording(int, int, android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource);
method public void deviceSelect(int, @NonNull android.hardware.hdmi.HdmiTvClient.SelectCallback);
method public java.util.List<android.hardware.hdmi.HdmiDeviceInfo> getDeviceList();
method @Deprecated public java.util.List<android.hardware.hdmi.HdmiDeviceInfo> getDeviceList();
method public int getDeviceType();
method public void portSelect(int, @NonNull android.hardware.hdmi.HdmiTvClient.SelectCallback);
method public void sendMhlVendorCommand(int, int, int, byte[]);

View File

@@ -165,7 +165,9 @@ public class HdmiSwitchClient extends HdmiClient {
* there is none.
*
* @hide
* @deprecated Please use {@link HdmiControlManager#getConnectedDevices()} instead.
*/
@Deprecated
public List<HdmiDeviceInfo> getDeviceList() {
try {
return mService.getDeviceList();

View File

@@ -158,7 +158,9 @@ public final class HdmiTvClient extends HdmiClient {
*
* @return list of {@link HdmiDeviceInfo} for connected CEC devices.
* Empty list is returned if there is none.
* @deprecated Please use {@link HdmiControlManager#getConnectedDevices()} instead.
*/
@Deprecated
public List<HdmiDeviceInfo> getDeviceList() {
try {
return mService.getDeviceList();

View File

@@ -542,4 +542,13 @@ public class HdmiCecNetworkTest {
assertThat(cecDeviceInfo.getLogicalAddress()).isEqualTo(logicalAddress);
assertThat(cecDeviceInfo.getCecVersion()).isEqualTo(cecVersion);
}
@Test
public void getSafeCecDevicesLocked_addDevice_sizeOne() {
HdmiDeviceInfo cecDeviceInfo = new HdmiDeviceInfo();
mHdmiCecNetwork.addCecDevice(cecDeviceInfo);
assertThat(mHdmiCecNetwork.getSafeCecDevicesLocked()).hasSize(1);
}
}