use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project android_frameworks_base by DirtyUnicorns.
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 android_frameworks_base by DirtyUnicorns.
the class HdmiCecLocalDeviceTv method disableArcIfExist.
@ServiceThreadOnly
private void disableArcIfExist() {
assertRunOnServiceThread();
HdmiDeviceInfo avr = getAvrDeviceInfo();
if (avr == null) {
return;
}
// Seq #44.
removeAction(RequestArcInitiationAction.class);
if (!hasAction(RequestArcTerminationAction.class) && isArcEstablished()) {
addAndStartAction(new RequestArcTerminationAction(this, avr.getLogicalAddress()));
}
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project android_frameworks_base by DirtyUnicorns.
the class HdmiCecLocalDeviceTv method launchDeviceDiscovery.
@ServiceThreadOnly
private void launchDeviceDiscovery() {
assertRunOnServiceThread();
clearDeviceInfoList();
DeviceDiscoveryAction action = new DeviceDiscoveryAction(this, new DeviceDiscoveryCallback() {
@Override
public void onDeviceDiscoveryDone(List<HdmiDeviceInfo> deviceInfos) {
for (HdmiDeviceInfo info : deviceInfos) {
addCecDevice(info);
}
// we should put device info of local device manually here
for (HdmiCecLocalDevice device : mService.getAllLocalDevices()) {
addCecDevice(device.getDeviceInfo());
}
mSelectRequestBuffer.process();
resetSelectRequestBuffer();
addAndStartAction(new HotplugDetectionAction(HdmiCecLocalDeviceTv.this));
addAndStartAction(new PowerStatusMonitorAction(HdmiCecLocalDeviceTv.this));
// If there is AVR, initiate System Audio Auto initiation action,
// which turns on and off system audio according to last system
// audio setting.
HdmiDeviceInfo avr = getAvrDeviceInfo();
if (avr != null) {
onNewAvrAdded(avr);
} else {
setSystemAudioMode(false, true);
}
}
});
addAndStartAction(action);
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project android_frameworks_base by DirtyUnicorns.
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;
}
use of com.android.server.hdmi.HdmiAnnotations.ServiceThreadOnly in project android_frameworks_base by DirtyUnicorns.
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;
}
Aggregations