Search in sources :

Example 6 with HdmiPortInfo

use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by ResurrectionRemix.

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();
}
Also used : HdmiPortInfo(android.hardware.hdmi.HdmiPortInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 7 with HdmiPortInfo

use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by DirtyUnicorns.

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);
                }
            }
        }
    });
}
Also used : HdmiPortInfo(android.hardware.hdmi.HdmiPortInfo) HdmiHotplugEvent(android.hardware.hdmi.HdmiHotplugEvent) RemoteException(android.os.RemoteException)

Example 8 with HdmiPortInfo

use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by AOSPA.

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();
}
Also used : HdmiPortInfo(android.hardware.hdmi.HdmiPortInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 9 with HdmiPortInfo

use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by AOSPA.

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);
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) HdmiPortInfo(android.hardware.hdmi.HdmiPortInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 10 with HdmiPortInfo

use of android.hardware.hdmi.HdmiPortInfo in project android_frameworks_base by crdroidandroid.

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);
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ArraySet(android.util.ArraySet) HdmiPortInfo(android.hardware.hdmi.HdmiPortInfo) ArrayList(java.util.ArrayList) SparseArray(android.util.SparseArray) SparseIntArray(android.util.SparseIntArray) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Aggregations

HdmiPortInfo (android.hardware.hdmi.HdmiPortInfo)20 ServiceThreadOnly (com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)15 HdmiDeviceInfo (android.hardware.hdmi.HdmiDeviceInfo)10 HdmiHotplugEvent (android.hardware.hdmi.HdmiHotplugEvent)5 RemoteException (android.os.RemoteException)5 ArraySet (android.util.ArraySet)5 SparseArray (android.util.SparseArray)5 SparseIntArray (android.util.SparseIntArray)5 ArrayList (java.util.ArrayList)5