Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7298a68a authored by Yan Han's avatar Yan Han
Browse files

Check for feature flag for numeric volume UI

Bug: 240663266
Test: atest
Change-Id: Ifb84df22a247190bc9c967f57a1402e3a3515d98
parent 556aa155
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -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_ENABLE_EARC_TX = "enable_earc_tx";
    static final String DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX =
    static final String DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX =
            "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({
    @StringDef({
            DEVICE_CONFIG_FEATURE_FLAG_SOUNDBAR_MODE,
            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
            DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX,
            DEVICE_CONFIG_FEATURE_FLAG_TV_NUMERIC_SOUNDBAR_VOLUME_UI
    })
    })
    @interface FeatureFlag {}
    @interface FeatureFlag {}


+17 −1
Original line number Original line Diff line number Diff line
@@ -457,6 +457,9 @@ public class HdmiControlService extends SystemService {
    @ServiceThreadOnly
    @ServiceThreadOnly
    private boolean mEarcTxFeatureFlagEnabled = false;
    private boolean mEarcTxFeatureFlagEnabled = false;


    @ServiceThreadOnly
    private boolean mNumericSoundbarVolumeUiOnTvFeatureFlagEnabled = false;

    @ServiceThreadOnly
    @ServiceThreadOnly
    private boolean mTransitionFromArcToEarcTxEnabled = false;
    private boolean mTransitionFromArcToEarcTxEnabled = false;


@@ -682,6 +685,8 @@ public class HdmiControlService extends SystemService {
                Constants.DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX, false);
                Constants.DEVICE_CONFIG_FEATURE_FLAG_ENABLE_EARC_TX, false);
        mTransitionFromArcToEarcTxEnabled = mDeviceConfig.getBoolean(
        mTransitionFromArcToEarcTxEnabled = mDeviceConfig.getBoolean(
                Constants.DEVICE_CONFIG_FEATURE_FLAG_TRANSITION_ARC_TO_EARC_TX, false);
                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) {
        synchronized (mLock) {
            mEarcEnabled = (mHdmiCecConfig.getIntValue(
            mEarcEnabled = (mHdmiCecConfig.getIntValue(
@@ -901,6 +906,17 @@ public class HdmiControlService extends SystemService {
                                false);
                                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 */
    /** Returns true if the device screen is off */
    boolean isScreenOff() {
    boolean isScreenOff() {
@@ -4337,7 +4353,7 @@ public class HdmiControlService extends SystemService {
            case DeviceFeatures.FEATURE_NOT_SUPPORTED:
            case DeviceFeatures.FEATURE_NOT_SUPPORTED:
                // TVs may adopt adjust-only absolute volume behavior if condition 4 isn't met.
                // 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.
                // This allows the device to display numeric volume UI for the System Audio device.
                if (tv() != null) {
                if (tv() != null && mNumericSoundbarVolumeUiOnTvFeatureFlagEnabled) {
                    if (currentVolumeBehavior
                    if (currentVolumeBehavior
                            != AudioManager.DEVICE_VOLUME_BEHAVIOR_ABSOLUTE_ADJUST_ONLY) {
                            != AudioManager.DEVICE_VOLUME_BEHAVIOR_ABSOLUTE_ADJUST_ONLY) {
                        // If we're currently using absolute volume behavior, switch to full volume
                        // If we're currently using absolute volume behavior, switch to full volume