Search in sources :

Example 66 with HdmiDeviceInfo

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

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)

Example 67 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method clearDeviceInfoList.

// Clear all device info.
@ServiceThreadOnly
private void clearDeviceInfoList() {
    assertRunOnServiceThread();
    for (HdmiDeviceInfo info : mSafeExternalInputs) {
        invokeDeviceEventListener(info, HdmiControlManager.DEVICE_EVENT_REMOVE_DEVICE);
    }
    mDeviceInfos.clear();
    updateSafeDeviceInfoList();
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 68 with HdmiDeviceInfo

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

the class TvInputHardwareManager method processPendingHdmiDeviceEventsLocked.

private void processPendingHdmiDeviceEventsLocked() {
    for (Iterator<Message> it = mPendingHdmiDeviceEvents.iterator(); it.hasNext(); ) {
        Message msg = it.next();
        HdmiDeviceInfo deviceInfo = (HdmiDeviceInfo) msg.obj;
        TvInputHardwareInfo hardwareInfo = findHardwareInfoForHdmiPortLocked(deviceInfo.getPortId());
        if (hardwareInfo != null) {
            msg.sendToTarget();
            it.remove();
        }
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) TvInputHardwareInfo(android.media.tv.TvInputHardwareInfo) Message(android.os.Message)

Example 69 with HdmiDeviceInfo

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

the class TvInputHardwareManager method dump.

public void dump(FileDescriptor fd, final PrintWriter writer, String[] args) {
    final IndentingPrintWriter pw = new IndentingPrintWriter(writer, "  ");
    if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
        pw.println("Permission Denial: can't dump TvInputHardwareManager from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
        return;
    }
    synchronized (mLock) {
        pw.println("TvInputHardwareManager Info:");
        pw.increaseIndent();
        pw.println("mConnections: deviceId -> Connection");
        pw.increaseIndent();
        for (int i = 0; i < mConnections.size(); i++) {
            int deviceId = mConnections.keyAt(i);
            Connection mConnection = mConnections.valueAt(i);
            pw.println(deviceId + ": " + mConnection);
        }
        pw.decreaseIndent();
        pw.println("mHardwareList:");
        pw.increaseIndent();
        for (TvInputHardwareInfo tvInputHardwareInfo : mHardwareList) {
            pw.println(tvInputHardwareInfo);
        }
        pw.decreaseIndent();
        pw.println("mHdmiDeviceList:");
        pw.increaseIndent();
        for (HdmiDeviceInfo hdmiDeviceInfo : mHdmiDeviceList) {
            pw.println(hdmiDeviceInfo);
        }
        pw.decreaseIndent();
        pw.println("mHardwareInputIdMap: deviceId -> inputId");
        pw.increaseIndent();
        for (int i = 0; i < mHardwareInputIdMap.size(); i++) {
            int deviceId = mHardwareInputIdMap.keyAt(i);
            String inputId = mHardwareInputIdMap.valueAt(i);
            pw.println(deviceId + ": " + inputId);
        }
        pw.decreaseIndent();
        pw.println("mHdmiInputIdMap: id -> inputId");
        pw.increaseIndent();
        for (int i = 0; i < mHdmiInputIdMap.size(); i++) {
            int id = mHdmiInputIdMap.keyAt(i);
            String inputId = mHdmiInputIdMap.valueAt(i);
            pw.println(id + ": " + inputId);
        }
        pw.decreaseIndent();
        pw.println("mInputMap: inputId -> inputInfo");
        pw.increaseIndent();
        for (Map.Entry<String, TvInputInfo> entry : mInputMap.entrySet()) {
            pw.println(entry.getKey() + ": " + entry.getValue());
        }
        pw.decreaseIndent();
        pw.decreaseIndent();
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) TvInputHardwareInfo(android.media.tv.TvInputHardwareInfo) TvInputInfo(android.media.tv.TvInputInfo) Map(java.util.Map) ArrayMap(android.util.ArrayMap) IndentingPrintWriter(com.android.internal.util.IndentingPrintWriter)

Example 70 with HdmiDeviceInfo

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

the class HdmiCecLocalDeviceTv method handleActiveSource.

@Override
@ServiceThreadOnly
protected boolean handleActiveSource(HdmiCecMessage message) {
    assertRunOnServiceThread();
    int logicalAddress = message.getSource();
    int physicalAddress = HdmiUtils.twoBytesToInt(message.getParams());
    HdmiDeviceInfo info = getCecDeviceInfo(logicalAddress);
    if (info == null) {
        if (!handleNewDeviceAtTheTailOfActivePath(physicalAddress)) {
            HdmiLogger.debug("Device info %X not found; buffering the command", logicalAddress);
            mDelayedMessageBuffer.add(message);
        }
    } else if (isInputReady(info.getId()) || info.getDeviceType() == HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM) {
        updateDevicePowerStatus(logicalAddress, HdmiControlManager.POWER_STATUS_ON);
        ActiveSource activeSource = ActiveSource.of(logicalAddress, physicalAddress);
        ActiveSourceHandler.create(this, null).process(activeSource, info.getDeviceType());
    } else {
        HdmiLogger.debug("Input not ready for device: %X; buffering the command", info.getId());
        mDelayedMessageBuffer.add(message);
    }
    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