Search in sources :

Example 91 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

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

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

the class HdmiCecLocalDeviceTv method setAudioReturnChannel.

/**
     * Switch hardware ARC circuit in the system.
     */
@ServiceThreadOnly
void setAudioReturnChannel(boolean enabled) {
    assertRunOnServiceThread();
    HdmiDeviceInfo avr = getAvrDeviceInfo();
    if (avr != null) {
        mService.setAudioReturnChannel(avr.getPortId(), enabled);
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 93 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

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

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

the class HdmiCecLocalDeviceTv method sendStandby.

@Override
protected void sendStandby(int deviceId) {
    HdmiDeviceInfo targetDevice = mDeviceInfos.get(deviceId);
    if (targetDevice == null) {
        return;
    }
    int targetAddress = targetDevice.getLogicalAddress();
    mService.sendCecCommand(HdmiCecMessageBuilder.buildStandby(mAddress, targetAddress));
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo)

Example 95 with HdmiDeviceInfo

use of android.hardware.hdmi.HdmiDeviceInfo in project platform_frameworks_base by android.

the class HdmiControlService method allocateLogicalAddress.

@ServiceThreadOnly
private void allocateLogicalAddress(final ArrayList<HdmiCecLocalDevice> allocatingDevices, final int initiatedBy) {
    assertRunOnServiceThread();
    mCecController.clearLogicalAddress();
    final ArrayList<HdmiCecLocalDevice> allocatedDevices = new ArrayList<>();
    final int[] finished = new int[1];
    mAddressAllocated = allocatingDevices.isEmpty();
    // For TV device, select request can be invoked while address allocation or device
    // discovery is in progress. Initialize the request here at the start of allocation,
    // and process the collected requests later when the allocation and device discovery
    // is all completed.
    mSelectRequestBuffer.clear();
    for (final HdmiCecLocalDevice localDevice : allocatingDevices) {
        mCecController.allocateLogicalAddress(localDevice.getType(), localDevice.getPreferredAddress(), new AllocateAddressCallback() {

            @Override
            public void onAllocated(int deviceType, int logicalAddress) {
                if (logicalAddress == Constants.ADDR_UNREGISTERED) {
                    Slog.e(TAG, "Failed to allocate address:[device_type:" + deviceType + "]");
                } else {
                    // Set POWER_STATUS_ON to all local devices because they share lifetime
                    // with system.
                    HdmiDeviceInfo deviceInfo = createDeviceInfo(logicalAddress, deviceType, HdmiControlManager.POWER_STATUS_ON);
                    localDevice.setDeviceInfo(deviceInfo);
                    mCecController.addLocalDevice(deviceType, localDevice);
                    mCecController.addLogicalAddress(logicalAddress);
                    allocatedDevices.add(localDevice);
                }
                // Address allocation completed for all devices. Notify each device.
                if (allocatingDevices.size() == ++finished[0]) {
                    mAddressAllocated = true;
                    if (initiatedBy != INITIATED_BY_HOTPLUG) {
                        // In case of the hotplug we don't call onInitializeCecComplete()
                        // since we reallocate the logical address only.
                        onInitializeCecComplete(initiatedBy);
                    }
                    notifyAddressAllocated(allocatedDevices, initiatedBy);
                    mCecMessageBuffer.processMessages();
                }
            }
        });
    }
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ArrayList(java.util.ArrayList) AllocateAddressCallback(com.android.server.hdmi.HdmiCecController.AllocateAddressCallback) 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