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

Commit 6f57f51a authored by Amy Zhang's avatar Amy Zhang Committed by Automerger Merge Worker
Browse files

Merge "Expose necessary SystemApi as test API for CEC CTS" into rvc-dev am: a7dc4def

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11625493

Change-Id: I8ebf890866f60530c2048b4ad9f74066adc780ea
parents 504c1f0f a7dc4def
Loading
Loading
Loading
Loading
+124 −0
Original line number Diff line number Diff line
@@ -1298,6 +1298,130 @@ package android.hardware.display {

}

package android.hardware.hdmi {

  public final class HdmiControlManager {
    method @Nullable public android.hardware.hdmi.HdmiSwitchClient getSwitchClient();
    method @RequiresPermission("android.permission.HDMI_CEC") public void setStandbyMode(boolean);
    field public static final String ACTION_OSD_MESSAGE = "android.hardware.hdmi.action.OSD_MESSAGE";
    field public static final int AVR_VOLUME_MUTED = 101; // 0x65
    field public static final int CLEAR_TIMER_STATUS_CEC_DISABLE = 162; // 0xa2
    field public static final int CLEAR_TIMER_STATUS_CHECK_RECORDER_CONNECTION = 160; // 0xa0
    field public static final int CLEAR_TIMER_STATUS_FAIL_TO_CLEAR_SELECTED_SOURCE = 161; // 0xa1
    field public static final int CLEAR_TIMER_STATUS_TIMER_CLEARED = 128; // 0x80
    field public static final int CLEAR_TIMER_STATUS_TIMER_NOT_CLEARED_NO_INFO_AVAILABLE = 2; // 0x2
    field public static final int CLEAR_TIMER_STATUS_TIMER_NOT_CLEARED_NO_MATCHING = 1; // 0x1
    field public static final int CLEAR_TIMER_STATUS_TIMER_NOT_CLEARED_RECORDING = 0; // 0x0
    field public static final int CONTROL_STATE_CHANGED_REASON_SETTING = 1; // 0x1
    field public static final int CONTROL_STATE_CHANGED_REASON_STANDBY = 3; // 0x3
    field public static final int CONTROL_STATE_CHANGED_REASON_START = 0; // 0x0
    field public static final int CONTROL_STATE_CHANGED_REASON_WAKEUP = 2; // 0x2
    field public static final int DEVICE_EVENT_ADD_DEVICE = 1; // 0x1
    field public static final int DEVICE_EVENT_REMOVE_DEVICE = 2; // 0x2
    field public static final int DEVICE_EVENT_UPDATE_DEVICE = 3; // 0x3
    field public static final String EXTRA_MESSAGE_EXTRA_PARAM1 = "android.hardware.hdmi.extra.MESSAGE_EXTRA_PARAM1";
    field public static final String EXTRA_MESSAGE_ID = "android.hardware.hdmi.extra.MESSAGE_ID";
    field public static final int ONE_TOUCH_RECORD_ALREADY_RECORDING = 18; // 0x12
    field public static final int ONE_TOUCH_RECORD_CEC_DISABLED = 51; // 0x33
    field public static final int ONE_TOUCH_RECORD_CHECK_RECORDER_CONNECTION = 49; // 0x31
    field public static final int ONE_TOUCH_RECORD_DISALLOW_TO_COPY = 13; // 0xd
    field public static final int ONE_TOUCH_RECORD_DISALLOW_TO_FUTHER_COPIES = 14; // 0xe
    field public static final int ONE_TOUCH_RECORD_FAIL_TO_RECORD_DISPLAYED_SCREEN = 50; // 0x32
    field public static final int ONE_TOUCH_RECORD_INVALID_EXTERNAL_PHYSICAL_ADDRESS = 10; // 0xa
    field public static final int ONE_TOUCH_RECORD_INVALID_EXTERNAL_PLUG_NUMBER = 9; // 0x9
    field public static final int ONE_TOUCH_RECORD_MEDIA_PROBLEM = 21; // 0x15
    field public static final int ONE_TOUCH_RECORD_MEDIA_PROTECTED = 19; // 0x13
    field public static final int ONE_TOUCH_RECORD_NOT_ENOUGH_SPACE = 22; // 0x16
    field public static final int ONE_TOUCH_RECORD_NO_MEDIA = 16; // 0x10
    field public static final int ONE_TOUCH_RECORD_NO_OR_INSUFFICIENT_CA_ENTITLEMENTS = 12; // 0xc
    field public static final int ONE_TOUCH_RECORD_NO_SOURCE_SIGNAL = 20; // 0x14
    field public static final int ONE_TOUCH_RECORD_OTHER_REASON = 31; // 0x1f
    field public static final int ONE_TOUCH_RECORD_PARENT_LOCK_ON = 23; // 0x17
    field public static final int ONE_TOUCH_RECORD_PLAYING = 17; // 0x11
    field public static final int ONE_TOUCH_RECORD_PREVIOUS_RECORDING_IN_PROGRESS = 48; // 0x30
    field public static final int ONE_TOUCH_RECORD_RECORDING_ALREADY_TERMINATED = 27; // 0x1b
    field public static final int ONE_TOUCH_RECORD_RECORDING_ANALOGUE_SERVICE = 3; // 0x3
    field public static final int ONE_TOUCH_RECORD_RECORDING_CURRENTLY_SELECTED_SOURCE = 1; // 0x1
    field public static final int ONE_TOUCH_RECORD_RECORDING_DIGITAL_SERVICE = 2; // 0x2
    field public static final int ONE_TOUCH_RECORD_RECORDING_EXTERNAL_INPUT = 4; // 0x4
    field public static final int ONE_TOUCH_RECORD_RECORDING_TERMINATED_NORMALLY = 26; // 0x1a
    field public static final int ONE_TOUCH_RECORD_UNABLE_ANALOGUE_SERVICE = 6; // 0x6
    field public static final int ONE_TOUCH_RECORD_UNABLE_DIGITAL_SERVICE = 5; // 0x5
    field public static final int ONE_TOUCH_RECORD_UNABLE_SELECTED_SERVICE = 7; // 0x7
    field public static final int ONE_TOUCH_RECORD_UNSUPPORTED_CA = 11; // 0xb
    field public static final int OSD_MESSAGE_ARC_CONNECTED_INVALID_PORT = 1; // 0x1
    field public static final int OSD_MESSAGE_AVR_VOLUME_CHANGED = 2; // 0x2
    field public static final int POWER_STATUS_ON = 0; // 0x0
    field public static final int POWER_STATUS_STANDBY = 1; // 0x1
    field public static final int POWER_STATUS_TRANSIENT_TO_ON = 2; // 0x2
    field public static final int POWER_STATUS_TRANSIENT_TO_STANDBY = 3; // 0x3
    field public static final int POWER_STATUS_UNKNOWN = -1; // 0xffffffff
    field @Deprecated public static final int RESULT_ALREADY_IN_PROGRESS = 4; // 0x4
    field public static final int RESULT_COMMUNICATION_FAILED = 7; // 0x7
    field public static final int RESULT_EXCEPTION = 5; // 0x5
    field public static final int RESULT_INCORRECT_MODE = 6; // 0x6
    field public static final int RESULT_SOURCE_NOT_AVAILABLE = 2; // 0x2
    field public static final int RESULT_SUCCESS = 0; // 0x0
    field public static final int RESULT_TARGET_NOT_AVAILABLE = 3; // 0x3
    field public static final int RESULT_TIMEOUT = 1; // 0x1
    field public static final int TIMER_RECORDING_RESULT_EXTRA_CEC_DISABLED = 3; // 0x3
    field public static final int TIMER_RECORDING_RESULT_EXTRA_CHECK_RECORDER_CONNECTION = 1; // 0x1
    field public static final int TIMER_RECORDING_RESULT_EXTRA_FAIL_TO_RECORD_SELECTED_SOURCE = 2; // 0x2
    field public static final int TIMER_RECORDING_RESULT_EXTRA_NO_ERROR = 0; // 0x0
    field public static final int TIMER_RECORDING_TYPE_ANALOGUE = 2; // 0x2
    field public static final int TIMER_RECORDING_TYPE_DIGITAL = 1; // 0x1
    field public static final int TIMER_RECORDING_TYPE_EXTERNAL = 3; // 0x3
    field public static final int TIMER_STATUS_MEDIA_INFO_NOT_PRESENT = 2; // 0x2
    field public static final int TIMER_STATUS_MEDIA_INFO_PRESENT_NOT_PROTECTED = 0; // 0x0
    field public static final int TIMER_STATUS_MEDIA_INFO_PRESENT_PROTECTED = 1; // 0x1
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_CA_NOT_SUPPORTED = 6; // 0x6
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_CLOCK_FAILURE = 10; // 0xa
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_DATE_OUT_OF_RANGE = 2; // 0x2
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_DUPLICATED = 14; // 0xe
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_INVALID_EXTERNAL_PHYSICAL_NUMBER = 5; // 0x5
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_INVALID_EXTERNAL_PLUG_NUMBER = 4; // 0x4
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_INVALID_SEQUENCE = 3; // 0x3
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_NO_CA_ENTITLEMENTS = 7; // 0x7
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_NO_FREE_TIME = 1; // 0x1
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_PARENTAL_LOCK_ON = 9; // 0x9
    field public static final int TIMER_STATUS_NOT_PROGRAMMED_UNSUPPORTED_RESOLUTION = 8; // 0x8
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_ENOUGH_SPACE = 8; // 0x8
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_MIGHT_NOT_ENOUGH_SPACE = 11; // 0xb
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_NOT_ENOUGH_SPACE = 9; // 0x9
    field public static final int TIMER_STATUS_PROGRAMMED_INFO_NO_MEDIA_INFO = 10; // 0xa
  }

  public final class HdmiControlServiceWrapper {
    ctor public HdmiControlServiceWrapper();
    method @NonNull public android.hardware.hdmi.HdmiControlManager createHdmiControlManager();
    method @BinderThread public void setDeviceTypes(@NonNull int[]);
    method @BinderThread public void setPortInfo(@NonNull java.util.List<android.hardware.hdmi.HdmiPortInfo>);
    field public static final int DEVICE_PURE_CEC_SWITCH = 6; // 0x6
  }

  public final class HdmiPortInfo implements android.os.Parcelable {
    ctor public HdmiPortInfo(int, int, int, boolean, boolean, boolean);
    method public int describeContents();
    method public int getAddress();
    method public int getId();
    method public int getType();
    method public boolean isArcSupported();
    method public boolean isCecSupported();
    method public boolean isMhlSupported();
    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.hdmi.HdmiPortInfo> CREATOR;
    field public static final int PORT_INPUT = 0; // 0x0
    field public static final int PORT_OUTPUT = 1; // 0x1
  }

  public class HdmiSwitchClient {
    method public int getDeviceType();
    method @NonNull public java.util.List<android.hardware.hdmi.HdmiPortInfo> getPortInfo();
    method public void sendKeyEvent(int, boolean);
    method public void sendVendorCommand(int, byte[], boolean);
  }

}

package android.hardware.lights {

  public final class Light implements android.os.Parcelable {
+3 −1
Original line number Diff line number Diff line
package android.hardware.hdmi;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.hardware.hdmi.HdmiControlManager.VendorCommandListener;
import android.os.RemoteException;
@@ -84,7 +85,8 @@ public abstract class HdmiClient {
     * @param hasVendorId {@code true} if the command type will be &lt;Vendor Command With ID&gt;.
     *                    {@code false} if the command will be &lt;Vendor Command&gt;
     */
    public void sendVendorCommand(int targetAddress, byte[] params, boolean hasVendorId) {
    public void sendVendorCommand(int targetAddress,
            @SuppressLint("MissingNullability") byte[] params, boolean hasVendorId) {
        try {
            mService.sendVendorCommand(getDeviceType(), targetAddress, params, hasVendorId);
        } catch (RemoteException e) {
+25 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SuppressLint;
import android.annotation.SystemApi;
import android.annotation.SystemService;
import android.annotation.TestApi;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Binder;
@@ -57,6 +58,7 @@ import java.util.concurrent.Executor;
 * @hide
 */
@SystemApi
@TestApi
@SystemService(Context.HDMI_CONTROL_SERVICE)
@RequiresFeature(PackageManager.FEATURE_HDMI_CEC)
public final class HdmiControlManager {
@@ -139,6 +141,8 @@ public final class HdmiControlManager {
    public static final int POWER_STATUS_TRANSIENT_TO_ON = 2;
    public static final int POWER_STATUS_TRANSIENT_TO_STANDBY = 3;

    /** @hide */
    @SystemApi
    @IntDef ({
        RESULT_SUCCESS,
        RESULT_TIMEOUT,
@@ -400,8 +404,11 @@ public final class HdmiControlManager {
     * See {@link HdmiDeviceInfo#DEVICE_PLAYBACK}
     * See {@link HdmiDeviceInfo#DEVICE_TV}
     * See {@link HdmiDeviceInfo#DEVICE_AUDIO_SYSTEM}
     *
     * @hide
     */
    @Nullable
    @SystemApi
    @SuppressLint("Doclava125")
    public HdmiClient getClient(int type) {
        if (mService == null) {
@@ -430,8 +437,11 @@ public final class HdmiControlManager {
     * system if the system is configured to host more than one type of HDMI-CEC logical devices.
     *
     * @return {@link HdmiPlaybackClient} instance. {@code null} on failure.
     *
     * @hide
     */
    @Nullable
    @SystemApi
    @SuppressLint("Doclava125")
    public HdmiPlaybackClient getPlaybackClient() {
        return (HdmiPlaybackClient) getClient(HdmiDeviceInfo.DEVICE_PLAYBACK);
@@ -445,8 +455,11 @@ public final class HdmiControlManager {
     * system if the system is configured to host more than one type of HDMI-CEC logical devices.
     *
     * @return {@link HdmiTvClient} instance. {@code null} on failure.
     *
     * @hide
     */
    @Nullable
    @SystemApi
    @SuppressLint("Doclava125")
    public HdmiTvClient getTvClient() {
        return (HdmiTvClient) getClient(HdmiDeviceInfo.DEVICE_TV);
@@ -478,10 +491,8 @@ public final class HdmiControlManager {
     * system if the system is configured to host more than one type of HDMI-CEC logical device.
     *
     * @return {@link HdmiSwitchClient} instance. {@code null} on failure.
     * @hide
     */
    @Nullable
    @SystemApi
    @SuppressLint("Doclava125")
    public HdmiSwitchClient getSwitchClient() {
        return (HdmiSwitchClient) getClient(HdmiDeviceInfo.DEVICE_PURE_CEC_SWITCH);
@@ -790,7 +801,10 @@ public final class HdmiControlManager {

    /**
     * Listener used to get hotplug event from HDMI port.
     *
     * @hide
     */
    @SystemApi
    public interface HotplugEventListener {
        void onReceived(HdmiHotplugEvent event);
    }
@@ -840,7 +854,10 @@ public final class HdmiControlManager {

    /**
     * Listener used to get vendor-specific commands.
     *
     * @hide
     */
    @SystemApi
    public interface VendorCommandListener {
        /**
         * Called when a vendor command is received.
@@ -879,7 +896,10 @@ public final class HdmiControlManager {
     *
     * @param listener {@link HotplugEventListener} instance
     * @see HdmiControlManager#removeHotplugEventListener(HotplugEventListener)
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.HDMI_CEC)
    public void addHotplugEventListener(HotplugEventListener listener) {
        if (mService == null) {
@@ -903,7 +923,10 @@ public final class HdmiControlManager {
     * Removes a listener to stop getting informed of {@link HdmiHotplugEvent}.
     *
     * @param listener {@link HotplugEventListener} instance to be removed
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.HDMI_CEC)
    public void removeHotplugEventListener(HotplugEventListener listener) {
        if (mService == null) {
+469 −0

File added.

Preview size limit exceeded, changes collapsed.

+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.hardware.hdmi;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.Parcel;
import android.os.Parcelable;

@@ -28,6 +29,7 @@ import android.os.Parcelable;
 * @hide
 */
@SystemApi
@TestApi
public final class HdmiPortInfo implements Parcelable {
    /** HDMI port type: Input */
    public static final int PORT_INPUT = 0;
@@ -153,7 +155,9 @@ public final class HdmiPortInfo implements Parcelable {
     * @param dest The Parcel in which the object should be written.
     * @param flags Additional flags about how the object should be written.
     *        May be 0 or {@link Parcelable#PARCELABLE_WRITE_RETURN_VALUE}.
     * @hide
     */
    @SystemApi
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(mId);
@@ -187,4 +191,9 @@ public final class HdmiPortInfo implements Parcelable {
                && mCecSupported == other.mCecSupported && mArcSupported == other.mArcSupported
                && mMhlSupported == other.mMhlSupported;
    }

    @Override
    public int hashCode() {
        return mId;
    }
}
Loading