Search in sources :

Example 66 with ServiceThreadOnly

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

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

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

the class HdmiCecLocalDevicePlayback method handleSetMenuLanguage.

@ServiceThreadOnly
protected boolean handleSetMenuLanguage(HdmiCecMessage message) {
    assertRunOnServiceThread();
    if (!SET_MENU_LANGUAGE) {
        return false;
    }
    try {
        String iso3Language = new String(message.getParams(), 0, 3, "US-ASCII");
        Locale currentLocale = mService.getContext().getResources().getConfiguration().locale;
        if (currentLocale.getISO3Language().equals(iso3Language)) {
            // due to the limitation of CEC. See the warning below.
            return true;
        }
        // Don't use Locale.getAvailableLocales() since it returns a locale
        // which is not available on Settings.
        final List<LocaleInfo> localeInfos = LocalePicker.getAllAssetLocales(mService.getContext(), false);
        for (LocaleInfo localeInfo : localeInfos) {
            if (localeInfo.getLocale().getISO3Language().equals(iso3Language)) {
                // WARNING: CEC adopts ISO/FDIS-2 for language code, while Android requires
                // additional country variant to pinpoint the locale. This keeps the right
                // locale from being chosen. 'eng' in the CEC command, for instance,
                // will always be mapped to en-AU among other variants like en-US, en-GB,
                // an en-IN, which may not be the expected one.
                LocalePicker.updateLocale(localeInfo.getLocale());
                return true;
            }
        }
        Slog.w(TAG, "Can't handle <Set Menu Language> of " + iso3Language);
        return false;
    } catch (UnsupportedEncodingException e) {
        Slog.w(TAG, "Can't handle <Set Menu Language>", e);
        return false;
    }
}
Also used : Locale(java.util.Locale) LocaleInfo(com.android.internal.app.LocalePicker.LocaleInfo) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 68 with ServiceThreadOnly

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

the class HdmiCecLocalDeviceTv method isInDeviceList.

/**
     * Whether a device of the specified physical address and logical address exists
     * in a device info list. However, both are minimal condition and it could
     * be different device from the original one.
     *
     * @param logicalAddress logical address of a device to be searched
     * @param physicalAddress physical address of a device to be searched
     * @return true if exist; otherwise false
     */
@ServiceThreadOnly
boolean isInDeviceList(int logicalAddress, int physicalAddress) {
    assertRunOnServiceThread();
    HdmiDeviceInfo device = getCecDeviceInfo(logicalAddress);
    if (device == null) {
        return false;
    }
    return device.getPhysicalAddress() == physicalAddress;
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 69 with ServiceThreadOnly

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

the class HdmiCecLocalDeviceTv method clearDeviceInfoList.

// Clear all device info.
@ServiceThreadOnly
private void clearDeviceInfoList() {
    assertRunOnServiceThread();
    for (HdmiDeviceInfo info : mSafeExternalInputs) {
        invokeDeviceEventListener(info, HdmiControlManager.DEVICE_EVENT_REMOVE_DEVICE);
    }
    mDeviceInfos.clear();
    updateSafeDeviceInfoList();
}
Also used : HdmiDeviceInfo(android.hardware.hdmi.HdmiDeviceInfo) ServiceThreadOnly(com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly)

Example 70 with ServiceThreadOnly

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

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)

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