Search in sources :

Example 81 with ServiceThreadOnly

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

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)

Example 82 with ServiceThreadOnly

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

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

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

the class HdmiCecLocalDeviceTv method addDeviceInfo.

/**
     * Add a new {@link HdmiDeviceInfo}. It returns old device info which has the same
     * logical address as new device info's.
     *
     * <p>Declared as package-private. accessed by {@link HdmiControlService} only.
     *
     * @param deviceInfo a new {@link HdmiDeviceInfo} to be added.
     * @return {@code null} if it is new device. Otherwise, returns old {@HdmiDeviceInfo}
     *         that has the same logical address as new one has.
     */
@ServiceThreadOnly
private HdmiDeviceInfo addDeviceInfo(HdmiDeviceInfo deviceInfo) {
    assertRunOnServiceThread();
    HdmiDeviceInfo oldDeviceInfo = getCecDeviceInfo(deviceInfo.getLogicalAddress());
    if (oldDeviceInfo != null) {
        removeDeviceInfo(deviceInfo.getId());
    }
    mDeviceInfos.append(deviceInfo.getId(), deviceInfo);
    updateSafeDeviceInfoList();
    return oldDeviceInfo;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 84 with ServiceThreadOnly

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

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

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

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)

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