use of android.hardware.hdmi.HdmiDeviceInfo in project android_frameworks_base by crdroidandroid.
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 android.hardware.hdmi.HdmiDeviceInfo in project android_frameworks_base by crdroidandroid.
the class HdmiCecLocalDeviceTv method sendStandby.
@Override
protected void sendStandby(int deviceId) {
HdmiDeviceInfo targetDevice = mDeviceInfos.get(deviceId);
if (targetDevice == null) {
return;
}
int targetAddress = targetDevice.getLogicalAddress();
mService.sendCecCommand(HdmiCecMessageBuilder.buildStandby(mAddress, targetAddress));
}
use of android.hardware.hdmi.HdmiDeviceInfo in project android_frameworks_base by DirtyUnicorns.
the class TvInputHardwareManager method dump.
public void dump(FileDescriptor fd, final PrintWriter writer, String[] args) {
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
pw.println("Permission Denial: can't dump TvInputHardwareManager from pid=" + Binder.getCallingPid() + ", uid=" + Binder.getCallingUid());
return;
}
synchronized (mLock) {
pw.println("TvInputHardwareManager Info:");
pw.increaseIndent();
pw.println("mConnections: deviceId -> Connection");
pw.increaseIndent();
for (int i = 0; i < mConnections.size(); i++) {
int deviceId = mConnections.keyAt(i);
Connection mConnection = mConnections.valueAt(i);
pw.println(deviceId + ": " + mConnection);
}
pw.decreaseIndent();
pw.println("mHardwareList:");
pw.increaseIndent();
for (TvInputHardwareInfo tvInputHardwareInfo : mHardwareList) {
pw.println(tvInputHardwareInfo);
}
pw.decreaseIndent();
pw.println("mHdmiDeviceList:");
pw.increaseIndent();
for (HdmiDeviceInfo hdmiDeviceInfo : mHdmiDeviceList) {
pw.println(hdmiDeviceInfo);
}
pw.decreaseIndent();
pw.println("mHardwareInputIdMap: deviceId -> inputId");
pw.increaseIndent();
for (int i = 0; i < mHardwareInputIdMap.size(); i++) {
int deviceId = mHardwareInputIdMap.keyAt(i);
String inputId = mHardwareInputIdMap.valueAt(i);
pw.println(deviceId + ": " + inputId);
}
pw.decreaseIndent();
pw.println("mHdmiInputIdMap: id -> inputId");
pw.increaseIndent();
for (int i = 0; i < mHdmiInputIdMap.size(); i++) {
int id = mHdmiInputIdMap.keyAt(i);
String inputId = mHdmiInputIdMap.valueAt(i);
pw.println(id + ": " + inputId);
}
pw.decreaseIndent();
pw.println("mInputMap: inputId -> inputInfo");
pw.increaseIndent();
for (Map.Entry<String, TvInputInfo> entry : mInputMap.entrySet()) {
pw.println(entry.getKey() + ": " + entry.getValue());
}
pw.decreaseIndent();
pw.decreaseIndent();
}
}
use of android.hardware.hdmi.HdmiDeviceInfo in project android_frameworks_base by DirtyUnicorns.
the class TvInputHardwareManager method onDeviceUnavailable.
@Override
public void onDeviceUnavailable(int deviceId) {
synchronized (mLock) {
Connection connection = mConnections.get(deviceId);
if (connection == null) {
Slog.e(TAG, "onDeviceUnavailable: Cannot find a connection with " + deviceId);
return;
}
connection.resetLocked(null, null, null, null, null);
mConnections.remove(deviceId);
buildHardwareListLocked();
TvInputHardwareInfo info = connection.getHardwareInfoLocked();
if (info.getType() == TvInputHardwareInfo.TV_INPUT_TYPE_HDMI) {
// Remove HDMI devices linked with this hardware.
for (Iterator<HdmiDeviceInfo> it = mHdmiDeviceList.iterator(); it.hasNext(); ) {
HdmiDeviceInfo deviceInfo = it.next();
if (deviceInfo.getPortId() == info.getHdmiPortId()) {
mHandler.obtainMessage(ListenerHandler.HDMI_DEVICE_REMOVED, 0, 0, deviceInfo).sendToTarget();
it.remove();
}
}
}
mHandler.obtainMessage(ListenerHandler.HARDWARE_DEVICE_REMOVED, 0, 0, info).sendToTarget();
}
}
use of android.hardware.hdmi.HdmiDeviceInfo in project android_frameworks_base by DirtyUnicorns.
the class TvInputHardwareManager method processPendingHdmiDeviceEventsLocked.
private void processPendingHdmiDeviceEventsLocked() {
for (Iterator<Message> it = mPendingHdmiDeviceEvents.iterator(); it.hasNext(); ) {
Message msg = it.next();
HdmiDeviceInfo deviceInfo = (HdmiDeviceInfo) msg.obj;
TvInputHardwareInfo hardwareInfo = findHardwareInfoForHdmiPortLocked(deviceInfo.getPortId());
if (hardwareInfo != null) {
msg.sendToTarget();
it.remove();
}
}
}
Aggregations