Search in sources :

Example 6 with ServiceThreadOnly

use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.

the class HdmiControlService method disableHdmiControlService.

@ServiceThreadOnly
private void disableHdmiControlService() {
    disableDevices(new PendingActionClearedCallback() {

        @Override
        public void onCleared(HdmiCecLocalDevice device) {
            assertRunOnServiceThread();
            mCecController.flush(new Runnable() {

                @Override
                public void run() {
                    mCecController.setOption(OPTION_CEC_ENABLE, DISABLED);
                    mMhlController.setOption(OPTION_MHL_ENABLE, DISABLED);
                    clearLocalDevices();
                }
            });
        }
    });
}
Also used : PendingActionClearedCallback(com.android.server.hdmi.HdmiCecLocalDevice.PendingActionClearedCallback) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 7 with ServiceThreadOnly

use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.

the class HdmiControlService method updateSafeMhlInput.

@ServiceThreadOnly
private void updateSafeMhlInput() {
    assertRunOnServiceThread();
    List<HdmiDeviceInfo> inputs = Collections.emptyList();
    SparseArray<HdmiMhlLocalDeviceStub> devices = mMhlController.getAllLocalDevices();
    for (int i = 0; i < devices.size(); ++i) {
        HdmiMhlLocalDeviceStub device = devices.valueAt(i);
        HdmiDeviceInfo info = device.getInfo();
        if (info != null) {
            if (inputs.isEmpty()) {
                inputs = new ArrayList<>();
            }
            inputs.add(device.getInfo());
        }
    }
    synchronized (mLock) {
        mMhlDevices = inputs;
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 8 with ServiceThreadOnly

use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.

the class HdmiCecLocalDeviceTv method onAddressAllocated.

@Override
@ServiceThreadOnly
protected void onAddressAllocated(int logicalAddress, int reason) {
    assertRunOnServiceThread();
    List<HdmiPortInfo> ports = mService.getPortInfo();
    for (HdmiPortInfo port : ports) {
        mArcFeatureEnabled.put(port.getId(), port.isArcSupported());
    }
    mService.registerTvInputCallback(mTvInputCallback);
    mService.sendCecCommand(HdmiCecMessageBuilder.buildReportPhysicalAddressCommand(mAddress, mService.getPhysicalAddress(), mDeviceType));
    mService.sendCecCommand(HdmiCecMessageBuilder.buildDeviceVendorIdCommand(mAddress, mService.getVendorId()));
    // TV is a CEC switch too.
    mCecSwitches.add(mService.getPhysicalAddress());
    mTvInputs.clear();
    mSkipRoutingControl = (reason == HdmiControlService.INITIATED_BY_WAKE_UP_MESSAGE);
    launchRoutingControl(reason != HdmiControlService.INITIATED_BY_ENABLE_CEC && reason != HdmiControlService.INITIATED_BY_BOOT_UP);
    mLocalDeviceAddresses = initLocalDeviceAddresses();
    resetSelectRequestBuffer();
    launchDeviceDiscovery();
}
Also used : HdmiPortInfo(android.hardware.hdmi.HdmiPortInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 9 with ServiceThreadOnly

use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.

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 10 with ServiceThreadOnly

use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.

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)

Aggregations

ServiceThreadOnly (com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)135 HdmiDeviceInfo (android.hardware.hdmi.HdmiDeviceInfo)110 HdmiPortInfo (android.hardware.hdmi.HdmiPortInfo)15 PendingActionClearedCallback (com.android.server.hdmi.HdmiCecLocalDevice.PendingActionClearedCallback)10 UnsupportedEncodingException (java.io.UnsupportedEncodingException)10 ArrayList (java.util.ArrayList)10 Intent (android.content.Intent)5 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 LocaleInfo (com.android.internal.app.LocalePicker.LocaleInfo)5 DeviceDiscoveryCallback (com.android.server.hdmi.DeviceDiscoveryAction.DeviceDiscoveryCallback)5 AllocateAddressCallback (com.android.server.hdmi.HdmiCecController.AllocateAddressCallback)5 Locale (java.util.Locale)5