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

Commit a6c9e20c authored by Shubang Lu's avatar Shubang Lu Committed by Android (Google) Code Review
Browse files

Merge changes I97f97167,I4bf51c47,I8d3193e0,I224a1616,Ie774b0eb, ...

* changes:
  Adding HDMI_CEC_SWITCH_ENABLE Global property to enable/disable Routing Control feature.
  Fix spelling errors in HdmiCecMessage.toString
  More skeleton code for <RequestShortAuidoDescriptor>
  Add a getPhysicalAddress api to hdmicontrolservice.
  Set System Audio Mode on when switch to Audio Only source
  Call HdmiCecLocalDeviceAudioSystem to report audio status.
  Add a delay state into DeviceDiscoveryAction.
parents 947a92c2 0c2e29fa
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -15,10 +15,12 @@
 */
package android.hardware.hdmi;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.os.Handler;
import android.os.Looper;
import android.os.RemoteException;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.annotations.VisibleForTesting.Visibility;
@@ -56,6 +58,21 @@ public final class HdmiAudioSystemClient extends HdmiClient {
        mHandler = handler == null ? new Handler(Looper.getMainLooper()) : handler;
    }

    /**
     * Callback interface used to get the set System Audio Mode result.
     *
     * @hide
     */
    // TODO(b/110094868): unhide and add @SystemApi for Q
    public interface SetSystemAudioModeCallback {
        /**
         * Called when the input was changed.
         *
         * @param result the result of the set System Audio Mode
         */
        void onComplete(int result);
    }

    /** @hide */
    // TODO(b/110094868): unhide and add @SystemApi for Q
    @Override
@@ -117,4 +134,34 @@ public final class HdmiAudioSystemClient extends HdmiClient {
            mPendingReportAudioStatus = true;
        }
    }

    /**
     * Set System Audio Mode on/off with audio system device.
     *
     * @param state true to set System Audio Mode on. False to set off.
     * @param callback callback offer the setting result.
     *
     * @hide
     */
    // TODO(b/110094868): unhide and add @SystemApi for Q
    public void setSystemAudioMode(boolean state, @NonNull SetSystemAudioModeCallback callback) {
        // TODO(amyjojo): implement this when needed.
    }

    /**
     * When device is switching to an audio only source, this method is called to broadcast
     * a setSystemAudioMode on message to the HDMI CEC system without querying Active Source or
     * TV supporting System Audio Control or not. This is to get volume control passthrough
     * from STB even if TV does not support it.
     *
     * @hide
     */
    // TODO(b/110094868): unhide and add @SystemApi for Q
    public void setSystemAudioModeOnForAudioOnlySource() {
        try {
            mService.setSystemAudioModeOnForAudioOnlySource();
        } catch (RemoteException e) {
            Log.d(TAG, "Failed to set System Audio Mode on for Audio Only source");
        }
    }
}
+13 −0
Original line number Diff line number Diff line
@@ -431,6 +431,19 @@ public final class HdmiControlManager {
        }
    }

    /**
     * Get the physical address of the device.
     *
     * @hide
     */
    public int getPhysicalAddress() {
        try {
            return mService.getPhysicalAddress();
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Listener used to get hotplug event from HDMI port.
     */
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ interface IHdmiControlService {
    List<HdmiPortInfo> getPortInfo();
    boolean canChangeSystemAudioMode();
    boolean getSystemAudioMode();
    int getPhysicalAddress();
    void setSystemAudioMode(boolean enabled, IHdmiControlCallback callback);
    void addSystemAudioModeChangeListener(IHdmiSystemAudioModeChangeListener listener);
    void removeSystemAudioModeChangeListener(IHdmiSystemAudioModeChangeListener listener);
@@ -73,4 +74,5 @@ interface IHdmiControlService {
    void addHdmiMhlVendorCommandListener(IHdmiMhlVendorCommandListener listener);
    void setStandbyMode(boolean isStandbyModeOn);
    void reportAudioStatus(int deviceType, int volume, int maxVolume, boolean isMute);
    void setSystemAudioModeOnForAudioOnlySource();
}
+9 −0
Original line number Diff line number Diff line
@@ -9380,6 +9380,15 @@ public final class Settings {
        public static final String HDMI_SYSTEM_AUDIO_CONTROL_ENABLED =
                "hdmi_system_audio_control_enabled";
        /**
         * Whether HDMI Routing Control feature is enabled. If enabled, the switch device will
         * route to the correct input source on receiving Routing Control related messages. If
         * disabled, you can only switch the input via controls on this device.
         * @hide
         */
        public static final String HDMI_CEC_SWITCH_ENABLED =
                "hdmi_cec_switch_enabled";
        /**
         * Whether TV will automatically turn on upon reception of the CEC command
         * &lt;Text View On&gt; or &lt;Image View On&gt;. (0 = false, 1 = true)
+1 −0
Original line number Diff line number Diff line
@@ -270,6 +270,7 @@ public class SettingsBackupTest {
                    Settings.Global.GNSS_HAL_LOCATION_REQUEST_DURATION_MILLIS,
                    Settings.Global.GNSS_SATELLITE_BLACKLIST,
                    Settings.Global.GPRS_REGISTER_CHECK_PERIOD_MS,
                    Settings.Global.HDMI_CEC_SWITCH_ENABLED,
                    Settings.Global.HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED,
                    Settings.Global.HDMI_CONTROL_AUTO_WAKEUP_ENABLED,
                    Settings.Global.HDMI_CONTROL_ENABLED,
Loading