Loading core/java/android/hardware/hdmi/HdmiDeviceInfo.java +46 −1 Original line number Diff line number Diff line Loading @@ -77,10 +77,19 @@ public class HdmiDeviceInfo implements Parcelable { /** Invalid port ID */ public static final int PORT_INVALID = -1; /** Invalid device ID */ public static final int ID_INVALID = 0xFFFF; /** Device info used to indicate an inactivated device. */ public static final HdmiDeviceInfo INACTIVE_DEVICE = new HdmiDeviceInfo(); private static final int HDMI_DEVICE_TYPE_CEC = 0; private static final int HDMI_DEVICE_TYPE_MHL = 1; private static final int HDMI_DEVICE_TYPE_HARDWARE = 2; // Type used to indicate the device that has relinquished its active source status. private static final int HDMI_DEVICE_TYPE_INACTIVE = 100; // Offset used for id value. MHL devices, for instance, will be assigned the value from // ID_OFFSET_MHL. private static final int ID_OFFSET_CEC = 0x0; Loading Loading @@ -130,6 +139,8 @@ public class HdmiDeviceInfo implements Parcelable { return new HdmiDeviceInfo(physicalAddress, portId, adopterId, deviceId); case HDMI_DEVICE_TYPE_HARDWARE: return new HdmiDeviceInfo(physicalAddress, portId); case HDMI_DEVICE_TYPE_INACTIVE: return HdmiDeviceInfo.INACTIVE_DEVICE; default: return null; } Loading Loading @@ -208,7 +219,6 @@ public class HdmiDeviceInfo implements Parcelable { mDeviceId = -1; mAdopterId = -1; } /** Loading Loading @@ -236,6 +246,28 @@ public class HdmiDeviceInfo implements Parcelable { mAdopterId = deviceId; } /** * Constructor. Used to initialize the instance representing an inactivated device. * Can be passed input change listener to indicate the active source yielded * its status, hence the listener should take an appropriate action such as * switching to other input. */ public HdmiDeviceInfo() { mHdmiDeviceType = HDMI_DEVICE_TYPE_INACTIVE; mPhysicalAddress = PATH_INVALID; mId = ID_INVALID; mLogicalAddress = -1; mDeviceType = DEVICE_INACTIVE; mPortId = PORT_INVALID; mDevicePowerStatus = HdmiControlManager.POWER_STATUS_UNKNOWN; mDisplayName = "Inactive"; mVendorId = 0; mDeviceId = -1; mAdopterId = -1; } /** * Returns the id of the device. */ Loading Loading @@ -363,6 +395,14 @@ public class HdmiDeviceInfo implements Parcelable { return mHdmiDeviceType == HDMI_DEVICE_TYPE_MHL; } /** * Return {@code true} if the device represents an inactivated device that relinquishes * its status as active source by <Active Source> (HDMI-CEC) or Content-off (MHL). */ public boolean isInactivated() { return mHdmiDeviceType == HDMI_DEVICE_TYPE_INACTIVE; } /** * Returns display (OSD) name of the device. */ Loading Loading @@ -411,6 +451,8 @@ public class HdmiDeviceInfo implements Parcelable { dest.writeInt(mDeviceId); dest.writeInt(mAdopterId); break; case HDMI_DEVICE_TYPE_INACTIVE: // flow through default: // no-op } Loading Loading @@ -438,6 +480,9 @@ public class HdmiDeviceInfo implements Parcelable { case HDMI_DEVICE_TYPE_HARDWARE: s.append("Hardware: "); break; case HDMI_DEVICE_TYPE_INACTIVE: s.append("Inactivated: "); break; default: return ""; } Loading services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +8 −1 Original line number Diff line number Diff line Loading @@ -476,7 +476,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { HdmiDeviceInfo info = getCecDeviceInfo(logicalAddress); if (info == null) { if (!handleNewDeviceAtTheTailOfActivePath(physicalAddress)) { HdmiLogger.debug("Device info not found: %X; buffering the command", logicalAddress); HdmiLogger.debug("Device info %X not found; buffering the command", logicalAddress); mDelayedMessageBuffer.add(message); } } else if (!isInputReady(info.getId())) { Loading Loading @@ -517,6 +517,12 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { 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; } Loading Loading @@ -1826,6 +1832,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { pw.println("mAutoDeviceOff: " + mAutoDeviceOff); pw.println("mAutoWakeup: " + mAutoWakeup); pw.println("mSkipRoutingControl: " + mSkipRoutingControl); pw.println("mPrevPortId: " + mPrevPortId); pw.println("CEC devices:"); pw.increaseIndent(); for (HdmiDeviceInfo info : mSafeAllDeviceInfos) { Loading services/core/java/com/android/server/hdmi/HdmiControlService.java +13 −11 Original line number Diff line number Diff line Loading @@ -2252,6 +2252,7 @@ public final class HdmiControlService extends SystemService { assertRunOnServiceThread(); if (tv() == null) return; final int lastInput = contentOn ? tv().getActivePortId() : Constants.INVALID_PORT_ID; if (portId != Constants.INVALID_PORT_ID) { tv().doManualPortSwitching(portId, new IHdmiControlCallback.Stub() { @Override public void onComplete(int result) throws RemoteException { Loading @@ -2261,7 +2262,7 @@ public final class HdmiControlService extends SystemService { setLastInputForMhl(lastInput); } }); } // MHL device is always directly connected to the port. Update the active port ID to avoid // unnecessary post-routing control task. tv().setActivePortId(portId); Loading @@ -2271,7 +2272,8 @@ public final class HdmiControlService extends SystemService { // may not be the MHL-enabled one. In this case the device info to be passed to // input change listener should be the one describing the corresponding HDMI port. HdmiMhlLocalDeviceStub device = mMhlController.getLocalDevice(portId); HdmiDeviceInfo info = (device != null) ? device.getInfo() : mPortDeviceMap.get(portId); HdmiDeviceInfo info = (device != null) ? device.getInfo() : mPortDeviceMap.get(portId, HdmiDeviceInfo.INACTIVE_DEVICE); invokeInputChangeListener(info); } Loading Loading
core/java/android/hardware/hdmi/HdmiDeviceInfo.java +46 −1 Original line number Diff line number Diff line Loading @@ -77,10 +77,19 @@ public class HdmiDeviceInfo implements Parcelable { /** Invalid port ID */ public static final int PORT_INVALID = -1; /** Invalid device ID */ public static final int ID_INVALID = 0xFFFF; /** Device info used to indicate an inactivated device. */ public static final HdmiDeviceInfo INACTIVE_DEVICE = new HdmiDeviceInfo(); private static final int HDMI_DEVICE_TYPE_CEC = 0; private static final int HDMI_DEVICE_TYPE_MHL = 1; private static final int HDMI_DEVICE_TYPE_HARDWARE = 2; // Type used to indicate the device that has relinquished its active source status. private static final int HDMI_DEVICE_TYPE_INACTIVE = 100; // Offset used for id value. MHL devices, for instance, will be assigned the value from // ID_OFFSET_MHL. private static final int ID_OFFSET_CEC = 0x0; Loading Loading @@ -130,6 +139,8 @@ public class HdmiDeviceInfo implements Parcelable { return new HdmiDeviceInfo(physicalAddress, portId, adopterId, deviceId); case HDMI_DEVICE_TYPE_HARDWARE: return new HdmiDeviceInfo(physicalAddress, portId); case HDMI_DEVICE_TYPE_INACTIVE: return HdmiDeviceInfo.INACTIVE_DEVICE; default: return null; } Loading Loading @@ -208,7 +219,6 @@ public class HdmiDeviceInfo implements Parcelable { mDeviceId = -1; mAdopterId = -1; } /** Loading Loading @@ -236,6 +246,28 @@ public class HdmiDeviceInfo implements Parcelable { mAdopterId = deviceId; } /** * Constructor. Used to initialize the instance representing an inactivated device. * Can be passed input change listener to indicate the active source yielded * its status, hence the listener should take an appropriate action such as * switching to other input. */ public HdmiDeviceInfo() { mHdmiDeviceType = HDMI_DEVICE_TYPE_INACTIVE; mPhysicalAddress = PATH_INVALID; mId = ID_INVALID; mLogicalAddress = -1; mDeviceType = DEVICE_INACTIVE; mPortId = PORT_INVALID; mDevicePowerStatus = HdmiControlManager.POWER_STATUS_UNKNOWN; mDisplayName = "Inactive"; mVendorId = 0; mDeviceId = -1; mAdopterId = -1; } /** * Returns the id of the device. */ Loading Loading @@ -363,6 +395,14 @@ public class HdmiDeviceInfo implements Parcelable { return mHdmiDeviceType == HDMI_DEVICE_TYPE_MHL; } /** * Return {@code true} if the device represents an inactivated device that relinquishes * its status as active source by <Active Source> (HDMI-CEC) or Content-off (MHL). */ public boolean isInactivated() { return mHdmiDeviceType == HDMI_DEVICE_TYPE_INACTIVE; } /** * Returns display (OSD) name of the device. */ Loading Loading @@ -411,6 +451,8 @@ public class HdmiDeviceInfo implements Parcelable { dest.writeInt(mDeviceId); dest.writeInt(mAdopterId); break; case HDMI_DEVICE_TYPE_INACTIVE: // flow through default: // no-op } Loading Loading @@ -438,6 +480,9 @@ public class HdmiDeviceInfo implements Parcelable { case HDMI_DEVICE_TYPE_HARDWARE: s.append("Hardware: "); break; case HDMI_DEVICE_TYPE_INACTIVE: s.append("Inactivated: "); break; default: return ""; } Loading
services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java +8 −1 Original line number Diff line number Diff line Loading @@ -476,7 +476,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { HdmiDeviceInfo info = getCecDeviceInfo(logicalAddress); if (info == null) { if (!handleNewDeviceAtTheTailOfActivePath(physicalAddress)) { HdmiLogger.debug("Device info not found: %X; buffering the command", logicalAddress); HdmiLogger.debug("Device info %X not found; buffering the command", logicalAddress); mDelayedMessageBuffer.add(message); } } else if (!isInputReady(info.getId())) { Loading Loading @@ -517,6 +517,12 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { 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; } Loading Loading @@ -1826,6 +1832,7 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice { pw.println("mAutoDeviceOff: " + mAutoDeviceOff); pw.println("mAutoWakeup: " + mAutoWakeup); pw.println("mSkipRoutingControl: " + mSkipRoutingControl); pw.println("mPrevPortId: " + mPrevPortId); pw.println("CEC devices:"); pw.increaseIndent(); for (HdmiDeviceInfo info : mSafeAllDeviceInfos) { Loading
services/core/java/com/android/server/hdmi/HdmiControlService.java +13 −11 Original line number Diff line number Diff line Loading @@ -2252,6 +2252,7 @@ public final class HdmiControlService extends SystemService { assertRunOnServiceThread(); if (tv() == null) return; final int lastInput = contentOn ? tv().getActivePortId() : Constants.INVALID_PORT_ID; if (portId != Constants.INVALID_PORT_ID) { tv().doManualPortSwitching(portId, new IHdmiControlCallback.Stub() { @Override public void onComplete(int result) throws RemoteException { Loading @@ -2261,7 +2262,7 @@ public final class HdmiControlService extends SystemService { setLastInputForMhl(lastInput); } }); } // MHL device is always directly connected to the port. Update the active port ID to avoid // unnecessary post-routing control task. tv().setActivePortId(portId); Loading @@ -2271,7 +2272,8 @@ public final class HdmiControlService extends SystemService { // may not be the MHL-enabled one. In this case the device info to be passed to // input change listener should be the one describing the corresponding HDMI port. HdmiMhlLocalDeviceStub device = mMhlController.getLocalDevice(portId); HdmiDeviceInfo info = (device != null) ? device.getInfo() : mPortDeviceMap.get(portId); HdmiDeviceInfo info = (device != null) ? device.getInfo() : mPortDeviceMap.get(portId, HdmiDeviceInfo.INACTIVE_DEVICE); invokeInputChangeListener(info); } Loading