Search in sources :

Example 96 with HdmiDeviceInfo

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

the class NewDeviceAction method addDeviceInfo.

private void addDeviceInfo() {
    // The device should be in the device list with default information.
    if (!tv().isInDeviceList(mDeviceLogicalAddress, mDevicePhysicalAddress)) {
        Slog.w(TAG, String.format("Device not found (%02x, %04x)", mDeviceLogicalAddress, mDevicePhysicalAddress));
        return;
    }
    if (mDisplayName == null) {
        mDisplayName = HdmiUtils.getDefaultDeviceName(mDeviceLogicalAddress);
    }
    HdmiDeviceInfo deviceInfo = new HdmiDeviceInfo(mDeviceLogicalAddress, mDevicePhysicalAddress, tv().getPortId(mDevicePhysicalAddress), mDeviceType, mVendorId, mDisplayName);
    tv().addCecDevice(deviceInfo);
    // Consume CEC messages we already got for this newly found device.
    tv().processDelayedMessages(mDeviceLogicalAddress);
    if (HdmiUtils.getTypeFromAddress(mDeviceLogicalAddress) == HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
        tv().onNewAvrAdded(deviceInfo);
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo)

Example 97 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method handleSetOsdName.

@Override
@ServiceThreadOnly
protected boolean handleSetOsdName(HdmiCecMessage message) {
    int source = message.getSource();
    HdmiDeviceInfo deviceInfo = getCecDeviceInfo(source);
    // If the device is not in device list, ignore it.
    if (deviceInfo == null) {
        Slog.e(TAG, "No source device info for <Set Osd Name>." + message);
        return true;
    }
    String osdName = null;
    try {
        osdName = new String(message.getParams(), "US-ASCII");
    } catch (UnsupportedEncodingException e) {
        Slog.e(TAG, "Invalid <Set Osd Name> request:" + message, e);
        return true;
    }
    if (deviceInfo.getDisplayName().equals(osdName)) {
        Slog.i(TAG, "Ignore incoming <Set Osd Name> having same osd name:" + message);
        return true;
    }
    addCecDevice(new HdmiDeviceInfo(deviceInfo.getLogicalAddress(), deviceInfo.getPhysicalAddress(), deviceInfo.getPortId(), deviceInfo.getDeviceType(), deviceInfo.getVendorId(), osdName));
    return true;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 98 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method handleReportPhysicalAddress.

@Override
@ServiceThreadOnly
protected boolean handleReportPhysicalAddress(HdmiCecMessage message) {
    assertRunOnServiceThread();
    int path = HdmiUtils.twoBytesToInt(message.getParams());
    int address = message.getSource();
    int type = message.getParams()[2];
    if (updateCecSwitchInfo(address, type, path))
        return true;
    // Ignore if [Device Discovery Action] is going on.
    if (hasAction(DeviceDiscoveryAction.class)) {
        Slog.i(TAG, "Ignored while Device Discovery Action is in progress: " + message);
        return true;
    }
    if (!isInDeviceList(address, path)) {
        handleNewDeviceAtTheTailOfActivePath(path);
    }
    // Add the device ahead with default information to handle <Active Source>
    // promptly, rather than waiting till the new device action is finished.
    HdmiDeviceInfo deviceInfo = new HdmiDeviceInfo(address, path, getPortId(path), type, Constants.UNKNOWN_VENDOR_ID, HdmiUtils.getDefaultDeviceName(address));
    addCecDevice(deviceInfo);
    startNewDeviceAction(ActiveSource.of(address, path), type);
    return true;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 99 with HdmiDeviceInfo

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

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

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

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