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

Commit 00b976a7 authored by Shubang Lu's avatar Shubang Lu
Browse files

Forward volume keys when system audio mode off and property set

cherry-pick ag/4968405

Bug: 80296335
Test: make; local tests
Change-Id: I04b7cd0958c9300a76f6337ee891b5f4947484ad
parent 4fd1f355
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package android.hardware.hdmi;

import android.annotation.Nullable;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;

import com.android.internal.annotations.VisibleForTesting;
@@ -52,7 +53,7 @@ public final class HdmiAudioSystemClient extends HdmiClient {
    @VisibleForTesting(visibility = Visibility.PACKAGE)
    public HdmiAudioSystemClient(IHdmiControlService service, @Nullable Handler handler) {
        super(service);
        mHandler = handler == null ? new Handler() : handler;
        mHandler = handler == null ? new Handler(Looper.getMainLooper()) : handler;
    }

    /** @hide */
+13 −0
Original line number Diff line number Diff line
@@ -387,6 +387,19 @@ public final class HdmiControlManager {
        }
    }

    /**
     * Gets whether the system is in system audio mode.
     *
     * @hide
     */
    public boolean getSystemAudioMode() {
        try {
            return mService.getSystemAudioMode();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Listener used to get hotplug event from HDMI port.
     */
+8 −0
Original line number Diff line number Diff line
@@ -30,6 +30,14 @@ public class RoSystemProperties {
    public static final String CONTROL_PRIVAPP_PERMISSIONS =
            SystemProperties.get("ro.control_privapp_permissions");

    /**
     * Property to indicate if a CEC audio device should forward volume keys when system audio
     * mode is off.
     */
    public static final boolean CEC_AUDIO_DEVICE_FORWARD_VOLUME_KEYS_SYSTEM_AUDIO_MODE_OFF =
            SystemProperties.getBoolean(
                    "ro.hdmi.cec_audio_device_forward_volume_keys_system_audio_mode_off", false);

    // ------ ro.config.* -------- //
    public static final boolean CONFIG_AVOID_GFX_ACCEL =
            SystemProperties.getBoolean("ro.config.avoid_gfx_accel", false);
+2 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.server.hdmi;

import android.annotation.IntDef;
import android.hardware.hdmi.HdmiDeviceInfo;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

+5 −0
Original line number Diff line number Diff line
@@ -95,6 +95,11 @@ public class HdmiCecLocalDeviceAudioSystem extends HdmiCecLocalDevice {
        startQueuedActions();
    }

    @Override
    protected int findKeyReceiverAddress() {
        return Constants.ADDR_TV;
    }

    @VisibleForTesting
    protected void systemAudioControlOnPowerOn(
            int systemAudioOnPowerOnProp, boolean lastSystemAudioControlStatus) {
Loading