Loading services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +4 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ abstract class HdmiCecFeatureAction { // Default state used in common by all the feature actions. protected static final int STATE_NONE = 0; // Delay to query avr's audio status, some avrs could report the old volume first. It could // show inverse mute state on TV. protected static final long DELAY_GIVE_AUDIO_STATUS = 500; // Internal state indicating the progress of action. protected int mState = STATE_NONE; Loading services/core/java/com/android/server/hdmi/HdmiControlService.java +4 −0 Original line number Diff line number Diff line Loading @@ -1638,6 +1638,10 @@ public class HdmiControlService extends SystemService { mHandler.post(new WorkSourceUidPreservingRunnable(runnable)); } void runOnServiceThreadDelayed(Runnable runnable, long delay) { mHandler.postDelayed(new WorkSourceUidPreservingRunnable(runnable), delay); } private void assertRunOnServiceThread() { if (Looper.myLooper() != mHandler.getLooper()) { throw new IllegalStateException("Should run on service thread."); Loading services/core/java/com/android/server/hdmi/SendKeyAction.java +10 −3 Original line number Diff line number Diff line Loading @@ -180,15 +180,22 @@ final class SendKeyAction extends HdmiCecFeatureAction { && localDevice().getService().isAbsoluteVolumeBehaviorEnabled()) { sendCommand(HdmiCecMessageBuilder.buildUserControlReleased(getSourceAddress(), mTargetAddress), __ -> sendCommand(HdmiCecMessageBuilder.buildGiveAudioStatus( getSourceAddress(), localDevice().findAudioReceiverAddress()))); __ -> queryAvrAudioStatus()); } else { sendCommand(HdmiCecMessageBuilder.buildUserControlReleased(getSourceAddress(), mTargetAddress)); } } private void queryAvrAudioStatus() { localDevice().mService.runOnServiceThreadDelayed( () -> sendCommand(HdmiCecMessageBuilder.buildGiveAudioStatus( getSourceAddress(), localDevice().findAudioReceiverAddress())), DELAY_GIVE_AUDIO_STATUS); } @Override public boolean processCommand(HdmiCecMessage cmd) { // Send key action doesn't need any incoming CEC command, hence does not consume it. Loading services/tests/servicestests/src/com/android/server/hdmi/BaseAbsoluteVolumeBehaviorTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.hardware.hdmi.HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM; import static com.android.server.hdmi.HdmiCecKeycode.CEC_KEYCODE_VOLUME_UP; import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_BOOT_UP; import static com.android.server.hdmi.HdmiCecFeatureAction.DELAY_GIVE_AUDIO_STATUS; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.TruthJUnit.assume; Loading Loading @@ -582,6 +583,9 @@ public abstract class BaseAbsoluteVolumeBehaviorTest { ); mTestLooper.dispatchAll(); mTestLooper.moveTimeForward(DELAY_GIVE_AUDIO_STATUS); mTestLooper.dispatchAll(); assertThat(mNativeWrapper.getResultMessages()).contains( HdmiCecMessageBuilder.buildUserControlPressed(getLogicalAddress(), getSystemAudioDeviceLogicalAddress(), CEC_KEYCODE_VOLUME_UP)); Loading services/tests/servicestests/src/com/android/server/hdmi/BaseTvToAudioSystemAvbTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.hdmi; import static com.android.server.hdmi.HdmiCecKeycode.CEC_KEYCODE_VOLUME_UP; import static com.android.server.hdmi.HdmiCecFeatureAction.DELAY_GIVE_AUDIO_STATUS; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -223,6 +224,9 @@ public abstract class BaseTvToAudioSystemAvbTest extends BaseAbsoluteVolumeBehav ); mTestLooper.dispatchAll(); mTestLooper.moveTimeForward(DELAY_GIVE_AUDIO_STATUS); mTestLooper.dispatchAll(); assertThat(mNativeWrapper.getResultMessages()).contains( HdmiCecMessageBuilder.buildUserControlPressed(getLogicalAddress(), getSystemAudioDeviceLogicalAddress(), CEC_KEYCODE_VOLUME_UP)); Loading Loading
services/core/java/com/android/server/hdmi/HdmiCecFeatureAction.java +4 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,10 @@ abstract class HdmiCecFeatureAction { // Default state used in common by all the feature actions. protected static final int STATE_NONE = 0; // Delay to query avr's audio status, some avrs could report the old volume first. It could // show inverse mute state on TV. protected static final long DELAY_GIVE_AUDIO_STATUS = 500; // Internal state indicating the progress of action. protected int mState = STATE_NONE; Loading
services/core/java/com/android/server/hdmi/HdmiControlService.java +4 −0 Original line number Diff line number Diff line Loading @@ -1638,6 +1638,10 @@ public class HdmiControlService extends SystemService { mHandler.post(new WorkSourceUidPreservingRunnable(runnable)); } void runOnServiceThreadDelayed(Runnable runnable, long delay) { mHandler.postDelayed(new WorkSourceUidPreservingRunnable(runnable), delay); } private void assertRunOnServiceThread() { if (Looper.myLooper() != mHandler.getLooper()) { throw new IllegalStateException("Should run on service thread."); Loading
services/core/java/com/android/server/hdmi/SendKeyAction.java +10 −3 Original line number Diff line number Diff line Loading @@ -180,15 +180,22 @@ final class SendKeyAction extends HdmiCecFeatureAction { && localDevice().getService().isAbsoluteVolumeBehaviorEnabled()) { sendCommand(HdmiCecMessageBuilder.buildUserControlReleased(getSourceAddress(), mTargetAddress), __ -> sendCommand(HdmiCecMessageBuilder.buildGiveAudioStatus( getSourceAddress(), localDevice().findAudioReceiverAddress()))); __ -> queryAvrAudioStatus()); } else { sendCommand(HdmiCecMessageBuilder.buildUserControlReleased(getSourceAddress(), mTargetAddress)); } } private void queryAvrAudioStatus() { localDevice().mService.runOnServiceThreadDelayed( () -> sendCommand(HdmiCecMessageBuilder.buildGiveAudioStatus( getSourceAddress(), localDevice().findAudioReceiverAddress())), DELAY_GIVE_AUDIO_STATUS); } @Override public boolean processCommand(HdmiCecMessage cmd) { // Send key action doesn't need any incoming CEC command, hence does not consume it. Loading
services/tests/servicestests/src/com/android/server/hdmi/BaseAbsoluteVolumeBehaviorTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.hardware.hdmi.HdmiDeviceInfo.DEVICE_AUDIO_SYSTEM; import static com.android.server.hdmi.HdmiCecKeycode.CEC_KEYCODE_VOLUME_UP; import static com.android.server.hdmi.HdmiControlService.INITIATED_BY_BOOT_UP; import static com.android.server.hdmi.HdmiCecFeatureAction.DELAY_GIVE_AUDIO_STATUS; import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.TruthJUnit.assume; Loading Loading @@ -582,6 +583,9 @@ public abstract class BaseAbsoluteVolumeBehaviorTest { ); mTestLooper.dispatchAll(); mTestLooper.moveTimeForward(DELAY_GIVE_AUDIO_STATUS); mTestLooper.dispatchAll(); assertThat(mNativeWrapper.getResultMessages()).contains( HdmiCecMessageBuilder.buildUserControlPressed(getLogicalAddress(), getSystemAudioDeviceLogicalAddress(), CEC_KEYCODE_VOLUME_UP)); Loading
services/tests/servicestests/src/com/android/server/hdmi/BaseTvToAudioSystemAvbTest.java +4 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.hdmi; import static com.android.server.hdmi.HdmiCecKeycode.CEC_KEYCODE_VOLUME_UP; import static com.android.server.hdmi.HdmiCecFeatureAction.DELAY_GIVE_AUDIO_STATUS; import static com.google.common.truth.Truth.assertThat; Loading Loading @@ -223,6 +224,9 @@ public abstract class BaseTvToAudioSystemAvbTest extends BaseAbsoluteVolumeBehav ); mTestLooper.dispatchAll(); mTestLooper.moveTimeForward(DELAY_GIVE_AUDIO_STATUS); mTestLooper.dispatchAll(); assertThat(mNativeWrapper.getResultMessages()).contains( HdmiCecMessageBuilder.buildUserControlPressed(getLogicalAddress(), getSystemAudioDeviceLogicalAddress(), CEC_KEYCODE_VOLUME_UP)); Loading