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

Commit 13fa16b7 authored by Nathalie Le Clair's avatar Nathalie Le Clair Committed by Android (Google) Code Review
Browse files

Merge changes Ic5a4bb74,I7137f4e5

* changes:
  CEC: Do not wake device on quiescent boot
  Add onBootPhase call to tests that use AudioDevice
parents bc4e0447 4cc7739c
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -265,13 +265,20 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDeviceSource {
        // to request Short Audio Descriptor. Since ARC and SAM are independent,
        // we can turn on ARC anyways when audio system device just boots up.
        initArcOnFromAvr();

        // This prevents turning on of System Audio Mode during a quiescent boot. If the quiescent
        // boot is exited just after this check, this code will be executed only at the next
        // wake-up.
        if (!mService.isScreenOff()) {
            int systemAudioControlOnPowerOnProp =
                    SystemProperties.getInt(
                            PROPERTY_SYSTEM_AUDIO_CONTROL_ON_POWER_ON,
                            ALWAYS_SYSTEM_AUDIO_CONTROL_ON_POWER_ON);
            boolean lastSystemAudioControlStatus =
                    SystemProperties.getBoolean(Constants.PROPERTY_LAST_SYSTEM_AUDIO_CONTROL, true);
        systemAudioControlOnPowerOn(systemAudioControlOnPowerOnProp, lastSystemAudioControlStatus);
            systemAudioControlOnPowerOn(
                    systemAudioControlOnPowerOnProp, lastSystemAudioControlStatus);
        }
        mService.getHdmiCecNetwork().clearDeviceList();
        launchDeviceDiscovery();
        startQueuedActions();
+11 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.database.ContentObserver;
import android.hardware.display.DisplayManager;
import android.hardware.hdmi.HdmiControlManager;
import android.hardware.hdmi.HdmiDeviceInfo;
import android.hardware.hdmi.HdmiHotplugEvent;
@@ -81,6 +82,7 @@ import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Slog;
import android.util.SparseArray;
import android.view.Display;

import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -413,6 +415,9 @@ public class HdmiControlService extends SystemService {
    @Nullable
    private Looper mIoLooper;

    @Nullable
    private DisplayManager mDisplayManager;

    @HdmiControlManager.HdmiCecVersion
    private int mCecVersion;

@@ -679,6 +684,11 @@ public class HdmiControlService extends SystemService {
                }, mServiceThreadExecutor);
    }

    /** Returns true if the device screen is off */
    boolean isScreenOff() {
        return mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY).getState() == Display.STATE_OFF;
    }

    private void bootCompleted() {
        // on boot, if device is interactive, set HDMI CEC state as powered on as well
        if (mPowerManager.isInteractive() && isPowerStandbyOrTransient()) {
@@ -734,6 +744,7 @@ public class HdmiControlService extends SystemService {
    @Override
    public void onBootPhase(int phase) {
        if (phase == SystemService.PHASE_SYSTEM_SERVICES_READY) {
            mDisplayManager = getContext().getSystemService(DisplayManager.class);
            mTvInputManager = (TvInputManager) getContext().getSystemService(
                    Context.TV_INPUT_SERVICE);
            mPowerManager = new PowerManagerWrapper(getContext());
+2 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.server.hdmi;

import static com.android.server.SystemService.PHASE_SYSTEM_SERVICES_READY;
import static com.android.server.hdmi.Constants.ADDR_TV;
import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_ENABLE_CEC;

@@ -153,6 +154,7 @@ public class ActiveSourceActionTest {
                mHdmiControlService);
        audioDevice.init();
        mLocalDevices.add(audioDevice);
        mHdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY);
        mHdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC);
        mTestLooper.dispatchAll();

+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.server.hdmi;

import static com.android.server.SystemService.PHASE_SYSTEM_SERVICES_READY;
import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_ENABLE_CEC;

import static com.google.common.truth.Truth.assertThat;
@@ -115,6 +116,7 @@ public class ArcInitiationActionFromAvrTest {
        mAction = new ArcInitiationActionFromAvr(mHdmiCecLocalDeviceAudioSystem);

        mLocalDevices.add(mHdmiCecLocalDeviceAudioSystem);
        hdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY);
        hdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC);
        mTestLooper.dispatchAll();
    }
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.server.hdmi;

import static com.android.server.SystemService.PHASE_SYSTEM_SERVICES_READY;
import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_ENABLE_CEC;

import static com.google.common.truth.Truth.assertThat;
@@ -114,6 +115,7 @@ public class ArcTerminationActionFromAvrTest {
        mAction = new ArcTerminationActionFromAvr(mHdmiCecLocalDeviceAudioSystem);

        mLocalDevices.add(mHdmiCecLocalDeviceAudioSystem);
        hdmiControlService.onBootPhase(PHASE_SYSTEM_SERVICES_READY);
        hdmiControlService.allocateLogicalAddress(mLocalDevices, INITIATED_BY_ENABLE_CEC);
        mHdmiCecLocalDeviceAudioSystem.setArcStatus(true);
        mTestLooper.dispatchAll();
Loading