Search in sources :

Example 21 with HdmiDeviceInfo

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

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 22 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method updateActiveInput.

@ServiceThreadOnly
void updateActiveInput(int path, boolean notifyInputChange) {
    assertRunOnServiceThread();
    // Seq #15
    setActivePath(path);
    // Show OSD port change banner
    if (notifyInputChange) {
        ActiveSource activeSource = getActiveSource();
        HdmiDeviceInfo info = getCecDeviceInfo(activeSource.logicalAddress);
        if (info == null) {
            info = mService.getDeviceInfoByPort(getActivePortId());
            if (info == null) {
                // No CEC/MHL device is present at the port. Attempt to switch to
                // the hardware port itself for non-CEC devices that may be connected.
                info = new HdmiDeviceInfo(path, getActivePortId());
            }
        }
        mService.invokeInputChangeListener(info);
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 23 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method handleActiveSource.

@Override
@ServiceThreadOnly
protected boolean handleActiveSource(HdmiCecMessage message) {
    assertRunOnServiceThread();
    int logicalAddress = message.getSource();
    int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
    HdmiDeviceInfo info = getCecDeviceInfo(logicalAddress);
    if (info == null) {
        if (!handleNewDeviceAtTheTailOfActivePath(physicalAddress)) {
            HdmiLogger.debug("Device info %X not found; buffering the command", logicalAddress);
            mDelayedMessageBuffer.add(message);
        }
    } else if (isInputReady(info.getId()) || info.getDeviceType() == HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
        updateDevicePowerStatus(logicalAddress, HdmiControlManager.POWER_STATUS_ON);
        ActiveSource activeSource = ActiveSource.of(logicalAddress, physicalAddress);
        ActiveSourceHandler.create(this, null).process(activeSource, info.getDeviceType());
    } else {
        HdmiLogger.debug("Input not ready for device: %X; buffering the command", info.getId());
        mDelayedMessageBuffer.add(message);
    }
    return true;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 24 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method handleInactiveSource.

@Override
@ServiceThreadOnly
protected boolean handleInactiveSource(HdmiCecMessage message) {
    assertRunOnServiceThread();
    // Ignore <Inactive Source> from non-active source device.
    if (getActiveSource().logicalAddress != message.getSource()) {
        return true;
    }
    if (isProhibitMode()) {
        return true;
    }
    int portId = getPrevPortId();
    if (portId != Constants.INVALID_PORT_ID) {
        // TODO: Do this only if TV is not showing multiview like PIP/PAP.
        HdmiDeviceInfo inactiveSource = getCecDeviceInfo(message.getSource());
        if (inactiveSource == null) {
            return true;
        }
        if (mService.pathToPortId(inactiveSource.getPhysicalAddress()) == portId) {
            return true;
        }
        // TODO: Switch the TV freeze mode off
        doManualPortSwitching(portId, null);
        setPrevPortId(Constants.INVALID_PORT_ID);
    } else {
        // No HDMI port to switch to was found. Notify the input change listers to
        // switch to the lastly shown internal input.
        mActiveSource.invalidate();
        setActivePath(Constants.INVALID_PHYSICAL_ADDRESS);
        mService.invokeInputChangeListener(HdmiDeviceInfo.INACTIVE_DEVICE);
    }
    return true;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 25 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method addDeviceInfo.

/**
     * Add a new {@link HdmiDeviceInfo}. It returns old device info which has the same
     * logical address as new device info's.
     *
     * <p>Declared as package-private. accessed by {@link HdmiControlService} only.
     *
     * @param deviceInfo a new {@link HdmiDeviceInfo} to be added.
     * @return {@code null} if it is new device. Otherwise, returns old {@HdmiDeviceInfo}
     *         that has the same logical address as new one has.
     */
@ServiceThreadOnly
private HdmiDeviceInfo addDeviceInfo(HdmiDeviceInfo deviceInfo) {
    assertRunOnServiceThread();
    HdmiDeviceInfo oldDeviceInfo = getCecDeviceInfo(deviceInfo.getLogicalAddress());
    if (oldDeviceInfo != null) {
        removeDeviceInfo(deviceInfo.getId());
    }
    mDeviceInfos.append(deviceInfo.getId(), deviceInfo);
    updateSafeDeviceInfoList();
    return oldDeviceInfo;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Aggregations

HdmiDeviceInfo (android.hardware.hdmi.HdmiDeviceInfo)172 ServiceThreadOnly (com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)110 ArrayList (java.util.ArrayList)15 TvInputHardwareInfo (android.media.tv.TvInputHardwareInfo)12 HdmiPortInfo (android.hardware.hdmi.HdmiPortInfo)10 SendMessageCallback (com.android.server.hdmi.HdmiControlService.SendMessageCallback)10 IHdmiControlCallback (android.hardware.hdmi.IHdmiControlCallback)5 RemoteException (android.os.RemoteException)5 ArraySet (android.util.ArraySet)5 SparseArray (android.util.SparseArray)5 SparseIntArray (android.util.SparseIntArray)5 InputChannel (android.view.InputChannel)5 SomeArgs (com.android.internal.os.SomeArgs)5 DeviceDiscoveryCallback (com.android.server.hdmi.DeviceDiscoveryAction.DeviceDiscoveryCallback)5 AllocateAddressCallback (com.android.server.hdmi.HdmiCecController.AllocateAddressCallback)5 ActiveSource (com.android.server.hdmi.HdmiCecLocalDevice.ActiveSource)5 UnsupportedEncodingException (java.io.UnsupportedEncodingException)5 BitSet (java.util.BitSet)5 TvInputInfo (android.media.tv.TvInputInfo)4 Message (android.os.Message)4