use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly 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);
}
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly 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);
}
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.
the class HdmiControlService method onStandby.
@ServiceThreadOnly
private void onStandby(final int standbyAction) {
assertRunOnServiceThread();
if (!canGoToStandby())
return;
mPowerStatus = HdmiControlManager.POWER_STATUS_TRANSIENT_TO_STANDBY;
invokeVendorCommandListenersOnControlStateChanged(false, HdmiControlManager.CONTROL_STATE_CHANGED_REASON_STANDBY);
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.
}
}
});
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly 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();
}
}
});
}
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project android_frameworks_base by crdroidandroid.
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;
}
Aggregations