Search in sources :

Example 91 with ServiceThreadOnly

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

the class HdmiCecLocalDeviceTv method changeSystemAudioMode.

@ServiceThreadOnly
// Seq #32
void changeSystemAudioMode(boolean enabled, IHdmiControlCallback callback) {
    assertRunOnServiceThread();
    if (!mService.isControlEnabled() || hasAction(DeviceDiscoveryAction.class)) {
        setSystemAudioMode(false, true);
        invokeCallback(callback, HdmiControlManager.RESULT_INCORRECT_MODE);
        return;
    }
    HdmiDeviceInfo avr = getAvrDeviceInfo();
    if (avr == null) {
        setSystemAudioMode(false, true);
        invokeCallback(callback, HdmiControlManager.RESULT_TARGET_NOT_AVAILABLE);
        return;
    }
    addAndStartAction(new SystemAudioActionFromTv(this, avr.getLogicalAddress(), enabled, callback));
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 92 with ServiceThreadOnly

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

the class HdmiCecLocalDeviceTv method handleInactiveSource.

@Override
@ServiceThreadOnly
protected boolean handleInactiveSource(HdmiCecMessage message) {
    assertRunOnServiceThread();
    // Ignore <Inactive Source> from non-active source device.
    if (getActiveSource().logicalAddress != message.getSource()) {
        return true;
    }
    if (isProhibitMode()) {
        return true;
    }
    int portId = getPrevPortId();
    if (portId != Constants.INVALID_PORT_ID) {
        // TODO: Do this only if TV is not showing multiview like PIP/PAP.
        HdmiDeviceInfo inactiveSource = getCecDeviceInfo(message.getSource());
        if (inactiveSource == null) {
            return true;
        }
        if (mService.pathToPortId(inactiveSource.getPhysicalAddress()) == portId) {
            return true;
        }
        // TODO: Switch the TV freeze mode off
        doManualPortSwitching(portId, null);
        setPrevPortId(Constants.INVALID_PORT_ID);
    } else {
        // No HDMI port to switch to was found. Notify the input change listers to
        // switch to the lastly shown internal input.
        mActiveSource.invalidate();
        setActivePath(Constants.INVALID_PHYSICAL_ADDRESS);
        mService.invokeInputChangeListener(HdmiDeviceInfo.INACTIVE_DEVICE);
    }
    return true;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 93 with ServiceThreadOnly

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

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

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

the class HdmiControlService method displayOsd.

@ServiceThreadOnly
void displayOsd(int messageId) {
    assertRunOnServiceThread();
    Intent intent = new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
    intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID, messageId);
    getContext().sendBroadcastAsUser(intent, UserHandle.ALL, HdmiControlService.PERMISSION);
}
Also used : Intent(android.content.Intent) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 95 with ServiceThreadOnly

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

the class HdmiControlService method displayOsd.

@ServiceThreadOnly
void displayOsd(int messageId) {
    assertRunOnServiceThread();
    Intent intent = new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
    intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID, messageId);
    getContext().sendBroadcastAsUser(intent, UserHandle.ALL, HdmiControlService.PERMISSION);
}
Also used : Intent(android.content.Intent) 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