use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.
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));
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.
the class HdmiCecLocalDeviceTv method addDeviceInfo.
/**
* Add a new {@link HdmiDeviceInfo}. It returns old device info which has the same
* logical address as new device info's.
*
* <p>Declared as package-private. accessed by {@link HdmiControlService} only.
*
* @param deviceInfo a new {@link HdmiDeviceInfo} to be added.
* @return {@code null} if it is new device. Otherwise, returns old {@HdmiDeviceInfo}
* that has the same logical address as new one has.
*/
@ServiceThreadOnly
private HdmiDeviceInfo addDeviceInfo(HdmiDeviceInfo deviceInfo) {
assertRunOnServiceThread();
HdmiDeviceInfo oldDeviceInfo = getCecDeviceInfo(deviceInfo.getLogicalAddress());
if (oldDeviceInfo != null) {
removeDeviceInfo(deviceInfo.getId());
}
mDeviceInfos.append(deviceInfo.getId(), deviceInfo);
updateSafeDeviceInfoList();
return oldDeviceInfo;
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.
the class HdmiCecLocalDeviceTv method updateArcFeatureStatus.
@ServiceThreadOnly
private void updateArcFeatureStatus(int portId, boolean isConnected) {
assertRunOnServiceThread();
HdmiPortInfo portInfo = mService.getPortInfo(portId);
if (!portInfo.isArcSupported()) {
return;
}
HdmiDeviceInfo avr = getAvrDeviceInfo();
if (avr == null) {
if (isConnected) {
// Update the status (since TV may not have seen AVR yet) so
// that ARC can be initiated after discovery.
mArcFeatureEnabled.put(portId, isConnected);
}
return;
}
// Should not activate ARC if +5V status is false.
if (avr.getPortId() == portId) {
changeArcFeatureEnabled(portId, isConnected);
}
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.
the class HdmiCecLocalDeviceTv method startArcAction.
@ServiceThreadOnly
void startArcAction(boolean enabled) {
assertRunOnServiceThread();
HdmiDeviceInfo info = getAvrDeviceInfo();
if (info == null) {
Slog.w(TAG, "Failed to start arc action; No AVR device.");
return;
}
if (!canStartArcUpdateAction(info.getLogicalAddress(), enabled)) {
Slog.w(TAG, "Failed to start arc action; ARC configuration check failed.");
if (enabled && !isConnectedToArcPort(info.getPhysicalAddress())) {
displayOsd(OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT);
}
return;
}
// Terminate opposite action and start action if not exist.
if (enabled) {
removeAction(RequestArcTerminationAction.class);
if (!hasAction(RequestArcInitiationAction.class)) {
addAndStartAction(new RequestArcInitiationAction(this, info.getLogicalAddress()));
}
} else {
removeAction(RequestArcInitiationAction.class);
if (!hasAction(RequestArcTerminationAction.class)) {
addAndStartAction(new RequestArcTerminationAction(this, info.getLogicalAddress()));
}
}
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project platform_frameworks_base by android.
the class HdmiCecLocalDeviceTv method removeDeviceInfo.
/**
* Remove a device info corresponding to the given {@code logicalAddress}.
* It returns removed {@link HdmiDeviceInfo} if exists.
*
* <p>Declared as package-private. accessed by {@link HdmiControlService} only.
*
* @param id id of device to be removed
* @return removed {@link HdmiDeviceInfo} it exists. Otherwise, returns {@code null}
*/
@ServiceThreadOnly
private HdmiDeviceInfo removeDeviceInfo(int id) {
assertRunOnServiceThread();
HdmiDeviceInfo deviceInfo = mDeviceInfos.get(id);
if (deviceInfo != null) {
mDeviceInfos.remove(id);
}
updateSafeDeviceInfoList();
return deviceInfo;
}
Aggregations