Merge "Bind new HAL methods to framework"

This commit is contained in:
TreeHugger Robot
2023-01-24 17:56:54 +00:00
committed by Android (Google) Code Review
2 changed files with 74 additions and 11 deletions

View File

@@ -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;
@@ -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
@@ -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
@@ -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) {
@@ -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);
}
/**
@@ -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);
}
/**
@@ -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
@@ -1103,7 +1104,7 @@ final class HdmiCecController {
.setCecSupported(portInfo.cecSupported)
.setMhlSupported(false)
.setArcSupported(portInfo.arcSupported)
.setEarcSupported(false)
.setEarcSupported(portInfo.eArcSupported)
.build();
i++;
}
@@ -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,
@@ -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,
@@ -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) {

View File

@@ -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);
}