use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by crdroidandroid.
the class HdmiCecLocalDeviceTv method onAddressAllocated.
@Override
@ServiceThreadOnly
protected void onAddressAllocated(int logicalAddress, int reason) {
assertRunOnServiceThread();
List<HdmiPortInfo> ports = mService.getPortInfo();
for (HdmiPortInfo port : ports) {
mArcFeatureEnabled.put(port.getId(), port.isArcSupported());
}
mService.registerTvInputCallback(mTvInputCallback);
mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(mAddress, mService.getPhysicalAddress(), mDeviceType));
mService.sendCecCommand(HdmiCecMessageBuilder.buildDeviceVendorIdCommand(mAddress, mService.getVendorId()));
// TV is a CEC switch too.
mCecSwitches.add(mService.getPhysicalAddress());
mTvInputs.clear();
mSkipRoutingControl = (reason == HdmiControlService.INITIATED_BY_WAKE_UP_MESSAGE);
launchRoutingControl(reason != HdmiControlService.INITIATED_BY_ENABLE_CEC && reason != HdmiControlService.INITIATED_BY_BOOT_UP);
mLocalDeviceAddresses = initLocalDeviceAddresses();
resetSelectRequestBuffer();
launchDeviceDiscovery();
}
use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by crdroidandroid.
the class HdmiCecLocalDeviceTv method updateArcFeatureStatus.
@ServiceThreadOnly
private void updateArcFeatureStatus(int portId, boolean isConnected) {
assertRunOnServiceThread();
HdmiPortInfo portInfo = mService.getPortInfo(portId);
if (!portInfo.isArcSupported()) {
return;
}
HdmiDeviceInfo avr = getAvrDeviceInfo();
if (avr == null) {
if (isConnected) {
// Update the status (since TV may not have seen AVR yet) so
// that ARC can be initiated after discovery.
mArcFeatureEnabled.put(portId, isConnected);
}
return;
}
// Should not activate ARC if +5V status is false.
if (avr.getPortId() == portId) {
changeArcFeatureEnabled(portId, isConnected);
}
}
use of android.hardware.hdmi.HdmiPortInfo in project platform_frameworks_base by android.
the class HdmiCecLocalDeviceTv method updateArcFeatureStatus.
@ServiceThreadOnly
private void updateArcFeatureStatus(int portId, boolean isConnected) {
assertRunOnServiceThread();
HdmiPortInfo portInfo = mService.getPortInfo(portId);
if (!portInfo.isArcSupported()) {
return;
}
HdmiDeviceInfo avr = getAvrDeviceInfo();
if (avr == null) {
if (isConnected) {
// Update the status (since TV may not have seen AVR yet) so
// that ARC can be initiated after discovery.
mArcFeatureEnabled.put(portId, isConnected);
}
return;
}
// Should not activate ARC if +5V status is false.
if (avr.getPortId() == portId) {
changeArcFeatureEnabled(portId, isConnected);
}
}
use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by AOSPA.
the class HdmiControlService method initPortInfo.
// Initialize HDMI port information. Combine the information from CEC and MHL HAL and
// keep them in one place.
@ServiceThreadOnly
private void initPortInfo() {
assertRunOnServiceThread();
HdmiPortInfo[] cecPortInfo = null;
// each port. Return empty array if CEC HAL didn't provide the info.
if (mCecController != null) {
cecPortInfo = mCecController.getPortInfos();
}
if (cecPortInfo == null) {
return;
}
SparseArray<HdmiPortInfo> portInfoMap = new SparseArray<>();
SparseIntArray portIdMap = new SparseIntArray();
SparseArray<HdmiDeviceInfo> portDeviceMap = new SparseArray<>();
for (HdmiPortInfo info : cecPortInfo) {
portIdMap.put(info.getAddress(), info.getId());
portInfoMap.put(info.getId(), info);
portDeviceMap.put(info.getId(), new HdmiDeviceInfo(info.getAddress(), info.getId()));
}
mPortIdMap = new UnmodifiableSparseIntArray(portIdMap);
mPortInfoMap = new UnmodifiableSparseArray<>(portInfoMap);
mPortDeviceMap = new UnmodifiableSparseArray<>(portDeviceMap);
HdmiPortInfo[] mhlPortInfo = mMhlController.getPortInfos();
ArraySet<Integer> mhlSupportedPorts = new ArraySet<Integer>(mhlPortInfo.length);
for (HdmiPortInfo info : mhlPortInfo) {
if (info.isMhlSupported()) {
mhlSupportedPorts.add(info.getId());
}
}
// cec port info if we do not have have port that supports MHL.
if (mhlSupportedPorts.isEmpty()) {
mPortInfo = Collections.unmodifiableList(Arrays.asList(cecPortInfo));
return;
}
ArrayList<HdmiPortInfo> result = new ArrayList<>(cecPortInfo.length);
for (HdmiPortInfo info : cecPortInfo) {
if (mhlSupportedPorts.contains(info.getId())) {
result.add(new HdmiPortInfo(info.getId(), info.getType(), info.getAddress(), info.isCecSupported(), true, info.isArcSupported()));
} else {
result.add(info);
}
}
mPortInfo = Collections.unmodifiableList(result);
}
use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by AOSPA.
the class HdmiControlService method addHotplugEventListener.
private void addHotplugEventListener(final IHdmiHotplugEventListener listener) {
final HotplugEventListenerRecord record = new HotplugEventListenerRecord(listener);
try {
listener.asBinder().linkToDeath(record, 0);
} catch (RemoteException e) {
Slog.w(TAG, "Listener already died");
return;
}
synchronized (mLock) {
mHotplugEventListenerRecords.add(record);
}
// Inform the listener of the initial state of each HDMI port by generating
// hotplug events.
runOnServiceThread(new Runnable() {
@Override
public void run() {
synchronized (mLock) {
if (!mHotplugEventListenerRecords.contains(record))
return;
}
for (HdmiPortInfo port : mPortInfo) {
HdmiHotplugEvent event = new HdmiHotplugEvent(port.getId(), mCecController.isConnected(port.getId()));
synchronized (mLock) {
invokeHotplugEventListenerLocked(listener, event);
}
}
}
});
}
Aggregations