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

Commit 85bff85f authored by Amy's avatar Amy Committed by shubang
Browse files

Back out unneeded ag/4808863.

Standby has been handled in ag/4881453.

ag/5112445

Bug: 113288856

Test: local test.
Change-Id: I2dd4a8fe8478cc35f21de8a1890d6d92b8010455
parent 0c891e8f
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -9369,8 +9369,7 @@ public final class Settings {
                "hdmi_control_auto_wakeup_enabled";
        /**
         * Whether TV or Audio System will also turn off other CEC devices when it goes to standby
         * mode.
         * Whether TV will also turn off other CEC devices when it goes to standby mode.
         * (0 = false, 1 = true)
         *
         * @hide
@@ -9378,15 +9377,6 @@ public final class Settings {
        public static final String HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED =
                "hdmi_control_auto_device_off_enabled";
        /**
         * Whether Audio System will also turn off TV when it goes to standby mode.
         * (0 = false, 1 = true)
         *
         * @hide
         */
        public static final String HDMI_CONTROL_AUTO_TV_OFF_ENABLED =
                "hdmi_control_auto_tv_off_enabled";
        /**
         * If <b>true</b>, enables out-of-the-box execution for priv apps.
         * Default: false
+0 −38
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ import android.media.AudioManager;
import android.media.AudioSystem;
import android.media.tv.TvContract;
import android.os.SystemProperties;
import android.provider.Settings.Global;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -55,11 +54,6 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {

    private boolean mTvSystemAudioModeSupport;

    // Whether the auido system will turn TV off when it's powering off
    private boolean mAutoTvOff;
    // Whether the auido system will broadcast standby to the system when it's powering off
    private boolean mAutoDeviceOff;

    // Whether ARC is available or not. "true" means that ARC is established between TV and
    // AVR as audio receiver.
    @ServiceThreadOnly private boolean mArcEstablished = false;
@@ -81,10 +75,6 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        // TODO(amyjojo) make System Audio Control controllable by users
        /*mSystemAudioControlFeatureEnabled =
        mService.readBooleanSetting(Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED, true);*/
        mAutoDeviceOff = mService.readBooleanSetting(
                Global.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED, true);
        mAutoTvOff = mService.readBooleanSetting(
                Global.HDMI_CONTROL_AUTO_TV_OFF_ENABLED, true);
        // TODO(amyjojo): make the map ro property.
        mTvInputs.put(Constants.CEC_SWITCH_HDMI1,
                "com.droidlogic.tvinput/.services.Hdmi1InputService/HW5");
@@ -106,21 +96,6 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
                    mSystemAudioActivated ? "true" : "false");
        }
        terminateSystemAudioMode();

        HdmiLogger.debug(TAG + " onStandby, initiatedByCec:" + initiatedByCec
                + ", mAutoDeviceOff: " + mAutoDeviceOff + ", mAutoTvOff: " + mAutoTvOff);
        if (!mService.isControlEnabled() || initiatedByCec) {
            return;
        }
        if (mAutoDeviceOff) {
            mService.sendCecCommand(
                    HdmiCecMessageBuilder.buildStandby(mAddress, Constants.ADDR_BROADCAST));
        } else if (mAutoTvOff) {
            mService.sendCecCommand(
                    HdmiCecMessageBuilder.buildStandby(mAddress, Constants.ADDR_TV));
        }
        return;

    }

    @Override
@@ -594,19 +569,6 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        }
    }

    @ServiceThreadOnly
    protected void setAutoTvOff(boolean autoTvOff) {
        assertRunOnServiceThread();
        mAutoTvOff = autoTvOff;
    }

    @Override
    @ServiceThreadOnly
    void setAutoDeviceOff(boolean autoDeviceOff) {
        assertRunOnServiceThread();
        mAutoDeviceOff = autoDeviceOff;
    }

    @Override
    protected void switchInputOnReceivingNewActivePath(int physicalAddress) {
        int port = getLocalPortFromPhysicalAddress(physicalAddress);
+0 −5
Original line number Diff line number Diff line
@@ -596,11 +596,6 @@ public class HdmiControlService extends SystemService {
                    }
                    // No need to propagate to HAL.
                    break;
                case Global.HDMI_CONTROL_AUTO_TV_OFF_ENABLED:
                    if (isAudioSystemDevice()) {
                        audioSystem().setAutoTvOff(enabled);
                    }
                    break;
                case Global.HDMI_SYSTEM_AUDIO_CONTROL_ENABLED:
                    if (isTvDeviceEnabled()) {
                        tv().setSystemAudioControlFeatureEnabled(enabled);
+0 −18
Original line number Diff line number Diff line
@@ -126,11 +126,6 @@ public class HdmiCecLocalDeviceAudioSystemTest {

                @Override
                void wakeUp() {}

                @Override
                boolean isControlEnabled() {
                    return true;
                }
            };

        mMyLooper = mTestLooper.getLooper();
@@ -297,8 +292,6 @@ public class HdmiCecLocalDeviceAudioSystemTest {

    @Test
    public void onStandbyAudioSystem_currentSystemAudioControlOn() throws Exception {
        mHdmiCecLocalDeviceAudioSystem.setAutoDeviceOff(false);
        mHdmiCecLocalDeviceAudioSystem.setAutoTvOff(false);
        // Set system audio control on first
        mHdmiCecLocalDeviceAudioSystem.checkSupportAndSetSystemAudioMode(true);
        // Check if standby correctly turns off the feature
@@ -518,17 +511,6 @@ public class HdmiCecLocalDeviceAudioSystemTest {
        assertThat(mNativeWrapper.getOnlyResultMessage()).isEqualTo(expectedMessage);
    }

    @Test
    public void onStandby_setAutoDeviceOff_true() throws Exception {
        HdmiCecMessage expectedMessage =
                HdmiCecMessageBuilder.buildStandby(ADDR_AUDIO_SYSTEM, ADDR_BROADCAST);
        mHdmiCecLocalDeviceAudioSystem.setAutoDeviceOff(true);
        mHdmiCecLocalDeviceAudioSystem.onStandby(false, STANDBY_SCREEN_OFF);

        mTestLooper.dispatchAll();
        assertThat(mNativeWrapper.getOnlyResultMessage()).isEqualTo(expectedMessage);
    }

    public void handleSystemAudioModeRequest_fromNonTV_tVNotSupport() {
        HdmiCecMessage message =
                HdmiCecMessageBuilder.buildSystemAudioModeRequest(