Search in sources :

Example 1 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

the class HdmiCecLocalDeviceTv method updateDevicePowerStatus.

void updateDevicePowerStatus(int logicalAddress, int newPowerStatus) {
    HdmiDeviceInfo info = getCecDeviceInfo(logicalAddress);
    if (info == null) {
        Slog.w(TAG, "Can not update power status of non-existing device:" + logicalAddress);
        return;
    }
    if (info.getDevicePowerStatus() == newPowerStatus) {
        return;
    }
    HdmiDeviceInfo newInfo = HdmiUtils.cloneHdmiDeviceInfo(info, newPowerStatus);
    // addDeviceInfo replaces old device info with new one if exists.
    addDeviceInfo(newInfo);
    invokeDeviceEventListener(newInfo, HdmiControlManager.DEVICE_EVENT_UPDATE_DEVICE);
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo)

Example 2 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

the class HdmiCecLocalDeviceTv method launchDeviceDiscovery.

@ServiceThreadOnly
private void launchDeviceDiscovery() {
    assertRunOnServiceThread();
    clearDeviceInfoList();
    DeviceDiscoveryAction action = new DeviceDiscoveryAction(this, new DeviceDiscoveryCallback() {

        @Override
        public void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos) {
            for (HdmiDeviceInfo info : deviceInfos) {
                addCecDevice(info);
            }
            // we should put device info of local device manually here
            for (HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
                addCecDevice(device.getDeviceInfo());
            }
            mSelectRequestBuffer.process();
            resetSelectRequestBuffer();
            addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
            addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
            // If there is AVR, initiate System Audio Auto initiation action,
            // which turns on and off system audio according to last system
            // audio setting.
            HdmiDeviceInfo avr = getAvrDeviceInfo();
            if (avr != null) {
                onNewAvrAdded(avr);
            } else {
                setSystemAudioMode(false, true);
            }
        }
    });
    addAndStartAction(action);
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) DeviceDiscoveryCallback(com.android.server.hdmi.DeviceDiscoveryAction.DeviceDiscoveryCallback) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 3 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

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

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

the class HdmiCecLocalDeviceTv method disableArcIfExist.

@ServiceThreadOnly
private void disableArcIfExist() {
    assertRunOnServiceThread();
    HdmiDeviceInfo avr = getAvrDeviceInfo();
    if (avr == null) {
        return;
    }
    // Seq #44.
    removeAction(RequestArcInitiationAction.class);
    if (!hasAction(RequestArcTerminationAction.class) && isArcEstablished()) {
        addAndStartAction(new RequestArcTerminationAction(this, avr.getLogicalAddress()));
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 5 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

the class HdmiControlService method changeInputForMhl.

/**
     * Performs input change, routing control for MHL device.
     *
     * @param portId MHL port, or the last port to go back to if {@code contentOn} is false
     * @param contentOn {@code true} if RAP data is content on; otherwise false
     */
@ServiceThreadOnly
void changeInputForMhl(int portId, boolean contentOn) {
    assertRunOnServiceThread();
    if (tv() == null)
        return;
    final int lastInput = contentOn ? tv().getActivePortId() : Constants.INVALID_PORT_ID;
    if (portId != Constants.INVALID_PORT_ID) {
        tv().doManualPortSwitching(portId, new IHdmiControlCallback.Stub() {

            @Override
            public void onComplete(int result) throws RemoteException {
                // Keep the last input to switch back later when RAP[ContentOff] is received.
                // This effectively sets the port to invalid one if the switching is for
                // RAP[ContentOff].
                setLastInputForMhl(lastInput);
            }
        });
    }
    // MHL device is always directly connected to the port. Update the active port ID to avoid
    // unnecessary post-routing control task.
    tv().setActivePortId(portId);
    // The port is either the MHL-enabled port where the mobile device is connected, or
    // the last port to go back to when turnoff command is received. Note that the last port
    // may not be the MHL-enabled one. In this case the device info to be passed to
    // input change listener should be the one describing the corresponding HDMI port.
    HdmiMhlLocalDeviceStub device = mMhlController.getLocalDevice(portId);
    HdmiDeviceInfo info = (device != null) ? device.getInfo() : mPortDeviceMap.get(portId, HdmiDeviceInfo.INACTIVE_DEVICE);
    invokeInputChangeListener(info);
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) IHdmiControlCallback(android.hardware.hdmi.IHdmiControlCallback) RemoteException(android.os.RemoteException) 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