Search in sources :

Example 61 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo 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 62 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method addCecDevice.

/**
     * Called when a device is newly added or a new device is detected or
     * existing device is updated.
     *
     * @param info device info of a new device.
     */
@ServiceThreadOnly
final void addCecDevice(HdmiDeviceInfo info) {
    assertRunOnServiceThread();
    HdmiDeviceInfo old = addDeviceInfo(info);
    if (info.getLogicalAddress() == mAddress) {
        // The addition of TV device itself should not be notified.
        return;
    }
    if (old == null) {
        invokeDeviceEventListener(info, HdmiControlManager.DEVICE_EVENT_ADD_DEVICE);
    } else if (!old.equals(info)) {
        invokeDeviceEventListener(old, HdmiControlManager.DEVICE_EVENT_REMOVE_DEVICE);
        invokeDeviceEventListener(info, HdmiControlManager.DEVICE_EVENT_ADD_DEVICE);
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 63 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method deviceSelect.

/**
     * Performs the action 'device select', or 'one touch play' initiated by TV.
     *
     * @param id id of HDMI device to select
     * @param callback callback object to report the result with
     */
@ServiceThreadOnly
void deviceSelect(int id, IHdmiControlCallback callback) {
    assertRunOnServiceThread();
    HdmiDeviceInfo targetDevice = mDeviceInfos.get(id);
    if (targetDevice == null) {
        invokeCallback(callback, HdmiControlManager.RESULT_TARGET_NOT_AVAILABLE);
        return;
    }
    int targetAddress = targetDevice.getLogicalAddress();
    ActiveSource active = getActiveSource();
    if (targetDevice.getDevicePowerStatus() == HdmiControlManager.POWER_STATUS_ON && active.isValid() && targetAddress == active.logicalAddress) {
        invokeCallback(callback, HdmiControlManager.RESULT_SUCCESS);
        return;
    }
    if (targetAddress == Constants.ADDR_INTERNAL) {
        handleSelectInternalSource();
        // Switching to internal source is always successful even when CEC control is disabled.
        setActiveSource(targetAddress, mService.getPhysicalAddress());
        setActivePath(mService.getPhysicalAddress());
        invokeCallback(callback, HdmiControlManager.RESULT_SUCCESS);
        return;
    }
    if (!mService.isControlEnabled()) {
        setActiveSource(targetDevice);
        invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
        return;
    }
    removeAction(DeviceSelectAction.class);
    addAndStartAction(new DeviceSelectAction(this, targetDevice, callback));
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 64 with HdmiDeviceInfo

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

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

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

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)

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