Add flag for disabling transitions from ARC to eARC

This flag is introduced to disable transitions from ARC to eARC if we
see any issues with the current design.

If the flag is enabled, the behavior is as in the original eARC design.

If the flag is disabled, eARC now gets disabled in the HAL when ARC gets
enabled in the HAL. As a consequence, the HAL won´t attempt to establish
an eARC connection if ARC is already connected. eARC will be re-enabled
in the HAL on 2 occasions:
- on the next wakeup or boot
- when the eARC setting on the TV  gets toggled to 'enabled´.

Test: make and run unit tests with the flag set to false
Bug: 264414108
Change-Id: I77037718e24c7b14532cb6d684c053d28c222659
This commit is contained in:
Nathalie Le Clair
2023-02-07 14:23:40 +01:00
parent 4f7fa715e2
commit e853889d0f
2 changed files with 24 additions and 1 deletions

View File

@@ -629,9 +629,12 @@ final class Constants {
static final String DEVICE_CONFIG_FEATURE_FLAG_SOUNDBAR_MODE = "soundbar_mode";
static final String DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX = "enable_earc_tx";
static final String DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX =
"transition_arc_to_earc_tx";
@StringDef({
DEVICE_CONFIG_FEATURE_FLAG_SOUNDBAR_MODE,
DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX
DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX,
DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX
})
@interface FeatureFlag {}

View File

@@ -457,6 +457,9 @@ public class HdmiControlService extends SystemService {
@ServiceThreadOnly
private boolean mEarcTxFeatureFlagEnabled = false;
@ServiceThreadOnly
private boolean mTransitionFromArcToEarcTxEnabled = false;
@ServiceThreadOnly
private int mActivePortId = Constants.INVALID_PORT_ID;
@@ -675,6 +678,8 @@ public class HdmiControlService extends SystemService {
Constants.DEVICE_CONFIG_FEATURE_FLAG_SOUNDBAR_MODE, false);
mEarcTxFeatureFlagEnabled = mDeviceConfig.getBoolean(
Constants.DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX, false);
mTransitionFromArcToEarcTxEnabled = mDeviceConfig.getBoolean(
Constants.DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX, false);
synchronized (mLock) {
mEarcEnabled = (mHdmiCecConfig.getIntValue(
@@ -886,6 +891,16 @@ public class HdmiControlService extends SystemService {
? SOUNDBAR_MODE_ENABLED : SOUNDBAR_MODE_DISABLED);
}
}, mServiceThreadExecutor);
mDeviceConfig.addOnPropertiesChangedListener(getContext().getMainExecutor(),
new DeviceConfig.OnPropertiesChangedListener() {
@Override
public void onPropertiesChanged(DeviceConfig.Properties properties) {
mTransitionFromArcToEarcTxEnabled = properties.getBoolean(
Constants.DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX,
false);
}
});
}
/** Returns true if the device screen is off */
boolean isScreenOff() {
@@ -1618,6 +1633,11 @@ public class HdmiControlService extends SystemService {
}
void enableAudioReturnChannel(int portId, boolean enabled) {
if (!mTransitionFromArcToEarcTxEnabled && enabled && mEarcController != null) {
// If the feature flag is set to false, prevent eARC from establishing if ARC is already
// established.
setEarcEnabledInHal(false, false);
}
mCecController.enableAudioReturnChannel(portId, enabled);
}