Search in sources :

Example 41 with ServiceThreadOnly

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

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

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

the class HdmiControlService method onStandby.

@ServiceThreadOnly
private void onStandby(final int standbyAction) {
    assertRunOnServiceThread();
    mPowerStatus = HdmiControlManager.POWER_STATUS_TRANSIENT_TO_STANDBY;
    invokeVendorCommandListenersOnControlStateChanged(false, HdmiControlManager.CONTROL_STATE_CHANGED_REASON_STANDBY);
    if (!canGoToStandby()) {
        mPowerStatus = HdmiControlManager.POWER_STATUS_STANDBY;
        return;
    }
    final List<HdmiCecLocalDevice> devices = getAllLocalDevices();
    disableDevices(new PendingActionClearedCallback() {

        @Override
        public void onCleared(HdmiCecLocalDevice device) {
            Slog.v(TAG, "On standby-action cleared:" + device.mDeviceType);
            devices.remove(device);
            if (devices.isEmpty()) {
                onStandbyCompleted(standbyAction);
            // We will not clear local devices here, since some OEM/SOC will keep passing
            // the received packets until the application processor enters to the sleep
            // actually.
            }
        }
    });
}
Also used : PendingActionClearedCallback(com.android.server.hdmi.HdmiCecLocalDevice.PendingActionClearedCallback) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 43 with ServiceThreadOnly

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

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

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

the class HdmiControlService method changeInputForMhl.

/**
     * Performs input change, routing control for MHL device.
     *
     * @param portId MHL port, or the last port to go back to if {@code contentOn} is false
     * @param contentOn {@code true} if RAP data is content on; otherwise false
     */
@ServiceThreadOnly
void changeInputForMhl(int portId, boolean contentOn) {
    assertRunOnServiceThread();
    if (tv() == null)
        return;
    final int lastInput = contentOn ? tv().getActivePortId() : Constants.INVALID_PORT_ID;
    if (portId != Constants.INVALID_PORT_ID) {
        tv().doManualPortSwitching(portId, new IHdmiControlCallback.Stub() {

            @Override
            public void onComplete(int result) throws RemoteException {
                // Keep the last input to switch back later when RAP[ContentOff] is received.
                // This effectively sets the port to invalid one if the switching is for
                // RAP[ContentOff].
                setLastInputForMhl(lastInput);
            }
        });
    }
    // MHL device is always directly connected to the port. Update the active port ID to avoid
    // unnecessary post-routing control task.
    tv().setActivePortId(portId);
    // The port is either the MHL-enabled port where the mobile device is connected, or
    // the last port to go back to when turnoff command is received. Note that the last port
    // may not be the MHL-enabled one. In this case the device info to be passed to
    // input change listener should be the one describing the corresponding HDMI port.
    HdmiMhlLocalDeviceStub device = mMhlController.getLocalDevice(portId);
    HdmiDeviceInfo info = (device != null) ? device.getInfo() : mPortDeviceMap.get(portId, HdmiDeviceInfo.INACTIVE_DEVICE);
    invokeInputChangeListener(info);
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) IHdmiControlCallback(android.hardware.hdmi.IHdmiControlCallback) RemoteException(android.os.RemoteException) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 45 with ServiceThreadOnly

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

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)

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