Check for feature flag for numeric volume UI
Bug: 240663266 Test: atest Change-Id: Ifb84df22a247190bc9c967f57a1402e3a3515d98
This commit is contained in:
@@ -631,10 +631,14 @@ final class Constants {
|
||||
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";
|
||||
// Name is abbreviated slightly to avoid line length issues
|
||||
static final String DEVICE_CONFIG_FEATURE_FLAG_TV_NUMERIC_SOUNDBAR_VOLUME_UI =
|
||||
"enable_numeric_soundbar_volume_ui_on_tv";
|
||||
@StringDef({
|
||||
DEVICE_CONFIG_FEATURE_FLAG_SOUNDBAR_MODE,
|
||||
DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX,
|
||||
DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX
|
||||
DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX,
|
||||
DEVICE_CONFIG_FEATURE_FLAG_TV_NUMERIC_SOUNDBAR_VOLUME_UI
|
||||
})
|
||||
@interface FeatureFlag {}
|
||||
|
||||
|
||||
@@ -457,6 +457,9 @@ public class HdmiControlService extends SystemService {
|
||||
@ServiceThreadOnly
|
||||
private boolean mEarcTxFeatureFlagEnabled = false;
|
||||
|
||||
@ServiceThreadOnly
|
||||
private boolean mNumericSoundbarVolumeUiOnTvFeatureFlagEnabled = false;
|
||||
|
||||
@ServiceThreadOnly
|
||||
private boolean mTransitionFromArcToEarcTxEnabled = false;
|
||||
|
||||
@@ -682,6 +685,8 @@ public class HdmiControlService extends SystemService {
|
||||
Constants.DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX, false);
|
||||
mTransitionFromArcToEarcTxEnabled = mDeviceConfig.getBoolean(
|
||||
Constants.DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX, false);
|
||||
mNumericSoundbarVolumeUiOnTvFeatureFlagEnabled = mDeviceConfig.getBoolean(
|
||||
Constants.DEVICE_CONFIG_FEATURE_FLAG_TV_NUMERIC_SOUNDBAR_VOLUME_UI, false);
|
||||
|
||||
synchronized (mLock) {
|
||||
mEarcEnabled = (mHdmiCecConfig.getIntValue(
|
||||
@@ -901,6 +906,17 @@ public class HdmiControlService extends SystemService {
|
||||
false);
|
||||
}
|
||||
});
|
||||
|
||||
mDeviceConfig.addOnPropertiesChangedListener(getContext().getMainExecutor(),
|
||||
new DeviceConfig.OnPropertiesChangedListener() {
|
||||
@Override
|
||||
public void onPropertiesChanged(DeviceConfig.Properties properties) {
|
||||
mNumericSoundbarVolumeUiOnTvFeatureFlagEnabled = properties.getBoolean(
|
||||
Constants.DEVICE_CONFIG_FEATURE_FLAG_TV_NUMERIC_SOUNDBAR_VOLUME_UI,
|
||||
false);
|
||||
checkAndUpdateAbsoluteVolumeBehavior();
|
||||
}
|
||||
});
|
||||
}
|
||||
/** Returns true if the device screen is off */
|
||||
boolean isScreenOff() {
|
||||
@@ -4337,7 +4353,7 @@ public class HdmiControlService extends SystemService {
|
||||
case DeviceFeatures.FEATURE_NOT_SUPPORTED:
|
||||
// TVs may adopt adjust-only absolute volume behavior if condition 4 isn't met.
|
||||
// This allows the device to display numeric volume UI for the System Audio device.
|
||||
if (tv() != null) {
|
||||
if (tv() != null && mNumericSoundbarVolumeUiOnTvFeatureFlagEnabled) {
|
||||
if (currentVolumeBehavior
|
||||
!= AudioManager.DEVICE_VOLUME_BEHAVIOR_ABSOLUTE_ADJUST_ONLY) {
|
||||
// If we're currently using absolute volume behavior, switch to full volume
|
||||
|
||||
Reference in New Issue
Block a user