Loading services/core/java/com/android/server/hdmi/HdmiCecController.java +66 −11 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.IHwBinder; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; import android.stats.hdmi.HdmiStatsEnums; import android.util.Slog; Loading Loading @@ -380,7 +381,7 @@ final class HdmiCecController { * Configures the TV panel device wakeup behaviour in standby mode when it receives an OTP * (One Touch Play) from a source device. * * @param value If true, the TV device will wake up when OTP is received and if false, the TV * @param enabled If true, the TV device will wake up when OTP is received and if false, the TV * device will not wake up for an OTP. */ @ServiceThreadOnly Loading @@ -393,7 +394,7 @@ final class HdmiCecController { /** * Switch to enable or disable CEC on the device. * * @param value If true, the device will have all CEC functionalities and if false, the device * @param enabled If true, the device will have all CEC functionalities and if false, the device * will not perform any CEC functions. */ @ServiceThreadOnly Loading @@ -406,8 +407,8 @@ final class HdmiCecController { /** * Configures the module that processes CEC messages - the Android framework or the HAL. * * @param value If true, the Android framework will actively process CEC messages and if false, * only the HAL will process the CEC messages. * @param enabled If true, the Android framework will actively process CEC messages. * If false, only the HAL will process the CEC messages. */ @ServiceThreadOnly void enableSystemCecControl(boolean enabled) { Loading @@ -423,9 +424,8 @@ final class HdmiCecController { @ServiceThreadOnly void setHpdSignalType(@Constants.HpdSignalType int signal, int portId) { assertRunOnServiceThread(); // Stub. // TODO: bind to native. // TODO: handle error return values here, with logging. HdmiLogger.debug("setHpdSignalType: portId %b, signal %b", portId, signal); mNativeWrapperImpl.nativeSetHpdSignalType(signal, portId); } /** Loading @@ -436,9 +436,8 @@ final class HdmiCecController { @Constants.HpdSignalType int getHpdSignalType(int portId) { assertRunOnServiceThread(); // Stub. // TODO: bind to native. return Constants.HDMI_HPD_TYPE_PHYSICAL; HdmiLogger.debug("getHpdSignalType: portId %b ", portId); return mNativeWrapperImpl.nativeGetHpdSignalType(portId); } /** Loading Loading @@ -906,6 +905,8 @@ final class HdmiCecController { void nativeSetLanguage(String language); void nativeEnableAudioReturnChannel(int port, boolean flag); boolean nativeIsConnected(int port); void nativeSetHpdSignalType(int signal, int portId); int nativeGetHpdSignalType(int portId); } private static final class NativeWrapperImplAidl Loading Loading @@ -1103,7 +1104,7 @@ final class HdmiCecController { .setCecSupported(portInfo.cecSupported) .setMhlSupported(false) .setArcSupported(portInfo.arcSupported) .setEarcSupported(false) .setEarcSupported(portInfo.eArcSupported) .build(); i++; } Loading @@ -1123,6 +1124,34 @@ final class HdmiCecController { return false; } } @Override public void nativeSetHpdSignalType(int signal, int portId) { try { // TODO(b/266178786) add portId to the HAL method mHdmiConnection.setHpdSignal((byte) signal); } catch (ServiceSpecificException sse) { HdmiLogger.error( "Could not set HPD signal type for portId " + portId + " to " + signal + ". Error: ", sse.errorCode); } catch (RemoteException e) { HdmiLogger.error( "Could not set HPD signal type for portId " + portId + " to " + signal + ". Exception: ", e); } } @Override public int nativeGetHpdSignalType(int portId) { try { // TODO(b/266178786) add portId to the HAL method return mHdmiConnection.getHpdSignal(); } catch (RemoteException e) { HdmiLogger.error( "Could not get HPD signal type for portId " + portId + ". Exception: ", e); return Constants.HDMI_HPD_TYPE_PHYSICAL; } } } private static final class NativeWrapperImpl11 implements NativeWrapper, Loading Loading @@ -1328,6 +1357,19 @@ final class HdmiCecController { return false; } } @Override public void nativeSetHpdSignalType(int signal, int portId) { HdmiLogger.error( "Failed to set HPD signal type: not supported by HAL."); } @Override public int nativeGetHpdSignalType(int portId) { HdmiLogger.error( "Failed to get HPD signal type: not supported by HAL."); return Constants.HDMI_HPD_TYPE_PHYSICAL; } } private static final class NativeWrapperImpl implements NativeWrapper, Loading Loading @@ -1513,6 +1555,19 @@ final class HdmiCecController { } } @Override public void nativeSetHpdSignalType(int signal, int portId) { HdmiLogger.error( "Failed to set HPD signal type: not supported by HAL."); } @Override public int nativeGetHpdSignalType(int portId) { HdmiLogger.error( "Failed to get HPD signal type: not supported by HAL."); return Constants.HDMI_HPD_TYPE_PHYSICAL; } @Override public void serviceDied(long cookie) { if (cookie == HDMI_CEC_HAL_DEATH_COOKIE) { Loading services/tests/servicestests/src/com/android/server/hdmi/FakeNativeWrapper.java +8 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,14 @@ final class FakeNativeWrapper implements NativeWrapper { return isConnected == null ? false : isConnected; } @Override public void nativeSetHpdSignalType(int signal, int portId) {} @Override public int nativeGetHpdSignalType(int portId) { return Constants.HDMI_HPD_TYPE_PHYSICAL; } public void setPortConnectionStatus(int port, boolean connected) { mPortConnectionStatus.put(port, connected); } Loading Loading
services/core/java/com/android/server/hdmi/HdmiCecController.java +66 −11 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.IHwBinder; import android.os.Looper; import android.os.RemoteException; import android.os.ServiceManager; import android.os.ServiceSpecificException; import android.stats.hdmi.HdmiStatsEnums; import android.util.Slog; Loading Loading @@ -380,7 +381,7 @@ final class HdmiCecController { * Configures the TV panel device wakeup behaviour in standby mode when it receives an OTP * (One Touch Play) from a source device. * * @param value If true, the TV device will wake up when OTP is received and if false, the TV * @param enabled If true, the TV device will wake up when OTP is received and if false, the TV * device will not wake up for an OTP. */ @ServiceThreadOnly Loading @@ -393,7 +394,7 @@ final class HdmiCecController { /** * Switch to enable or disable CEC on the device. * * @param value If true, the device will have all CEC functionalities and if false, the device * @param enabled If true, the device will have all CEC functionalities and if false, the device * will not perform any CEC functions. */ @ServiceThreadOnly Loading @@ -406,8 +407,8 @@ final class HdmiCecController { /** * Configures the module that processes CEC messages - the Android framework or the HAL. * * @param value If true, the Android framework will actively process CEC messages and if false, * only the HAL will process the CEC messages. * @param enabled If true, the Android framework will actively process CEC messages. * If false, only the HAL will process the CEC messages. */ @ServiceThreadOnly void enableSystemCecControl(boolean enabled) { Loading @@ -423,9 +424,8 @@ final class HdmiCecController { @ServiceThreadOnly void setHpdSignalType(@Constants.HpdSignalType int signal, int portId) { assertRunOnServiceThread(); // Stub. // TODO: bind to native. // TODO: handle error return values here, with logging. HdmiLogger.debug("setHpdSignalType: portId %b, signal %b", portId, signal); mNativeWrapperImpl.nativeSetHpdSignalType(signal, portId); } /** Loading @@ -436,9 +436,8 @@ final class HdmiCecController { @Constants.HpdSignalType int getHpdSignalType(int portId) { assertRunOnServiceThread(); // Stub. // TODO: bind to native. return Constants.HDMI_HPD_TYPE_PHYSICAL; HdmiLogger.debug("getHpdSignalType: portId %b ", portId); return mNativeWrapperImpl.nativeGetHpdSignalType(portId); } /** Loading Loading @@ -906,6 +905,8 @@ final class HdmiCecController { void nativeSetLanguage(String language); void nativeEnableAudioReturnChannel(int port, boolean flag); boolean nativeIsConnected(int port); void nativeSetHpdSignalType(int signal, int portId); int nativeGetHpdSignalType(int portId); } private static final class NativeWrapperImplAidl Loading Loading @@ -1103,7 +1104,7 @@ final class HdmiCecController { .setCecSupported(portInfo.cecSupported) .setMhlSupported(false) .setArcSupported(portInfo.arcSupported) .setEarcSupported(false) .setEarcSupported(portInfo.eArcSupported) .build(); i++; } Loading @@ -1123,6 +1124,34 @@ final class HdmiCecController { return false; } } @Override public void nativeSetHpdSignalType(int signal, int portId) { try { // TODO(b/266178786) add portId to the HAL method mHdmiConnection.setHpdSignal((byte) signal); } catch (ServiceSpecificException sse) { HdmiLogger.error( "Could not set HPD signal type for portId " + portId + " to " + signal + ". Error: ", sse.errorCode); } catch (RemoteException e) { HdmiLogger.error( "Could not set HPD signal type for portId " + portId + " to " + signal + ". Exception: ", e); } } @Override public int nativeGetHpdSignalType(int portId) { try { // TODO(b/266178786) add portId to the HAL method return mHdmiConnection.getHpdSignal(); } catch (RemoteException e) { HdmiLogger.error( "Could not get HPD signal type for portId " + portId + ". Exception: ", e); return Constants.HDMI_HPD_TYPE_PHYSICAL; } } } private static final class NativeWrapperImpl11 implements NativeWrapper, Loading Loading @@ -1328,6 +1357,19 @@ final class HdmiCecController { return false; } } @Override public void nativeSetHpdSignalType(int signal, int portId) { HdmiLogger.error( "Failed to set HPD signal type: not supported by HAL."); } @Override public int nativeGetHpdSignalType(int portId) { HdmiLogger.error( "Failed to get HPD signal type: not supported by HAL."); return Constants.HDMI_HPD_TYPE_PHYSICAL; } } private static final class NativeWrapperImpl implements NativeWrapper, Loading Loading @@ -1513,6 +1555,19 @@ final class HdmiCecController { } } @Override public void nativeSetHpdSignalType(int signal, int portId) { HdmiLogger.error( "Failed to set HPD signal type: not supported by HAL."); } @Override public int nativeGetHpdSignalType(int portId) { HdmiLogger.error( "Failed to get HPD signal type: not supported by HAL."); return Constants.HDMI_HPD_TYPE_PHYSICAL; } @Override public void serviceDied(long cookie) { if (cookie == HDMI_CEC_HAL_DEATH_COOKIE) { Loading
services/tests/servicestests/src/com/android/server/hdmi/FakeNativeWrapper.java +8 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,14 @@ final class FakeNativeWrapper implements NativeWrapper { return isConnected == null ? false : isConnected; } @Override public void nativeSetHpdSignalType(int signal, int portId) {} @Override public int nativeGetHpdSignalType(int portId) { return Constants.HDMI_HPD_TYPE_PHYSICAL; } public void setPortConnectionStatus(int port, boolean connected) { mPortConnectionStatus.put(port, connected); } Loading