Search in sources :

Example 36 with HdmiDeviceInfo

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

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

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

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

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

the class HdmiCecLocalDeviceTv method changeSystemAudioMode.

@ServiceThreadOnly
// Seq #32
void changeSystemAudioMode(boolean enabled, IHdmiControlCallback callback) {
    assertRunOnServiceThread();
    if (!mService.isControlEnabled() || hasAction(DeviceDiscoveryAction.class)) {
        setSystemAudioMode(false, true);
        invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
        return;
    }
    HdmiDeviceInfo avr = getAvrDeviceInfo();
    if (avr == null) {
        setSystemAudioMode(false, true);
        invokeCallback(callback, HdmiControlManager.RESULT_TARGET_NOT_AVAILABLE);
        return;
    }
    addAndStartAction(new SystemAudioActionFromTv(this, avr.getLogicalAddress(), enabled, callback));
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 39 with HdmiDeviceInfo

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

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

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

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)

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