CEC: add getDeviceList()

Returns the list of all the connected CEC device information. This is
different from getInputDevices() which returns devices of source type only.

For this, turned the local device address list to unmodifiable so that it can
be used by any threads.

Now respects the device type info passed through <Report Physical Address>
rather than always defaulting to the one from HdmiUtil.getTypeFromAddress().
This ensures future compatibility when a device of reserved logical address
comes with a specific type.

Bug: 18046603
Change-Id: I5f7d5e31706efba1ad5dcf4bcfd4ffc918d1d940
This commit is contained in:
Jinsuk Kim
2014-10-20 10:00:04 +09:00
parent 512c2330c6
commit bdf27fbf74
6 changed files with 73 additions and 18 deletions

View File

@@ -22,6 +22,9 @@ import android.hardware.hdmi.HdmiTimerRecordSources.TimerRecordSource;
import android.os.RemoteException;
import android.util.Log;
import java.util.Collections;
import java.util.List;
import libcore.util.EmptyArray;
/**
@@ -149,6 +152,21 @@ public final class HdmiTvClient extends HdmiClient {
};
}
/**
* Returns all the CEC devices connected to TV.
*
* @return list of {@link HdmiDeviceInfo} for connected CEC devices.
* Empty list is returned if there is none.
*/
public List<HdmiDeviceInfo> getDeviceList() {
try {
return mService.getDeviceList();
} catch (RemoteException e) {
Log.e("TAG", "Failed to call getDeviceList():", e);
return Collections.<HdmiDeviceInfo>emptyList();
}
}
/**
* Set system audio volume
*

View File

@@ -59,6 +59,7 @@ interface IHdmiControlService {
void setSystemAudioMute(boolean mute);
void setInputChangeListener(IHdmiInputChangeListener listener);
List<HdmiDeviceInfo> getInputDevices();
List<HdmiDeviceInfo> getDeviceList();
void sendVendorCommand(int deviceType, int targetAddress, in byte[] params,
boolean hasVendorId);
void addVendorCommandListener(IHdmiVendorCommandListener listener, int deviceType);