Merge "CEC: Fix apilint errors." into lmp-mr1-dev
diff --git a/core/java/android/hardware/hdmi/HdmiClient.java b/core/java/android/hardware/hdmi/HdmiClient.java
index e96e150..45a79e1 100644
--- a/core/java/android/hardware/hdmi/HdmiClient.java
+++ b/core/java/android/hardware/hdmi/HdmiClient.java
@@ -16,11 +16,13 @@
 public abstract class HdmiClient {
     private static final String TAG = "HdmiClient";
 
-    protected final IHdmiControlService mService;
+    /* package */ final IHdmiControlService mService;
 
-    protected abstract int getDeviceType();
+    private IHdmiVendorCommandListener mIHdmiVendorCommandListener;
 
-    public HdmiClient(IHdmiControlService service) {
+    /* package */ abstract int getDeviceType();
+
+    /* package */ HdmiClient(IHdmiControlService service) {
         mService = service;
     }
 
@@ -40,7 +42,7 @@
     }
 
     /**
-     * Send a key event to other logical device.
+     * Sends a key event to other logical device.
      *
      * @param keyCode key code to send. Defined in {@link android.view.KeyEvent}.
      * @param isPressed true if this is key press event
@@ -54,7 +56,7 @@
     }
 
     /**
-     * Send vendor-specific command.
+     * Sends vendor-specific command.
      *
      * @param targetAddress address of the target device
      * @param params vendor-specific parameter. For <Vendor Command With ID> do not
@@ -71,18 +73,23 @@
     }
 
     /**
-     * Add a listener used to receive incoming vendor-specific command.
+     * Sets a listener used to receive incoming vendor-specific command.
      *
      * @param listener listener object
      */
-    public void addVendorCommandListener(@NonNull VendorCommandListener listener) {
+    public void setVendorCommandListener(@NonNull VendorCommandListener listener) {
         if (listener == null) {
             throw new IllegalArgumentException("listener cannot be null");
         }
+        if (mIHdmiVendorCommandListener != null) {
+            throw new IllegalStateException("listener was already set");
+        }
         try {
-            mService.addVendorCommandListener(getListenerWrapper(listener), getDeviceType());
+            IHdmiVendorCommandListener wrappedListener = getListenerWrapper(listener);
+            mService.addVendorCommandListener(wrappedListener, getDeviceType());
+            mIHdmiVendorCommandListener = wrappedListener;
         } catch (RemoteException e) {
-            Log.e(TAG, "failed to add vendor command listener: ", e);
+            Log.e(TAG, "failed to set vendor command listener: ", e);
         }
     }
 
diff --git a/core/java/android/hardware/hdmi/HdmiControlManager.java b/core/java/android/hardware/hdmi/HdmiControlManager.java
index ff2ba1e..308a219 100644
--- a/core/java/android/hardware/hdmi/HdmiControlManager.java
+++ b/core/java/android/hardware/hdmi/HdmiControlManager.java
@@ -21,6 +21,8 @@
 import android.annotation.SdkConstant.SdkConstantType;
 import android.annotation.SystemApi;
 import android.os.RemoteException;
+import android.util.ArrayMap;
+import android.util.Log;
 
 /**
  * The {@link HdmiControlManager} class is used to send HDMI control messages
@@ -36,6 +38,8 @@
  */
 @SystemApi
 public final class HdmiControlManager {
+    private static final String TAG = "HdmiControlManager";
+
     @Nullable private final IHdmiControlService mService;
 
     /**
@@ -56,7 +60,7 @@
 
     /**
      * Message used by TV to receive volume status from Audio Receiver. It should check volume value
-     * that is retrieved from extra value with the key {@link #EXTRA_MESSAGE_EXTRAM_PARAM1}. If the
+     * that is retrieved from extra value with the key {@link #EXTRA_MESSAGE_EXTRA_PARAM1}. If the
      * value is in range of [0,100], it is current volume of Audio Receiver. And there is another
      * value, {@link #AVR_VOLUME_MUTED}, which is used to inform volume mute.
      */
@@ -71,7 +75,7 @@
      * Used as an extra field in the intent {@link #ACTION_OSD_MESSAGE}. Contains the extra value
      * of the message.
      */
-    public static final String EXTRA_MESSAGE_EXTRAM_PARAM1 =
+    public static final String EXTRA_MESSAGE_EXTRA_PARAM1 =
             "android.hardware.hdmi.extra.MESSAGE_EXTRA_PARAM1";
 
     /**
@@ -251,10 +255,9 @@
     private final boolean mHasTvDevice;
 
     /**
-     * @hide - hide this constructor because it has a parameter of type
-     * IHdmiControlService, which is a system private class. The right way
-     * to create an instance of this class is using the factory
-     * Context.getSystemService.
+     * {@hide} - hide this constructor because it has a parameter of type IHdmiControlService,
+     * which is a system private class. The right way to create an instance of this class is
+     * using the factory Context.getSystemService.
      */
     public HdmiControlManager(IHdmiControlService service) {
         mService = service;
@@ -340,6 +343,9 @@
         void onReceived(HdmiHotplugEvent event);
     }
 
+    private final ArrayMap<HotplugEventListener, IHdmiHotplugEventListener>
+            mHotplugEventListeners = new ArrayMap<>();
+
     /**
      * Listener used to get vendor-specific commands.
      */
@@ -384,12 +390,19 @@
      */
     public void addHotplugEventListener(HotplugEventListener listener) {
         if (mService == null) {
+            Log.e(TAG, "HdmiControlService is not available");
             return;
         }
+        if (mHotplugEventListeners.containsKey(listener)) {
+            Log.e(TAG, "listener is already registered");
+            return;
+        }
+        IHdmiHotplugEventListener wrappedListener = getHotplugEventListenerWrapper(listener);
+        mHotplugEventListeners.put(listener, wrappedListener);
         try {
-            mService.addHotplugEventListener(getHotplugEventListenerWrapper(listener));
+            mService.addHotplugEventListener(wrappedListener);
         } catch (RemoteException e) {
-            // Do nothing.
+            Log.e(TAG, "failed to add hotplug event listener: ", e);
         }
     }
 
@@ -400,12 +413,18 @@
      */
     public void removeHotplugEventListener(HotplugEventListener listener) {
         if (mService == null) {
+            Log.e(TAG, "HdmiControlService is not available");
+            return;
+        }
+        IHdmiHotplugEventListener wrappedListener = mHotplugEventListeners.remove(listener);
+        if (wrappedListener == null) {
+            Log.e(TAG, "tried to remove not-registered listener");
             return;
         }
         try {
-            mService.removeHotplugEventListener(getHotplugEventListenerWrapper(listener));
+            mService.removeHotplugEventListener(wrappedListener);
         } catch (RemoteException e) {
-            // Do nothing.
+            Log.e(TAG, "failed to remove hotplug event listener: ", e);
         }
     }
 
diff --git a/core/java/android/hardware/hdmi/HdmiDeviceInfo.java b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
index 7abea36..fe414e6 100644
--- a/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
+++ b/core/java/android/hardware/hdmi/HdmiDeviceInfo.java
@@ -237,14 +237,14 @@
     }
 
     /**
-     * Return the id of the device.
+     * Returns the id of the device.
      */
     public int getId() {
         return mId;
     }
 
     /**
-     * Return the id to be used for CEC device.
+     * Returns the id to be used for CEC device.
      *
      * @param address logical address of CEC device
      * @return id for CEC device
@@ -255,7 +255,7 @@
     }
 
     /**
-     * Return the id to be used for MHL device.
+     * Returns the id to be used for MHL device.
      *
      * @param portId port which the MHL device is connected to
      * @return id for MHL device
@@ -266,7 +266,7 @@
     }
 
     /**
-     * Return the id to be used for hardware port.
+     * Returns the id to be used for hardware port.
      *
      * @param portId port id
      * @return id for hardware port
@@ -276,28 +276,28 @@
     }
 
     /**
-     * Return the CEC logical address of the device.
+     * Returns the CEC logical address of the device.
      */
     public int getLogicalAddress() {
         return mLogicalAddress;
     }
 
     /**
-     * Return the physical address of the device.
+     * Returns the physical address of the device.
      */
     public int getPhysicalAddress() {
         return mPhysicalAddress;
     }
 
     /**
-     * Return the port ID.
+     * Returns the port ID.
      */
     public int getPortId() {
         return mPortId;
     }
 
     /**
-     * Return CEC type of the device. For more details, refer constants between {@link #DEVICE_TV}
+     * Returns CEC type of the device. For more details, refer constants between {@link #DEVICE_TV}
      * and {@link #DEVICE_INACTIVE}.
      */
     public int getDeviceType() {
@@ -305,7 +305,7 @@
     }
 
     /**
-     * Return device's power status. It should be one of the following values.
+     * Returns device's power status. It should be one of the following values.
      * <ul>
      * <li>{@link HdmiControlManager#POWER_STATUS_ON}
      * <li>{@link HdmiControlManager#POWER_STATUS_STANDBY}
@@ -319,21 +319,21 @@
     }
 
     /**
-     * Return MHL device id. Return -1 for non-MHL device.
+     * Returns MHL device id. Return -1 for non-MHL device.
      */
     public int getDeviceId() {
         return mDeviceId;
     }
 
     /**
-     * Return MHL adopter id. Return -1 for non-MHL device.
+     * Returns MHL adopter id. Return -1 for non-MHL device.
      */
     public int getAdopterId() {
         return mAdopterId;
     }
 
     /**
-     * Return {@code true} if the device is of a type that can be an input source.
+     * Returns {@code true} if the device is of a type that can be an input source.
      */
     public boolean isSourceType() {
         return mDeviceType == DEVICE_PLAYBACK
@@ -342,7 +342,7 @@
     }
 
     /**
-     * Return {@code true} if the device represents an HDMI-CEC device. {@code false} if the device
+     * Returns {@code true} if the device represents an HDMI-CEC device. {@code false} if the device
      * is either MHL or other device.
      */
     public boolean isCecDevice() {
@@ -350,7 +350,7 @@
     }
 
     /**
-     * Return {@code true} if the device represents an MHL device. {@code false} if the device is
+     * Returns {@code true} if the device represents an MHL device. {@code false} if the device is
      * either CEC or other device.
      */
     public boolean isMhlDevice() {
@@ -358,14 +358,14 @@
     }
 
     /**
-     * Return display (OSD) name of the device.
+     * Returns display (OSD) name of the device.
      */
     public String getDisplayName() {
         return mDisplayName;
     }
 
     /**
-     * Return vendor id of the device. Vendor id is used to distinguish devices built by other
+     * Returns vendor id of the device. Vendor id is used to distinguish devices built by other
      * manufactures. This is required for vendor-specific command on CEC standard.
      */
     public int getVendorId() {
@@ -373,7 +373,7 @@
     }
 
     /**
-     * Describe the kinds of special objects contained in this Parcelable's marshalled
+     * Describes the kinds of special objects contained in this Parcelable's marshalled
      * representation.
      */
     @Override
@@ -382,7 +382,7 @@
     }
 
     /**
-     * Serialize this object into a {@link Parcel}.
+     * Serializes this object into a {@link Parcel}.
      *
      * @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
diff --git a/core/java/android/hardware/hdmi/HdmiHotplugEvent.java b/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
index 7be4bc5..9476742 100644
--- a/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
+++ b/core/java/android/hardware/hdmi/HdmiHotplugEvent.java
@@ -44,7 +44,7 @@
     }
 
     /**
-     * Return the port number for which the event occurred.
+     * Returns the port number for which the event occurred.
      *
      * @return port number
      */
@@ -53,7 +53,7 @@
     }
 
     /**
-     * Return the connection status associated with this event
+     * Returns the connection status associated with this event
      *
      * @return true if the device gets connected; otherwise false
      */
@@ -62,7 +62,7 @@
     }
 
     /**
-     * Describe the kinds of special objects contained in this Parcelable's
+     * Describes the kinds of special objects contained in this Parcelable's
      * marshalled representation.
      */
     @Override
@@ -71,7 +71,7 @@
     }
 
     /**
-     * Flatten this object in to a Parcel.
+     * Flattens this object in to a Parcel.
      *
      * @param dest The Parcel in which the object should be written.
      * @param flags Additional flags about how the object should be written.
@@ -86,17 +86,19 @@
     public static final Parcelable.Creator<HdmiHotplugEvent> CREATOR
             = new Parcelable.Creator<HdmiHotplugEvent>() {
         /**
-         * Rebuild a {@link HdmiHotplugEvent} previously stored with
+         * Rebuilds a {@link HdmiHotplugEvent} previously stored with
          * {@link Parcelable#writeToParcel(Parcel, int)}.
          *
          * @param p {@link HdmiHotplugEvent} object to read the Rating from
          * @return a new {@link HdmiHotplugEvent} created from the data in the parcel
          */
+        @Override
         public HdmiHotplugEvent createFromParcel(Parcel p) {
             int port = p.readInt();
             boolean connected = p.readByte() == 1;
             return new HdmiHotplugEvent(port, connected);
         }
+        @Override
         public HdmiHotplugEvent[] newArray(int size) {
             return new HdmiHotplugEvent[size];
         }
diff --git a/core/java/android/hardware/hdmi/HdmiPlaybackClient.java b/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
index 85ccb74..263d6b1 100644
--- a/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
+++ b/core/java/android/hardware/hdmi/HdmiPlaybackClient.java
@@ -64,12 +64,12 @@
         public void onComplete(int status);
     }
 
-    HdmiPlaybackClient(IHdmiControlService service) {
+    /* package */ HdmiPlaybackClient(IHdmiControlService service) {
         super(service);
     }
 
     /**
-     * Perform the feature 'one touch play' from playback device to turn on display
+     * Performs the feature 'one touch play' from playback device to turn on display
      * and switch the input.
      *
      * @param callback {@link OneTouchPlayCallback} object to get informed
@@ -90,7 +90,7 @@
     }
 
     /**
-     * Get the status of display device connected through HDMI bus.
+     * Gets the status of display device connected through HDMI bus.
      *
      * @param callback {@link DisplayStatusCallback} object to get informed
      *         of the result
diff --git a/core/java/android/hardware/hdmi/HdmiPortInfo.java b/core/java/android/hardware/hdmi/HdmiPortInfo.java
index 2ec6126..e52baed 100644
--- a/core/java/android/hardware/hdmi/HdmiPortInfo.java
+++ b/core/java/android/hardware/hdmi/HdmiPortInfo.java
@@ -114,7 +114,7 @@
     }
 
     /**
-     * Describe the kinds of special objects contained in this Parcelable's
+     * Describes the kinds of special objects contained in this Parcelable's
      * marshalled representation.
      */
     @Override
@@ -146,7 +146,7 @@
             };
 
     /**
-     * Serialize this object into a {@link Parcel}.
+     * Serializes this object into a {@link Parcel}.
      *
      * @param dest The Parcel in which the object should be written.
      * @param flags Additional flags about how the object should be written.
diff --git a/core/java/android/hardware/hdmi/HdmiRecordListener.java b/core/java/android/hardware/hdmi/HdmiRecordListener.java
index f6a348a..29f6cfc 100644
--- a/core/java/android/hardware/hdmi/HdmiRecordListener.java
+++ b/core/java/android/hardware/hdmi/HdmiRecordListener.java
@@ -25,7 +25,7 @@
  */
 @SystemApi
 public abstract class HdmiRecordListener {
-    protected HdmiRecordListener() {}
+    public HdmiRecordListener() {}
 
     /**
      * Called when TV received one touch record request from record device. The client of this
@@ -34,7 +34,7 @@
      * @param recorderAddress
      * @return record source to be used for recording. Null if no device is available.
      */
-    public abstract RecordSource getOneTouchRecordSource(int recorderAddress);
+    public abstract RecordSource onOneTouchRecordSourceRequested(int recorderAddress);
 
     /**
      * Called when one touch record is started or failed during initialization.
diff --git a/core/java/android/hardware/hdmi/HdmiRecordSources.java b/core/java/android/hardware/hdmi/HdmiRecordSources.java
index c294f72..922b8e7 100644
--- a/core/java/android/hardware/hdmi/HdmiRecordSources.java
+++ b/core/java/android/hardware/hdmi/HdmiRecordSources.java
@@ -59,21 +59,21 @@
      */
     @SystemApi
     public static abstract class RecordSource {
-        protected final int mSourceType;
-        protected final int mExtraDataSize;
+        /* package */ final int mSourceType;
+        /* package */ final int mExtraDataSize;
 
-        protected RecordSource(int sourceType, int extraDataSize) {
+        /* package */ RecordSource(int sourceType, int extraDataSize) {
             mSourceType = sourceType;
             mExtraDataSize = extraDataSize;
         }
 
-        abstract int extraParamToByteArray(byte[] data, int index);
+        /* package */ abstract int extraParamToByteArray(byte[] data, int index);
 
-        final int getDataSize(boolean includeType)  {
+        /* package */ final int getDataSize(boolean includeType)  {
             return includeType ? mExtraDataSize + 1 : mExtraDataSize;
         }
 
-        final int toByteArray(boolean includeType, byte[] data, int index) {
+        /* package */ final int toByteArray(boolean includeType, byte[] data, int index) {
             if (includeType) {
                 // 1 to 8 bytes (depends on source).
                 // {[Record Source Type]} |
@@ -94,7 +94,7 @@
     // ---- Own source -----------------------------------------------------------------------------
     // ---------------------------------------------------------------------------------------------
     /**
-     * Create {@link OwnSource} of own source.
+     * Creates {@link OwnSource} of own source.
      */
     public static OwnSource ofOwnSource() {
         return new OwnSource();
@@ -311,7 +311,7 @@
      */
     public static final class DigitalChannelData implements DigitalServiceIdentification {
         /** Identifies the logical or virtual channel number of a service. */
-        private ChannelIdentifier mChannelIdentifier;
+        private final ChannelIdentifier mChannelIdentifier;
 
         public static DigitalChannelData ofTwoNumbers(int majorNumber, int minorNumber) {
             return new DigitalChannelData(
@@ -338,7 +338,7 @@
     }
 
     /**
-     * Create {@link DigitalServiceSource} with channel type.
+     * Creates {@link DigitalServiceSource} with channel type.
      *
      * @param broadcastSystem digital broadcast system. It should be one of
      *            <ul>
@@ -389,7 +389,7 @@
     }
 
     /**
-     * Create {@link DigitalServiceSource} of ARIB type.
+     * Creates {@link DigitalServiceSource} of ARIB type.
      *
      * @param aribType ARIB type. It should be one of
      *            <ul>
@@ -420,7 +420,7 @@
     }
 
     /**
-     * Create {@link DigitalServiceSource} of ATSC type.
+     * Creates {@link DigitalServiceSource} of ATSC type.
      *
      * @param atscType ATSC type. It should be one of
      *            <ul>
@@ -451,7 +451,7 @@
     }
 
     /**
-     * Create {@link DigitalServiceSource} of ATSC type.
+     * Creates {@link DigitalServiceSource} of ATSC type.
      *
      * @param dvbType DVB type. It should be one of
      *            <ul>
@@ -572,7 +572,7 @@
     public static final int BROADCAST_SYSTEM_PAL_OTHER_SYSTEM = 31;
 
     /**
-     * Create {@link AnalogueServiceSource} of analogue service.
+     * Creates {@link AnalogueServiceSource} of analogue service.
      *
      * @param broadcastType
      * @param frequency
@@ -615,7 +615,7 @@
      */
     @SystemApi
     public static final class AnalogueServiceSource extends RecordSource {
-        static final int EXTRA_DATA_SIZE = 4;
+        /* package */ static final int EXTRA_DATA_SIZE = 4;
 
         /** Indicates the Analogue broadcast type. */
         private final int mBroadcastType;
@@ -635,7 +635,7 @@
         }
 
         @Override
-        protected int extraParamToByteArray(byte[] data, int index) {
+        /* package */ int extraParamToByteArray(byte[] data, int index) {
             // [Analogue Broadcast Type] - 1 byte
             data[index] = (byte) mBroadcastType;
             // [Analogue Frequency] - 2 bytes
@@ -651,7 +651,7 @@
     // ---- External plug data ---------------------------------------------------------------------
     // ---------------------------------------------------------------------------------------------
     /**
-     * Create {@link ExternalPlugData} of external plug type.
+     * Creates {@link ExternalPlugData} of external plug type.
      *
      * @param plugNumber plug number. It should be in range of [1, 255]
      * @hide
@@ -695,7 +695,7 @@
     // ---- External physical address --------------------------------------------------------------
     // ---------------------------------------------------------------------------------------------
     /**
-     * Create {@link ExternalPhysicalAddress} of external physical address.
+     * Creates {@link ExternalPhysicalAddress} of external physical address.
      *
      * @param physicalAddress
      * @hide
@@ -754,7 +754,7 @@
     }
 
     /**
-     * Check the byte array of record source.
+     * Checks the byte array of record source.
      * @hide
      */
     @SystemApi
diff --git a/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java b/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java
index 1780707..bf97375 100644
--- a/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java
+++ b/core/java/android/hardware/hdmi/HdmiTimerRecordSources.java
@@ -67,7 +67,7 @@
     private HdmiTimerRecordSources() {}
 
     /**
-     * Create {@link TimerRecordSource} for digital source which is used for &lt;Set Digital
+     * Creates {@link TimerRecordSource} for digital source which is used for &lt;Set Digital
      * Timer&gt;.
      *
      * @param timerInfo timer info used for timer recording
@@ -82,7 +82,7 @@
     }
 
     /**
-     * Create {@link TimerRecordSource} for analogue source which is used for &lt;Set Analogue
+     * Creates {@link TimerRecordSource} for analogue source which is used for &lt;Set Analogue
      * Timer&gt;.
      *
      * @param timerInfo timer info used for timer recording
@@ -97,7 +97,7 @@
     }
 
     /**
-     * Create {@link TimerRecordSource} for external plug which is used for &lt;Set External
+     * Creates {@link TimerRecordSource} for external plug which is used for &lt;Set External
      * Timer&gt;.
      *
      * @param timerInfo timer info used for timer recording
@@ -112,7 +112,7 @@
     }
 
     /**
-     * Create {@link TimerRecordSource} for external physical address which is used for &lt;Set
+     * Creates {@link TimerRecordSource} for external physical address which is used for &lt;Set
      * External Timer&gt;.
      *
      * @param timerInfo timer info used for timer recording
@@ -140,7 +140,7 @@
     }
 
     /**
-     * Create {@link Duration} for time value.
+     * Creates {@link Duration} for time value.
      *
      * @param hour hour in range of [0, 23]
      * @param minute minute in range of [0, 60]
@@ -162,7 +162,7 @@
     }
 
     /**
-     * Create {@link Duration} for duration value.
+     * Creates {@link Duration} for duration value.
      *
      * @param hour hour in range of [0, 99]
      * @param minute minute in range of [0, 59]
@@ -184,21 +184,21 @@
     }
 
     private static class TimeUnit {
-        protected final int mHour;
-        protected final int mMinute;
+        /* package */ final int mHour;
+        /* package */ final int mMinute;
 
-        protected TimeUnit(int hour, int minute) {
+        /* package */ TimeUnit(int hour, int minute) {
             mHour = hour;
             mMinute = minute;
         }
 
-        protected int toByteArray(byte[] data, int index) {
+        /* package */ int toByteArray(byte[] data, int index) {
             data[index] = toBcdByte(mHour);
             data[index + 1] = toBcdByte(mMinute);
             return 2;
         }
 
-        protected static byte toBcdByte(int value) {
+        /* package */ static byte toBcdByte(int value) {
             int digitOfTen = (value / 10) % 10;
             int digitOfOne = value % 10;
             return (byte) ((digitOfTen << 4) | digitOfOne);
@@ -247,7 +247,7 @@
             RECORDING_SEQUENCE_REPEAT_SATUREDAY);
 
     /**
-     * Create {@link TimerInfo} with the given information.
+     * Creates {@link TimerInfo} with the given information.
      *
      * @param dayOfMonth day of month
      * @param monthOfYear month of year
@@ -426,7 +426,7 @@
     }
 
     /**
-     * Check the byte array of timer record source.
+     * Checks the byte array of timer record source.
      * @param sourcetype
      * @param recordSource
      * @hide
diff --git a/core/java/android/hardware/hdmi/HdmiTvClient.java b/core/java/android/hardware/hdmi/HdmiTvClient.java
index 683d04b..dbfb4ef 100644
--- a/core/java/android/hardware/hdmi/HdmiTvClient.java
+++ b/core/java/android/hardware/hdmi/HdmiTvClient.java
@@ -22,11 +22,11 @@
 import android.os.RemoteException;
 import android.util.Log;
 
+import libcore.util.EmptyArray;
+
 import java.util.Collections;
 import java.util.List;
 
-import libcore.util.EmptyArray;
-
 /**
  * HdmiTvClient represents HDMI-CEC logical device of type TV in the Android system
  * which acts as TV/Display. It provides with methods that manage, interact with other
@@ -43,13 +43,13 @@
      */
     public static final int VENDOR_DATA_SIZE = 16;
 
-    HdmiTvClient(IHdmiControlService service) {
+    /* package */ HdmiTvClient(IHdmiControlService service) {
         super(service);
     }
 
     // Factory method for HdmiTvClient.
     // Declared package-private. Accessed by HdmiControlManager only.
-    static HdmiTvClient create(IHdmiControlService service) {
+    /* package */ static HdmiTvClient create(IHdmiControlService service) {
         return new HdmiTvClient(service);
     }
 
@@ -71,7 +71,7 @@
     }
 
     /**
-     * Select a CEC logical device to be a new active source.
+     * Selects a CEC logical device to be a new active source.
      *
      * @param logicalAddress logical address of the device to select
      * @param callback callback to get the result with
@@ -98,7 +98,7 @@
     }
 
     /**
-     * Select a HDMI port to be a new route path.
+     * Selects a HDMI port to be a new route path.
      *
      * @param portId HDMI port to select
      * @param callback callback to get the result with
@@ -128,7 +128,7 @@
     }
 
     /**
-     * Set the listener used to get informed of the input change event.
+     * Sets the listener used to get informed of the input change event.
      *
      * @param listener listener object
      */
@@ -168,7 +168,7 @@
     }
 
     /**
-     * Set system audio volume
+     * Sets system audio volume
      *
      * @param oldIndex current volume index
      * @param newIndex volume index to be set
@@ -183,7 +183,7 @@
     }
 
     /**
-     * Set system audio mute status
+     * Sets system audio mute status
      *
      * @param mute {@code true} if muted; otherwise, {@code false}
      */
@@ -196,7 +196,7 @@
     }
 
     /**
-     * Set record listener
+     * Sets record listener
      *
      * @param listener
      */
@@ -216,7 +216,7 @@
             @Override
             public byte[] getOneTouchRecordSource(int recorderAddress) {
                 HdmiRecordSources.RecordSource source =
-                        callback.getOneTouchRecordSource(recorderAddress);
+                        callback.onOneTouchRecordSourceRequested(recorderAddress);
                 if (source == null) {
                     return EmptyArray.BYTE;
                 }
@@ -244,13 +244,13 @@
     }
 
     /**
-     * Start one touch recording with the given recorder address and recorder source.
+     * Starts one touch recording with the given recorder address and recorder source.
      * <p>
      * Usage
      * <pre>
      * HdmiTvClient tvClient = ....;
      * // for own source.
-     * OwnSource ownSource = ownHdmiRecordSources.ownSource();
+     * OwnSource ownSource = HdmiRecordSources.ofOwnSource();
      * tvClient.startOneTouchRecord(recorderAddress, ownSource);
      * </pre>
      */
@@ -269,7 +269,7 @@
     }
 
     /**
-     * Stop one touch record.
+     * Stops one touch record.
      *
      * @param recorderAddress recorder address where recoding will be stopped
      */
@@ -282,7 +282,7 @@
     }
 
     /**
-     * Start timer recording with the given recoder address and recorder source.
+     * Starts timer recording with the given recoder address and recorder source.
      * <p>
      * Usage
      * <pre>
@@ -331,7 +331,7 @@
     }
 
     /**
-     * Clear timer recording with the given recorder address and recording source.
+     * Clears timer recording with the given recorder address and recording source.
      * For more details, please refer {@link #startTimerRecording(int, int, TimerRecordSource)}.
      */
     public void clearTimerRecording(int recorderAddress, int sourceType, TimerRecordSource source) {
@@ -357,7 +357,7 @@
     }
 
     /**
-     * Set {@link HdmiMhlVendorCommandListener} to get incoming MHL vendor command.
+     * Sets {@link HdmiMhlVendorCommandListener} to get incoming MHL vendor command.
      *
      * @param listener to receive incoming MHL vendor command
      */
@@ -383,7 +383,7 @@
     }
 
     /**
-     * Send MHL vendor command to the device connected to a port of the given portId.
+     * Sends MHL vendor command to the device connected to a port of the given portId.
      *
      * @param portId id of port to send MHL vendor command
      * @param offset offset in the in given data
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 953bef2..e741fc4 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -2087,7 +2087,7 @@
         assertRunOnServiceThread();
         Intent intent = new Intent(HdmiControlManager.ACTION_OSD_MESSAGE);
         intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_ID, messageId);
-        intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_EXTRAM_PARAM1, extra);
+        intent.putExtra(HdmiControlManager.EXTRA_MESSAGE_EXTRA_PARAM1, extra);
         getContext().sendBroadcastAsUser(intent, UserHandle.ALL,
                 HdmiControlService.PERMISSION);
     }