Search in sources :

Example 86 with HdmiDeviceInfo

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

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)

Example 87 with HdmiDeviceInfo

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

Example 88 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method startArcAction.

@ServiceThreadOnly
void startArcAction(boolean enabled) {
    assertRunOnServiceThread();
    HdmiDeviceInfo info = getAvrDeviceInfo();
    if (info == null) {
        Slog.w(TAG, "Failed to start arc action; No AVR device.");
        return;
    }
    if (!canStartArcUpdateAction(info.getLogicalAddress(), enabled)) {
        Slog.w(TAG, "Failed to start arc action; ARC configuration check failed.");
        if (enabled && !isConnectedToArcPort(info.getPhysicalAddress())) {
            displayOsd(OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT);
        }
        return;
    }
    // Terminate opposite action and start action if not exist.
    if (enabled) {
        removeAction(RequestArcTerminationAction.class);
        if (!hasAction(RequestArcInitiationAction.class)) {
            addAndStartAction(new RequestArcInitiationAction(this, info.getLogicalAddress()));
        }
    } else {
        removeAction(RequestArcInitiationAction.class);
        if (!hasAction(RequestArcTerminationAction.class)) {
            addAndStartAction(new RequestArcTerminationAction(this, info.getLogicalAddress()));
        }
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 89 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method removeDeviceInfo.

/**
     * Remove a device info corresponding to the given {@code logicalAddress}.
     * It returns removed {@link HdmiDeviceInfo} if exists.
     *
     * <p>Declared as package-private. accessed by {@link HdmiControlService} only.
     *
     * @param id id of device to be removed
     * @return removed {@link HdmiDeviceInfo} it exists. Otherwise, returns {@code null}
     */
@ServiceThreadOnly
private HdmiDeviceInfo removeDeviceInfo(int id) {
    assertRunOnServiceThread();
    HdmiDeviceInfo deviceInfo = mDeviceInfos.get(id);
    if (deviceInfo != null) {
        mDeviceInfos.remove(id);
    }
    updateSafeDeviceInfoList();
    return deviceInfo;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 90 with HdmiDeviceInfo

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

the class ActiveSourceHandler method process.

/**
     * Handles the incoming active source command.
     *
     * @param newActive new active source information
     * @param deviceType device type of the new active source
     */
void process(ActiveSource newActive, int deviceType) {
    // Seq #17
    HdmiCecLocalDeviceTv tv = mSource;
    HdmiDeviceInfo device = mService.getDeviceInfo(newActive.logicalAddress);
    if (device == null) {
        tv.startNewDeviceAction(newActive, deviceType);
    }
    if (!tv.isProhibitMode()) {
        ActiveSource old = ActiveSource.of(tv.getActiveSource());
        tv.updateActiveSource(newActive);
        boolean notifyInputChange = (mCallback == null);
        if (!old.equals(newActive)) {
            tv.setPrevPortId(tv.getActivePortId());
        }
        tv.updateActiveInput(newActive.physicalAddress, notifyInputChange);
        invokeCallback(HdmiControlManager.RESULT_SUCCESS);
    } else {
        // TV is in a mode that should keep its current source/input from
        // being changed for its operation. Reclaim the active source
        // or switch the port back to the one used for the current mode.
        ActiveSource current = tv.getActiveSource();
        if (current.logicalAddress == getSourceAddress()) {
            HdmiCecMessage activeSourceCommand = HdmiCecMessageBuilder.buildActiveSource(current.logicalAddress, current.physicalAddress);
            mService.sendCecCommand(activeSourceCommand);
            tv.updateActiveSource(current);
            invokeCallback(HdmiControlManager.RESULT_SUCCESS);
        } else {
            tv.startRoutingControl(newActive.physicalAddress, current.physicalAddress, true, mCallback);
        }
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ActiveSource(com.android.server.hdmi.HdmiCecLocalDevice.ActiveSource)

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