Search in sources :

Example 56 with HdmiDeviceInfo

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

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

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

the class DeviceDiscoveryAction method wrapUpAndFinish.

private void wrapUpAndFinish() {
    Slog.v(TAG, "---------Wrap up Device Discovery:[" + mDevices.size() + "]---------");
    ArrayList<HdmiDeviceInfo> result = new ArrayList<>();
    for (DeviceInfo info : mDevices) {
        HdmiDeviceInfo cecDeviceInfo = info.toHdmiDeviceInfo();
        Slog.v(TAG, " DeviceInfo: " + cecDeviceInfo);
        result.add(cecDeviceInfo);
    }
    Slog.v(TAG, "--------------------------------------------");
    mCallback.onDeviceDiscoveryDone(result);
    finish();
    // Process any commands buffered while device discovery action was in progress.
    tv().processAllDelayedMessages();
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ArrayList(java.util.ArrayList) HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo)

Example 58 with HdmiDeviceInfo

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

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

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

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

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

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)

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