History log of /frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
fc462b962cde0a96193fc780d6466cf8b0774112 13-May-2016 Donghyun Cho <donghyun@google.com> CEC: Defer CEC actions until logical address is available

If logical address of device is not set, CEC actions will not work
correctly because outgoing CEC message's source address will be
wrong. In this case, CEC actions should be deferred until address
allocation finishes.

Bug: 28709242
Change-Id: I09e199c6144a5b341e3a6113022d0243fcfc3cf5
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
fbbeb3e54a73e0fa7dbd5c2c1093705e69ae27da 15-Apr-2016 Donghyun Cho <donghyun@google.com> CEC: Remove listener records only if they are currently used

HdmiControlService manages listeners in listener record instances, and
remove them when binders become disconnected. However, if the listener
and its record are replaced due to new listener, the record for the new
listener should not be set as null by previous binder's disconnection
signal.

Bug: 28069465
Change-Id: I2984d8f93d6443048cf5d3f2988b3c6cf362f012
(cherry picked from commit f5c2a1f58dc95b9800ffb6ebf405c11acc6626b2)
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3059556f6092af0e292d4b3cff97ec772d2d6bd1 11-Mar-2016 Rob McConnell <Robert.McConnell@broadcom.com> HdmiControlService does not broadcast CEC <standby> message on shutdown

When the STB is shutting down the CEC <standby> message should be
broadcast to all CEC devices to place them in to standby. This is
not happening because the ACTION_SHUTDOWN Intent has not been
added to the list of Intent filters that the HdmiControlService
should be listening for.

This one-line change adds the ACTION_SHUTDOWN Intent filter so that
when the STB is shutting down (e.g. via a long press of the POWER
button), the CEC <standby> message can be broadcast to all devices.
This allows a connected HDMI TV to be automatically placed in to
standby.

Bug: 27596547
Change-Id: I4cdd2eaaad86e98bdf86c74fb0c377eb716f3c83
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
dd371ec1a84f06a644e8c6f5179fd8bd5f11121b 10-Dec-2015 Terry Heo <terryheo@google.com> CEC: Prevent NPE on HDMI_CONTROL_AUTO_DEVICE_OFF_ENABLED change

Bug: 25954258
Change-Id: I68a9cf537f2fb7cedb0194562a155b00d83044cb
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
f98b9e87f9258d4ffb53859de2a138e72174cc23 05-Oct-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Process missing port/device select request

The timing issue cause some port/device select request
to return error if made while the service is being initialized
waking up from sleep.

This CL buffers the request so that it can be handled as
expected once the service initialization and device discovery
is completed.

Bug: 23084229
Change-Id: I8bcdaf3b708c6b9bf75ea15304c08bd35bd0f6d0
(cherry picked from commit d0b01dfe0aaebd054165dfe2f5f4bd7d68703970)
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
280a64e793d081847c5dcea23ed9be38aa5332d2 13-Jul-2015 Dianne Hackborn <hackbod@google.com> Improve tracking of screen on reasons.

- New screen on app op to record the last time each app has
caused the screen to be turned on.
- New battery stats event that tells us the reason the screen
has been asked to turn on.
- Propagate out power manager API to specify the reason a caller
is asking to have the screen turned on.

Note that currently the window flag to turn the screen on bypasses
much of this because it is being handled in the window manager by
just directly telling the power manager to turn the screen on. To
make this better we need a new API where it can specify who it is
calling the API for.

Change-Id: I667e56cb1f80508d054da004db667efbcc22e971
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
f2fb0e73f1e7a056c8986959b391ad29eabbf8f9 15-May-2015 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Remove obsolete TODOs" into mnc-dev
4d5648b9c510ae028119b9db37d70139f9558be4 14-May-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Remove obsolete TODOs

Removed legacy TODOs and the associated hack to enable CEC service
for buggy partner low-level implementation.

Bug: 21153475
Change-Id: I105f77389dd5c604336f86ce375016fa87c86759
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e6e8f3d589f42393cf02a2bd766d678d80dad874 11-May-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Let playback device send <Standby> upon power off

Let playback device send a command <Standby> based on the setting.
ACTION_SHUTDOWN leads to broadcast command to put all the devices
to sleep, and ACTION_SCREEN_OFF optionally turns off TV only.

Change-Id: Id458b23ce86b0c3179efa21cce85b721a47001be
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7b0cf6413218e5b5c549eea31733222fcffafabc 14-Apr-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Remove system audio on hotplug

System audio was not being immediately removed by polling mechanism
mechanism but was being checked three times in order to avoid accidental
polling failure. This came with a side effect of the system audio
not removed instantly even when the device is physically removed.

This CL relies on hotplug event to tell whether the device removal
should be done right away or has to wait for 3 polling intervals.

Bug: 20133405
Change-Id: I9dbd7a8b9e424d523d0c22e4cac19b341461b71e
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7640d9895cf8fae7a99a7db5bba0079ba6022621 28-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Fix a regression bug

The HdmiControlService.getActiveSource() has a regression (exception)
when calling getDeviceInfoByPath since method should be called on
a service thread. Introduced a method that can be invoked safely
from the main thread.

Bug: 19170884
Change-Id: I393161e08c916270faf46147a97076bc573b808f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
cb8661c08f4a7b00eaa2ede06a30c32dd3cbc53b 18-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Add logic to return to internal source

This CL introduces a logic that, upon receiving <Inactive Source>
from the active source or a corresponding MHL subcommand, lets
the service return to one of internal inputs.

Introduced to handle it is a new type for HdmiDevice (INACTIVE)
that will be passed to input change listeners. The callback
is expected to transform to other mechanism such as intent,
to let TV app to decide which input to switch to, which will
be one of non-HDMI input that was viewed previously.

Bug: 19008579

Change-Id: I1922f4cd20e9220411061bb9d9fbe5fbc5676d48
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5b8cb00b8a302329b98a5528eaa7934d0f5c3e65 18-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Process new options for CEC/MHL HAL

1) Inform MHL HAL of OPTION_MHL_SERVICE_CONTROL at system
ready/standby event.

2) Call OPTION_CEC_SET_LANGUAGE with current system language info
for HAL to be able to respond to <Get Menu Language> while in standby
mode.

Bug: 19054079
Change-Id: I92c9f392a94f70e11157d20a33163ef2d8bc832f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
d47abefc8269dae7fdfa2bb102bcb89cbea7c7b0 16-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Make TV try to allocate logical address 0 first

HDMI Spec says TV shall try to allocate TV() logical address, unlike
other kinds of devices that are recommended to use the previously
allocated one.

Also included are small changes:

- reply with 'can not provide source' if TV has no source to provide
- return the present device info if we have one at the given path

Bug: 19045081
Change-Id: Icf17cb581f0ef2274e252ec5665f80bb1c08b494
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
964c00dd7b270dcf80aea3450bbfc23502965cce 16-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Buffer Cec messages while allocating logical address

CEC messages arriving before logical address allocation was being
discarded. Handles them by introducing a message buffer class
to keep them till the address allocation is finished.

Also updated per-device message buffer to use copied version of
messages list for iterating to avoid the possible concurrent
modification exception.

Bug: 18896770
Change-Id: Ifb74fd265510de6dde322e0b3bc5b504fecb4daa
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
61c94d1a03971b07c4ac28af678f3fff6b695c32 14-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Support sendStandby() for MHL device

Changed so that the API sendStandby() transform the request to
a MHL subcommand if the call is done against a MHL device.

Also hooked up the dump() to print out information on MHL.

Bug: 18451257
Change-Id: I1927855e0e4c45a731f0fd97ba572bfc2a894557
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e26d833c4a00bc7c1c23083f28ef891703e7e385 09-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Keep Playback device awake while it is the active source

Alleviates the user experience issue of having to turn on the device
manually when it goes to standby mode while the device occupies
the display.

Bug: 18882764
Change-Id: I10b239a599a310e47e3c2cb98737e4b0fdb4e435
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
6ad7cbde22fe9752082ce01c9b9be213b07afefc 06-Jan-2015 Jinsuk Kim <jinsukkim@google.com> CEC: Make deviceSelect work for MHL device

MHL device works on hotplug but not when API deviceSelect is invoked
to select it due to a bug not finding the right MHL device instance.
This CL rectifies it by searching for not only CEC but MHL devices
attached to TV.

Bug: 18909552
Change-Id: I4df1ead836090eb3a7476b7738be47a6970edb7d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
1481a4282818939436f590d8c88aea2d19166b8e 17-Dec-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Pass port ID for set_audio_return_channel

This CL passes a port ID when enabling/disabling ARC in case
there are multiple HDMI ports that support the feature.

Bug: 18781204

Change-Id: I632518132bf07c8ae6f0ff5135429ca719b596b2
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
4da553880930355cfbec1978657c9037f21a6edf 06-Dec-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Avoid setting op in disabled mode" into lmp-mr1-dev
de7a4248d8631099544e4cf43c02b10131cf6672 04-Dec-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Avoid setting op in disabled mode

In disabled HDMI control mode, TV local device is gone, for which
setting operation is not possible. Does the check against the tv instance
when TV setting update is notified. The settings is picked up when
the control is enabled back, so notification is not lost.

Bug: 18580387
Change-Id: Id8891bfa54d851ec1aff280fc99be8e428f4e0cf
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3cd30516ad16150dee55ad8f704a0c3bf20b58b2 04-Dec-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Generate hotplug events upon adding listener

CEC HAL does not report initial connection state of the HDMI port
but does it only when the state is updated. For the listeners which
want to get the initial state of the ports, this CL generates
hotplug event per each port when a new listener is added.

Bug: 18488079

Change-Id: I6915a96e3c14ee0db1bfb6912ab77d3ea1bd2f07
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
f17024873b10dabed069e502030dd85d6257c0c4 27-Nov-2014 Yuncheol Heo <ycheo@google.com> CEC: make it sure to send vendor commands when changing a setting.

- Remove 'oneway' from IHdmiVendorCommandListener.
- Add flush() method to HdmiCecController.
- Use IoThread for HdmiCecController.

Bug: 18495592
Change-Id: I497f7b49e94dd4402058ecc89cb5b7a3d58bf1e1
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7fa3a66470d2133796defd14a0600578758882ac 07-Nov-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Buffer messages coming from unknown device

Introduced a buffer for messages to be kept for later processing
when they arrive before the service is ready to handle them.
<Active Source>/<Initiate ARC> are handled in this CL to address
the reported bug.

Bug: 18277839

Change-Id: I1e73dd83dc9dd4a822fbcf4fda4c6221f09631cb
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a95f1a9b89ba321f39fd9926388d157f831db9b2 06-Nov-2014 Yuncheol Heo <ycheo@google.com> CEC: Don't send <Feature Abort> on the short message

Bug: 18261915
Change-Id: I722392afacc29ec9f2af27df49b68bd773b53e3d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
326aef0c9402742e29c4503c857f93e75cf9a6ec 04-Nov-2014 Jungshik Jang <jayjang@google.com> Add recorder address to all recording listerner apis.

It enables to recognize which recorder reports record status.

Bug: 18248734
Change-Id: I248ad77212ce584dc16863cbe00639e7ac3c184a
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5fe3a6cbfc50a8faf9cf051f1f09a7eb1ef6b7ee 28-Oct-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Use language code "chi" for Traditional Chinese

Android by default returns "zho" for all sorts of Chinese variants.
Use "chi" for traditional one used in Taiwan/Hong Kong/Macau
as required in CEC standard.

Bug: 18149804

Change-Id: I86ac7e2f0f1121641c52032a0d98a6405554457c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
2b0da5c4c84305f1d391dc78b85e244c9fd92456 22-Oct-2014 Yuncheol Heo <ycheo@google.com> CEC: Fix apilint errors.

- Change 'protected' to 'package private'.
- Change '@hide' to '{@hide}' for methods which should be still hidden
for linting.
- Rename addVendorCommandListener to setVendorCommandListener and make sure to be called once.
- Fix the implementation of removeHotplugEventListener().

Bug: 18063669
Change-Id: I5c032736f17bab9518f21596f7adeac2f88ba4c1
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
17e9d2468fea360ab17679161f31cf6a38198fc7 21-Oct-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Add missing protections for some HdmiControlService API" into lmp-mr1-dev
b22d9ee0a364b10d488dd6a2e8ba69d5ca7f6258 21-Oct-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Add missing protections for some HdmiControlService API

A few methods are found to be missing protection with system permission.
Add enforceAccessPermission() like other methods.

Bug: 17408780

Change-Id: I58a336b5cc9df2d195bdfe7b928898dde5ff169f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
0608b9328b1c2f804ffb2d4165c34383d34bde2a 13-Oct-2014 Yuncheol Heo <ycheo@google.com> CEC: Add a callback for vendor when HDMI control setting is changed.

- removed unregisterContentObserver() to reactivate the service later.
- added the parameter destAddress to onReceived() callback to
distinguish whether the message is broadcast or not.

Bug: 17962624
Change-Id: I552d14661583f63bb66b07866092f972b259b15a
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
bdf27fbf746bee11430c4db2ea6dfd026bae77fe 20-Oct-2014 Jinsuk Kim <jinsukkim@google.com> CEC: add getDeviceList()

Returns the list of all the connected CEC device information. This is
different from getInputDevices() which returns devices of source type only.

For this, turned the local device address list to unmodifiable so that it can
be used by any threads.

Now respects the device type info passed through <Report Physical Address>
rather than always defaulting to the one from HdmiUtil.getTypeFromAddress().
This ensures future compatibility when a device of reserved logical address
comes with a specific type.

Bug: 18046603
Change-Id: I5f7d5e31706efba1ad5dcf4bcfd4ffc918d1d940
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
93eed0c03a1f9cd66946760045122516483ba3f0 14-Oct-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Use hotplug event for MHL device registry

Substitute hotplug on event for registering MHL device as TV input.
Initializes a corresponding MHL DeviceInfo as well as MHL local device
instance.

Bug: 17349017

Change-Id: I7e55afda9390aa5fa8b7687cfa6fac132f342fe6
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e46fdb43c0193cb89716600a3aa17b836502e098 13-Oct-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Queue actions for starting later when not ready" into lmp-mr1-dev
6f87b4e6b6db76cb32d449ad1fdf1946ff4e96f7 10-Oct-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Queue actions for starting later when not ready

Requests coming in while the service is still being brought up
were discarded. Changed to queue them so that they can be started
after the initialization is completed.

Bug: 17933899
Change-Id: Ic9d9cd2094b830c80dec54dd5ef6a18159a74dc7
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
08f1ab02d6de42756825a2dfa7027137ff959bd8 13-Oct-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Do not publish the service if native/HAL is not ready

This helps detect the issue sooner by checking the availability
of the service and avoid crashing at a later point.

Bug: 17897529
Change-Id: Iab0eeffb00221e5a7e6e36d446eeef7c92da1f82
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
b8d62e70bf2612e9c75bf7d8b2370f80e5877f95 22-Sep-2014 Yuncheol Heo <ycheo@google.com> Fix the hotplug behaviors in TV.

- Don't run the local address allocation in the case of TV and the removed event.
- Let isTvDevice() return the value based on mLocalDevices, since tv() is
unstable during the intialization period.

Bug: 17601460
Change-Id: Ic5701f1f86f51171960033bd97e169270a0021bf
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
1a6be6ed3962735f12dbd5ce1bca758120c8fb8d 16-Sep-2014 Jungshik Jang <jayjang@google.com> Adjust volume bar visibility in HDMI-CEC system audio mode

When HDMI-CEC system audio mode is activated.
1. Hide volume bar when volume button is pressed in TV
2. Show volume bar when TV receives volume notification from
Audio Receiver.

Otherwise, (system audio mode off) follows normal TV's behavior.

Bug: 17347499

Change-Id: I1f5bc14285d60d8626a8fbbef9e1959cae7d193b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
89ec14e48f4a1bdf291cda9fba7b8172f55a2447 16-Sep-2014 Yuncheol Heo <ycheo@google.com> Make the playback device pass CEC CTS.

- Clear the logical address on the hotplug event.
- Don't reset mIsActiveSource flag on the hotplug event.

Bug: 17517438
Change-Id: Id129a9cce30323090ce21bbfc188b955bd32755b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3b9309a01c9aa0544f97b2ec6abe7b254d829336 12-Sep-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Stub MHL Device

Replaced HdmiMhlLocalDevice with stub implementation,
and removed other MHL classes.

Bug: 17479050

Change-Id: I08880b0703eb4a94ae5e8aa973886a15f8160a38
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a94417a51646a2560e44974c99435cb00bd96201 12-Sep-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Refactoring for MHL

This helps MHL code clean-up.

- Factored MHL constants out to a new class
- Renamed some methods

Bug: 17479050
Change-Id: Ia39f8bb51ce552ac10f587e6ee0431951f2f494b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
d4a94db1cd44a536d535de890a0a14919a39a0dc 12-Sep-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Bug fixes for vendor-specific command handling

- Add sendStandby()
- Respond with <Feature Abort>[INCORRECT_MODE] when the listener
is not ready

Bug: 17379243
Bug: 17358887
Change-Id: I26a4157a70f11206978763fbbe69e4190e3e1d5c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
29b3e79dc3b98cc5239d6b0f267f3fd0615f4997 12-Sep-2014 Yuncheol Heo <ycheo@google.com> Merge "Respond <Feature Abort: Invaild operand> for the invaild messages." into lmp-dev
4c212897813d6c23b2e7ffba4a4c01e13a41b1fa 12-Sep-2014 Yuncheol Heo <ycheo@google.com> Respond <Feature Abort: Invaild operand> for the invaild messages.

- Previously it responsed <Feature Abort: Unrecognized opcode>, for the
invaild messages, but 'Invaild operand' is more accurate response.
- It'll not response <Feature Abort> for the invaild source and the destination.

Bug: 17382769
Change-Id: I4c5a146a57cc64f54224fa86810a777c232f4c9b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
b3fbf9dbe8d41d91efbac2118b676af74592257b 12-Sep-2014 Jinsuk Kim <jinsukkim@google.com> Replace the MHL register name 'scratchpad' with 'vendor'

Bug: 17479050
Change-Id: If6fe2949d17ad2d407df5b797c1915eb0e9bf421
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
109526fe4f01a2b7ac90106cf41966b2d872d03a 10-Sep-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Stub MHL Controller" into lmp-dev
781041239f2931ca16c902fb371cd041b057c918 26-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Stub MHL Controller

Replace MHL Controller with a stub impl

Bug: 17259897

Change-Id: Id57bac363441f72b3da3f30d31c68c6d3b502237
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
2e8f1b6399089626b4f0249427626ba6e63a62ef 03-Sep-2014 Jungshik Jang <jayjang@google.com> CEC: Revamp volume control action.

Here is a list of changes
1. Change volume control into event base not level base
2. Hide volume ui if volume change is triggered by CEC
3. Report volume change triggered by CEC in OSD message
4. Revamp HdmiLogger so that normal class uses static method only.
5. Apply format message to HdmiLogger's helper methods.

Bug: 17367215

Change-Id: I9f3cd41f7c66f76919059b463df956ed5176b054
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
aa6a67a3e1d1095ee5b25c91cb2dd524775c0e89 04-Sep-2014 Yuncheol Heo <ycheo@google.com> Merge "Invoke the callback only when DeviceInfo is available." into lmp-dev
7c5d31ea93d6f6770c34f7a2a364522d8cc4b5d8 03-Sep-2014 Yuncheol Heo <ycheo@google.com> Invoke the callback only when DeviceInfo is available.

- There is possibility that DeviceInfo can be null when unplugging MHL cable,
if the capability register event is missed. and we should not invoke
the callback in this case.
- In addition, we'd better use the portId of HdmiMhlLocalDevice directly,
not one of DeviceInfo.

Bug: 17366541
Change-Id: I40d71e27d82c5f3a4c7aabda32119856c0bde83d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
b502186ab34a4de40f1d98591a0c5d8b4eac76e2 02-Sep-2014 Yuncheol Heo <ycheo@google.com> Reallocate the logical address on the hotplug event.

Bug: 17337451
Change-Id: I4117638e96c64eabd64edfef3359a0f12cf110f6
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
959d2db12c7c6a06465af1251bc4cece580a72a3 28-Aug-2014 Terry Heo <terryheo@google.com> CEC: Implement dump() of HdmiControlService

In addition, use hexadecimal address representation in HdmiPortInfo.toString()

Bug: 17310007
Change-Id: Iaba8f718f86a18a23b50f983053c7589dcdcfaf8
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
af410a5145d7c06b0c27f6e749541118694a54ab 28-Aug-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: return non-null MHL controller when not ready" into lmp-dev
f286b4d86b4b2ac91edb88d0336810e46d9a16ce 26-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: return non-null MHL controller when not ready

Refactored the service and MHL controller so that non-null instance
is returned even when MHL is not ready.

Bug: 17234291

Change-Id: Id86444a20f64c2d3c470133487938c9524693474
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
339227da7cf025ce4ae0c85ddc52643d63972321 25-Aug-2014 Jungshik Jang <jayjang@google.com> Fix several bugs in HdmiControlService.

1. Fix HdmniLogger null pointer exception
2. Should check arc enabled port for arc requests
3. Disallow ARC action coming from indirect AVR device.
4. Check original opcode of feature action
5. Add bitmasking to all parameters of cec message.

Bug: 17243701, Bug: 17238394, Bug: 17241401
Change-Id: Iff0da78b0de9a29fb00e683c261528e0baea66af
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
f67113f7abd536cc3eb888344bf925762aa5278e 22-Aug-2014 Jungshik Jang <jayjang@google.com> Use common language code in hdmi service.

Bug: 15844859
Change-Id: I12945f743730ee234b25a40543ea44345abf43fa
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
dbe6b45545dcd28e6aaf46986ed694196eb94de0 22-Aug-2014 Jungshik Jang <jayjang@google.com> Add spam-safe logger.

This change introduces a new helper class, HdmiLogger,
which prevents spammy log for same error message.

Bug: 17179667
Change-Id: Ia55808408e0a92b0370cd627361f80754b2f1018
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
f424932cfb1b16b01a37500d09e295912700a51d 21-Aug-2014 Jungshik Jang <jayjang@google.com> Implement interfaces for MHL scratchpad command

1. Add sendScratchpadCommand to IHdmiControlService interface,
which is used to send scratchpad command.

2. Add IHdmiMhlScratchpadCommandListener to handle incoming
MHL scratchpad command.

Bug: 17146522

Change-Id: I8e8e743dc08a18c80867be470997ce79d3292c15
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e9f6ed3b11fb8ebae5e73db1e4736b86cae272d9 20-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Invoke input change for RAP request from MHL device

Transform RAP[ContentOn/Off] to input change event.

Bug: 17141884
Change-Id: Ic2d8e305f482ebb4f4f3b3e167f726a66dc174cf
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5e85359a36c14c0c568b73f138f6c8f4baad9b8e 20-Aug-2014 Terry Heo <terryheo@google.com> Merge "CEC: Broadcast language setting whenever it changes" into lmp-dev
1ca0a43251a31bb1b4253dc404316cc4b840f497 18-Aug-2014 Terry Heo <terryheo@google.com> CEC: Broadcast language setting whenever it changes

Bug: 16995278
Change-Id: Id695d4d2f213cd8039c9915f3d4e451e829e715c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
9727b332973d2aae6cb31b7d02e469bdcb3e3082 20-Aug-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Hook up device select API to MHL device RAP" into lmp-dev
87f22a2870ac363a5849a7252c1bd44ce2b809c2 20-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Hook up device select API to MHL device RAP

This lets the input selection on UI perform MHL RAP signalling, and
CEC routing control.

Bug: 17141884
Change-Id: Ic1605175c5779a9a3c43df954baf9fdb6f154d36
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5ba6906768f2bdc22fea45f064dcb5ef96cd78e0 20-Aug-2014 Jungshik Jang <jayjang@google.com> Merge "Clean up MHL local devices when HdmiControlService turns into disabled state" into lmp-dev
2738e2d872a22fe95a99941139863ff642fbd8e7 19-Aug-2014 Jungshik Jang <jayjang@google.com> Implement missing mhl apis

1. get_supported_features
2. get_ecbug_device_rols
3. set_option in native.
4. get_mhl_version
5. get_peer_mhl_version
6. send_scratchpad_command
- it includes send_scratchpad_command but does not include
java side implementation. It will be added when we implement
scratchpad.

Bug: 17096490

Change-Id: Iacb4a41234cbbd2d832908b48d188bd81a301b0f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
350e68d0b80c22e6ec37dd683134f46079619803 19-Aug-2014 Jungshik Jang <jayjang@google.com> Clean up MHL local devices when HdmiControlService turns into disabled state

Bug: 17122583
Change-Id: Id8f17faf9891952c762f86b46a89732f1497c5fc
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
8809f1e5473db09bc47315a2e423e58ba14fd670 19-Aug-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Invoke events listener upon MHL device state change" into lmp-dev
ed0864557b3340ab7db00e2dc95b29c4b8bb485d 18-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Invoke events listener upon MHL device state change

With this change, mobile devices state changes are propagated through
TIF to UI, hence the input pickers shows the mobile devices as
expected.

Bug: 16986744
Change-Id: Id633207acf4f814f57d43cc1de5f8cb88ac23ad6
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5691b2f2297b29dc83a7f83f77da517035b11cce 18-Aug-2014 Jungshik Jang <jayjang@google.com> Remove parameter field in HdmiCecKeycode.

Since we don't support mapping between android key and parameterized
cec keycode, remove parameter fields in HdmiCecKeycode.

Bug: 17099253
Change-Id: I8b6b6b361f0c343b0a263240b49e41bf289d36ca
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
4612a6e1116f1196e6aa64b5a6e3757ea48f94ac 12-Aug-2014 Jungshik Jang <jayjang@google.com> Implement MHL send key action.

This class introduces two classes, MhlSendKeyAction and
HdmiMhlKeycode.
- MhlSendKeyAction is a feature action that manages MHL message
for RCP, Remote Control Pass Through.
- HdmiMhlKeycode is a collection of MHL keycode including keycode
mapping between MHL and Android keycode.

Bug: 16966459
Change-Id: Ib3f7229c71b66837cd0d239e5af1940dfccee7df
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
98f4c16a7beba90abffa89d0b32b8ee56a31073d 18-Aug-2014 Jinsuk Kim <jinsukkim@google.com> Merge "CEC: Replace the usage of logical address with id for HdmiDeviceInfo" into lmp-dev
8960d1b1552729e3dfd33deee951ac75933ad8e5 13-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Replace the usage of logical address with id for HdmiDeviceInfo

Introduced 'id' of HdmiDeviceInfo to replace the direct use of logical address
as id. This accomodates the identification of MHL device with ease. Also updated
TIF to use id instead of logical address.

Bug: 16986744
Change-Id: Ifa827fb5e5fcf1d2f612f0845accbfe5c03734aa
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
c12035cd40d01b032013f515cb509e6c8791cf65 14-Aug-2014 Jeff Brown <jeffbrown@google.com> Log who is calling goToSleep().

Change-Id: Ibae61c90ee115735835e878bb3bf79eedaa0ae44
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
08a1be81d7b597f858164fee6a4934264259b3ae 12-Aug-2014 Yuncheol Heo <ycheo@google.com> Implement MHL RAP reception.

Bug: 16966458
Change-Id: I77effc917e19072c387be8ba28d6ce1664d16415
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
867b4e0c55b4b1e432a3585fc945a999f066ef81 12-Aug-2014 Jungshik Jang <jayjang@google.com> Set active port path to HdmiControlService

Set active port path to HdmiControlService so that the service
can handle proper event patch between cec and mhl devices.

Bug: 16215362
Change-Id: I2bd703916a422429b1029067fa3422e24de39274
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7df52862dae1fa33c84725c613b0d9b88c1b28b6 11-Aug-2014 Jungshik Jang <jayjang@google.com> Hook up native mhl api to HdmiControl Service.

This change hooks up all apis defined in mhl hal to
java layer's HdmiMhlController and HdmiControlService.
Along with HdmiMhlController, this change includes followings.

1. HdmiMhlLocalDevice
A logical container for a mhl device connected to specific hdmi port

2. HdmiMhlFeatureAction
A base feature action class for mhl's state behaviors like RAP and RCP.

Bug: 16215362

Change-Id: If177999853f60b68bd079549660a3f4982cb9d9e
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7d9acc7a3eddb3e57c0b8312c3baf7ebb4f529d9 12-Aug-2014 Yuncheol Heo <ycheo@google.com> Use the system property for the HdmiControlService configuration.

- We've used the system resoure overlay for this purpose, but we found
that it's hard for OEM which uses PDK to override this. Since the
resource was already compiled and provided as a binary, so it's hard
to change it.

Bug: 16965963
Change-Id: I868305d6f76c128d79c00ab6a8023656cd476c62
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
61daf6b38e7a7ada2a6ca5a60539a54b9c6810bd 08-Aug-2014 Jungshik Jang <jayjang@google.com> Hook up device power status change to TIF

Instead of introducing new api update existing
IDeviceEventListener

Bug: 16445063
Change-Id: I93bfc736a06a78e83c95877a53f4f241b51ed9c0
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5008486b09c588bf3409b70d9ee29225e8593c64 07-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Content observer to handle TV Setting update

Replaced the API setOption with content observer to read/get informed of
the CEC settings.

Bug: 16855247

Change-Id: Ieff2399bbfe83f05af4448e7337f91ef40d1e24d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
410ca9c7a4a2d69af5c81e76320433bfda05cafe 07-Aug-2014 Jungshik Jang <jayjang@google.com> Implement PowerStatusMonitorAction.

After this change, need to add an api which reports
power status change to other component like TIF.

Bug: 16445063
Change-Id: I5a347057af6140ece82acb5d15e3a8b3779b18be
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
2849b7ccd1cf973f862dd9b95355afbc9ca9268b 07-Aug-2014 Yuncheol Heo <ycheo@google.com> Go to nap when receiving <Active Source> for the other devices.

- Previously, it went to sleep when it got <Active Source>, but this
causes the other side-effects like can't-wake-up when changing to HDMI
port directly.

Bug: 15578870
Change-Id: I0ca5bd2372c9e5e7446592d66483900eeba75500
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5f75cbd8593e83eaf17cfac07186a3b6a7b7b1f1 06-Aug-2014 Jungshik Jang <jayjang@google.com> Use message validator for sending message.

Change-Id: I2ff82c5596e8c78c24189199ede66ee9905b95f5
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
61f4fbd2e8436a1ecd478c2a1f516d064a24d43b 06-Aug-2014 Jungshik Jang <jayjang@google.com> Rename HdmiCecDeviceInfo into HdmiDeviceInfo.

In order to include mhl device info to device info,
rename HdmiCecDeviceInfo into HdmiDeviceInfo.

BUG: 16215362

Change-Id: I30fb0216061fbbdd6fdc1b82c63af83f1b678597
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
30c74d9ba60a7208a587ecd6dcdfef1cfbd7fce7 05-Aug-2014 Jinsuk Kim <jinsukkim@google.com> CEC: Make port info unmodifiable

Puts HDMI port information behind unmodifiable type. This helps API make use
of port-related information without having to switch to service thread.
See getActiveSource().

Added the unmodifiable version of SparseArray/SparseIntArray.

Change-Id: Idcf05d1d6e19b47c91a7e89a920abccc607a3eb5
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
6aae6528a6672497b1d1dffb5c083093d5c46dc8 05-Aug-2014 Yuncheol Heo <ycheo@google.com> Refactor <Feature Abort> logic to concentrate it in one place.

- Don't reply from the unregistered address.
- Use "unrecognized opcode" as the default reason.

Bug: 16799466, Bug: 16798785
Change-Id: I7c2ece6436f7ebd59986d2baf4f45cd86e6622d9
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
fc44e4e03c5f6486efb7457965dcf7eaf36bc971 04-Aug-2014 Yuncheol Heo <ycheo@google.com> Let STB oneTouchPlay on SCREEN_ON event.

- Eleborate the reason code to initiate the initialization.

Bug: 16668375
Change-Id: I4ce657a9438e4f7baa7df2eaa102eb1ce1a7bccb
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e5a9337ebe738633cf7b66141cdf76efcdc5754c 25-Jul-2014 Jungshik Jang <jayjang@google.com> Implement clear timer.

This change implements clear timer, which sends
<Clear xxx Timer> to recorder, and reponse of it,
<Timer Cleared Status>.
Along with it, add result parser for [Timer Status Data].

Bug: 16160962

Change-Id: I1f48ec055aa93dc836156525de8b7ef921aad8b5
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
25c20298ad04e0e591e0cfdc0bb9d01a985433ab 31-Jul-2014 Yuncheol Heo <ycheo@google.com> Add the CEC message handler for the standby mode.

- Associate the state of AutoWakeUp with the pref value.

Bug: 16661406
Change-Id: I1299c6ca287aac4127e397a08b5af00190aa5b0b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7e74206693f4ee93afb902d5b3446e2384f2a13d 30-Jul-2014 Jinsuk Kim <jinsukkim@google.com> System API HdmiControlService.getActiveSource

Added getActiveSource to provide Tv Input Service with the information
on HDMI active source/routing path. TIS side will be handled separately.

Change-Id: I3d7c12a6c9da9f96a7f22ba1f66ac2559928858d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
4b54271f1bbd29957c47433155c58aa792105d6d 30-Jul-2014 Yuncheol Heo <ycheo@google.com> Don't clear local device when it goes to the standby mode.

Some OEM/SOC will keep passing the received packets until the
application processor goes to the sleep mode actually. so we'll
not clear the local devices to get the received packets and react
like in the standby mode.

Bug: 16661406
Change-Id: I6eb9c21877a29905bb0084256dc6692fe0d07170
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
26ba7fddcaeb052710ca8672889830dabcbfd3ac 29-Jul-2014 Yuncheol Heo <ycheo@google.com> Make it pass CECT 11.1.3 System standby

- Accept the broadcast <Standby> message.
- Fix the bug that onStandyCompleted() is called mutliple times.
- Fix the issue that <Standby> message is not sent when going to
the standby state, since the local device was cleared already.

Bug: 16497304
Change-Id: Ib04ad2386621929814a801edd6b6c0e1a3902a7c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
cfcdf1270127d9a333cda2b91646713d1f41c6ac 29-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Merge "Add MHL getPortInfo" into lmp-dev
f4eb72d53b4c5bc2286841006ad473ad4448bcf8 25-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Add MHL getPortInfo

Allows MHL support flag to be put into port information

Bug: 16215362
Change-Id: I1873c8e60b02f47a97509576fc40d57efb056817
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3ae16ddabcf4959607140b233ebc1613442e2f9e 25-Jul-2014 Yuncheol Heo <ycheo@google.com> Merge "Check the validity of the port id of HdmiCecMessage only in TV." into lmp-dev
e946ed8f54c5ee0e58e168df00d4f418e1eed7a7 25-Jul-2014 Yuncheol Heo <ycheo@google.com> Check the validity of the port id of HdmiCecMessage only in TV.

In playback device, we don't track the port info, so we can't verify
the validity of the port id part of the physical address parameter of
HdmiCecMessages.

Bug: 16274232
Change-Id: I41f95dba0505d45688e2c9031b78863dc93248ce
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
68bed6c5d7a000ccea469dc67fa9b4b9bfff7ac4 25-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Merge "Add portID information in HdmiCecDeviceInfo" into lmp-dev
2b152015ff94f20b9ec3ef284fb83105f8b3c831 25-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Add portID information in HdmiCecDeviceInfo

This change makes it convenient to get the HDMI port ID from the device
info without having to look it up through a separate HdmiPortInfo, which
happens in many places.

Also removed port information lookup loop by introducing two maps variable
in Control Service: port path ->port ID, and port ID -> port info.

Bug: 16547583
Change-Id: Ibfff722a16b626230766058efcc819e9c8ca0663
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
12e5dcefe136b58562f39604e6a8460ac92cb895 24-Jul-2014 Jungshik Jang <jayjang@google.com> Replace osd message for record status with IHdmiRecordCallback.

Add new interface, IHdmiRecordCallback, in order to handle
result of all recording features, One Touch Record and
Timer Recording.
HdmiRecordCallback is clientside interface which uses
RecordSource as return of getOneTouchRecordSource,
instead of raw byte array.

Along with it, add TimerRecordingAction.

Bug: 16160962

Change-Id: If0ed7abc5f45b020b39555cac585becbe8ee7da4
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
72b7d738d5b9254594726304cdb1777b54d95631 24-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Give clear distinction between active source/active routing path

Previously in HdmiControlSerivce, active routing path was mixed with
the physical address of the active source, but these two concepts needs
clearer distinction.

Defined a new variable for active source that contains both logical/physical
address to keep active routing path separate. This change makes it possible
to write the flow more closely to the guideline.

Also added to this CL is flag notifyInputChange, which allows the device/
routing change triggered by external event to trigger InputChangeListener
to get TIF notified. For routing control, the device info passed to TIF
has the path information in the field mPhysicalAddress (other fields are
invalid).

Bug: 16519939
Change-Id: I8b400bc48e874b0866500655773aea38ab945fe4
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
b6591b8e5399099dc6b7693e0fc719b613aba89c 23-Jul-2014 Jungshik Jang <jayjang@google.com> Implement OneTouchRecordAction and stop one touch record.

In addition to it, add api for clearTimerRecording as well.
Separately, I will replace logic for notifying message with callback
interface.

Bug: 16160962

Change-Id: I2368f7c697eb44ed4542c0ec4412c63a6ae41a5c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
bffb0635aaaaf9140d9120e3f3d95a4f7391a0ac 22-Jul-2014 Jungshik Jang <jayjang@google.com> Add startTimerRecording api to IHdmiControlService.

In order to support timer recording we need separate API,
startTimerRecording. Also added HdmiTimerRecordingSources
which is used to help creating timer recording information
such as timing information and program information.

Besides, in order to distinguish one touch record
and timer recording, rename startRecord with startOneTouchRecording.

Bug: 16160962
Change-Id: I8c3d4034665a2f84ddf07135aee73e17ac17cd82
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a6b2a7a59ab79b2d91412c1095d1c49b8dc9d507 16-Jul-2014 Jungshik Jang <jayjang@google.com> Add two apis for one touch record.

This change introduces new two apis for one touch record.
1. setRecordRequestListener
It's used to get notified when a recorder device initiates
"one touch record". As return of callback, client should
generate "record source" and return it.
2. startRecord
It's used to initiate "one touch record" from Tv.

Along with this, add HdmiRecordSources which is a helper
class assisting buidling byte array form from the given
record source information.

Bug: 16160962

Change-Id: I403d37b752c9b7f799c6d8188a071ef420fe8ac2
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
377dcbd53af4529c352d453424539b069909fce4 15-Jul-2014 Jungshik Jang <jayjang@google.com> Hook up system audio mode

Whenever system audio mode is changed, it should notify to AudioManager
so that AudioManager changes internal output or mute status accordingly.
To have more clear cut between last setting and current system audio mode,
renamed mSystemAudioMode into mSystemAudioActivated and added
getLastSystemAudioMode() which returns last system audio mode value stored
in global settings (NVM).

Bug: 16002150
Change-Id: I5d01d879c1c5a9a3f4b0cf2d25e9e74c26c52fa0
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
544b62bb863788727587ee292596451e461fc0a7 14-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Apply hdmi control options to operation

Use the flag mAudioDeviceOff/mAutoWakeup to conditionally perform
the operation

Change-Id: I1595d8a64170d5047e621491a09279e04e3b4302
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
09ffc846af78f949d2847003db9f793bfb5eefaa 11-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Store active source/active port in HdmiControlService when disabled

This lets the service keep track of the latest change made by TV app
or TIF regarding active source/port.

Bug: 16222083
Change-Id: I0f1a4520eb3e52ca5024567b0f1fbe4fd59e8cbf
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
b69aafbfaddd8a6ac84b366b5db640cdd7e95354 11-Jul-2014 Jungshik Jang <jayjang@google.com> Hook up missing volume-change with AudioManager.

Whenever new volume change is notified from system audio,
hdmi control service should delegate it to AudioManager.
Note that, it should set FLAG_HDMI_SYSTEM_AUDIO_VOLUME,
which prevents audio manager from notifying volume-
change event back to hdmi control service.

Change-Id: I6621f517a4d20226aea9159bbae6b699e2c2ffd0
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a9f10629f4bc1a82761917645ff4d2b6d42e47b3 11-Jul-2014 Jungshik Jang <jayjang@google.com> Start address allocation when hdmi cec is re-enabled.

When a user turns hdmi cec on from system settings or other possible way,
hdmi control service should start over from logical address allocation.
As device discovery action from bootup is slightly different from
one from enabling hdmi cec, added additional params to all notification
method which is called when logical address allocation is done.

Bug: 16222082

Change-Id: Ib73be5f642646918b470d769dc563753c4ff48d3
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7ecfbaed6e902aea151bc1919cf7771bbd868fc4 11-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Read/Write flags from/to system settings

Use Settings for storing several flags/values to keep the data persistent
across power cycle, and also to make them configurable via system Settings UI.

Bug: 16185931

Change-Id: I98650863e4237fd91c1b35717f14a570e049427c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
4fc1d105fc279bf7df6c876e160672866bdad8e7 09-Jul-2014 Jungshik Jang <jayjang@google.com> Revamp disabling device in local device.

When a cec deivce turns into disabled mode such as power off, standby,
and cec feature disabled, cec service should execute cleanup tasks.
Including cleaning up all feature actions, each device should run
their own cleanup.
It should stop system audio mode and arc for tv, while it should
send inactive source for for playback device.
Along with this, to prevent stale feature action, added timeout
to local device so that if there is stale action, it enforce to
finish it.

Bug: 16118520

Change-Id: I5ce30ab0f4459b6e2834f8d31b6a7ff789b35d07
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
c068bb5a0468bf605b0398e6f0ea5721917de4ee 07-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Support HdmiControlService.sendKeyEvent for both TV/playback device

Added another parameter deviceType for HdmiControlService to
run the specified local device for sendKeyEvent.

Bug: 15844076
Change-Id: I598ef320ae94bba0ace38701ae0ca12fd0625559
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
75a77e7d6cbfc287c6126efd28b338b48b7ea70c 09-Jul-2014 Yuncheol Heo <ycheo@google.com> Add HdmiCecMessageValidator to verify the incoming messages.

- Remove all param's length-check-logics in the package.

Bug: 16051295, Bug: 16117332, Bug: 15841545
Change-Id: If48ad9731f4f4613fd22aa3d9ada7ba3142bc999
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
c7eba0f1db8928ca779933a564a06989e22a8532 07-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Intent definition for HdmiControlService for OSD display

Intent action/extra for TV app to show a message on screen about events
HdmiControlService need to report for user's attention. The app
needs system permission HDMI_CEC to receive the intent.

Change-Id: I4fbe4621efa20a17ca64a3ca8f2df64bee03c51b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
347a60449981fc934e5a84122df87c1447665548 07-Jul-2014 Yuncheol Heo <ycheo@google.com> Fix the initial values of HDMI HAL options.

- We define the default value of OPTION_CEC_ENABLE as enabled, but OEM's
default was disabled.
- Fix the initial value of OPTION_CEC_SERVICE_CONTROL as enabled.

Change-Id: If4a69fd2a87739b9f6f7b9a5a5a2a5cdd514d48f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
119160a68195bcb2f5bdf4a269807e01228eca97 07-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Add vendor-specific command API for HdmiControl

Vendor-specific commands are not handled by the service. This CL
opens an API for vendors to implement customized handling of
CEC commands specific to their needs.

Change-Id: I8bfa3b891bd7994a903b3b41d7c2b27464167afa
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
c0c20d0522d7756d80f011e7a54bf3b51c78df41 04-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Removed class HdmiCec

Most of the constants in HdmiCec are internal use only. Moved them
to service, and dispersed the rest to other relevant classes.

Also moved HdmiCecMessage class to service as it doesn't need to be
open ouside the service.

Change-Id: I7b2ce3bf465330aa4d7fcd05f9aefa1e6c8b056a
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
5344cd98e69f92e70d52969b1851c9d8f9e81853 03-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Launch routing control in HdmiControlService at boot up

Change-Id: I918c2a0da26a7cda20ee703dfeeacae276ec8373
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
0f94217e9043e9dee329fa7167ee5be75eef0c23 04-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Merge "Add API setProhibitMode in HdmiControlService"
4d43d93743222311c6377d4904c19ccb93699d3b 03-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Add API setProhibitMode in HdmiControlService

setProhibitMode sets a flag inside the service that indicates if
input switch request will be processed or not. Sets to true when
TV is doing something for which TV display should be fixed, like
channel scan, software update - collectively called 'prohibit mode'.

Change-Id: I8ac623023210b58b684b9af3ac475a5fe0d09435
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
9c37e1f53ea4734bfe5ae156dc5399ce5f2c7ccc 02-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Implement some apis for TV Input Framework and HdmiControlService

- setInputChangeListener()
- getInputDevices()

Change-Id: I6f7d6d9c7094018e2b6b5ba37f63c8ee5df00e37
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
b2596e6182c7d540a7499e312470bac7e811d978 04-Jul-2014 Yuncheol Heo <ycheo@google.com> Merge "Handle the power state change."
38db629d897e9d7c8e31ce0a7e985981e3e12996 01-Jul-2014 Yuncheol Heo <ycheo@google.com> Handle the power state change.

- Add BrocastIntent listener to catch SCREEN_ON/OFF intents.
- Add callbacks onTransitionToStandBy(), onStandBy() in HdmiCecLocalDevice.java.
- When it gets the SCREEN_OFF intent, the state will be TRANSITION_TO_STANDBY,
then when there is no outstanding actions, the state will be STANDBY.
- When the state is STANDBY, the TV device will broadcast <StandBy>.
- When it gets the SCREEN_ON intent, the state will be TRANSITION_TO_ON,
then when the initialization is done, the state will be ON.
- When the state is ON and it receives <StandBy> CEC message, it will force
the system to go to sleep.
- When the state is STANDBY and it receives the cec messages to wake-up the
system, it will force the system to wake up from sleep.
- Manage the active source state for the playback device.

Change-Id: Ib473219a0b0deb5224df89386db5a83720000411
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
1de514256fd3015cf45256f3198ab5472024af9b 03-Jul-2014 Jungshik Jang <jayjang@google.com> Set source address for <Polling Message>

CEC spec mentions that logical address allocation uses
the same address for source and destination while <Polling Message>
uses device's source address.

Bug: 16045547
Change-Id: Id18f328755501c62a98a1040b287c180cb889c9b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
41d974631c5f525da49c88d34cecedd5a4cfeda8 30-Jun-2014 Jungshik Jang <jayjang@google.com> Add volume callback for Hdmi-Cec system audio mode.

Hdmi-Cec's system audio mode delegates audio control to
audio receiver from tv. It requires to delegate
volume change including mute to audio receiver
instead of consuming by tv.
In order to do this this change introduces three apis.
One is added to IAudioService, the others are added
to IHdmiControlService as hidden apis.

1. IAudioService#setHdmiSystemAudioSupported;
This is to notify system audio mode change to audio
service so that it determines to notify volume or mute
change to HdmiControlService.

2. IHdmiControlService#setSystemAudioVolume;
This is to notify volume change to HdmiControlService.
It's called only where system audio mode is on.

3. IHdmiControlService#setSystemAudioMute;
This is to notify volume change to HdmiControlService .
It's called only where system audio mode is on.

Change-Id: I3d8534b37ddf1a812e32012059a8778772044bf0
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3a959fca91bce393cc1ee79aa2985bb06542016e 03-Jul-2014 Jungshik Jang <jayjang@google.com> Log unhandled message which has specific destination.

Broadcast message is unnecessary to log as broadcast message.

Bug: 16039302
Change-Id: Ifffc09b49bceaaf220ce929206eaecb78146016f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
160a6e5b99de15ce755e2e5521dce32d81ab180a 01-Jul-2014 Jinsuk Kim <jinsukkim@google.com> Add setOption for HdmiControlService

Bug: 15845304
Change-Id: I96b285ae3938aeecdd44b2c08a178def33bd2bf2
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a13da0d5913757e2456020c69481f98d0e44c090 30-Jun-2014 Jungshik Jang <jayjang@google.com> Add api, setArcMode, used to turn on/off ARC.

Usual TV can switch on and off of ARC feature in its settings page.
Along with it, removed locking block from the code,
because arc flags are accessed by actions and internal services.

Change-Id: I737ac0c2671b537551eaac202d2065cc99c6d0a0
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
92b77cf9cbf512e7141cad6fef5a38d0682dde43 27-Jun-2014 Jinsuk Kim <jinsukkim@google.com> Refactor handling sequences in HdmiControlService

- Rewrote some methods to match more closely to the handling
sequences in guideline
- Added setControlEnabled() API in the aidl
- Handled <Routing Control> command
- Handled some scenarios invoking RoutingControlAction

Change-Id: I5db0c6fc775cef709c2e0f338b85937deebf2a54
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
8333571bd5e0a08773a1679964f8d96227af3356 24-Jun-2014 Jinsuk Kim <jinsukkim@google.com> Handle incoming active source-related commands for HdmiControlService

Handles incoming commands <Active Source>, <Inactive Source>, <Request
Active Source> that concern the active source update/report.

Defined mPrevPortId which is used to allow switching back to the input
set previously by <Active Source> or deviceSelect() when receiving
<Inactive Source>.

Also fixed a bug sending <Active Source> with wrong parameters.

Change-Id: I47fd804755c5c6beca38ddb21bb388a455d74f63
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a858d221ff86c497e745222ea15bab141e337636 23-Jun-2014 Jungshik Jang <jayjang@google.com> Notify ARC status update to AudioService.

Whenever ARC status is updated it should be notified to
AudioService so that it reroutes audio output to others.

Bug: 15841544, Bug: 15844022, Bug: 15844112

Change-Id: I06674ee4dd22c0f9be08e33fbacdd785578ba55f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e9cf1583c74fd03977c1ecb14520663710f14439 23-Jun-2014 Jungshik Jang <jayjang@google.com> Rename canChangeSystemAudioMode on HdmiCecLocalDeviceTv with hasSystemAudioDevice.

Change-Id: Id9ddcf377b30ef86ceb7c3933f2a89f1d95ab842
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a5b7414970c85217e88015e78ecbc5ba093dead3 23-Jun-2014 Jungshik Jang <jayjang@google.com> Introduce @ServiceThreadOnly and @IothreadOnly to HdmiControlService

Many of hdmi service modules assumes that it runs on
service thread without any lock. But it's a bit
hard to distinguish whether a method runs on
service thread or not even though there is run-time
assertion (runOnServiceThread()) is top of method.
@ServiceThreadOnly interface documents that a method should
run on service thread while @IoThreadOnly documents
that a method should run on io thread.

Change-Id: Ia4a6a48675d2302fb2cb7a8a807fcf112da5d4e7
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
ea67c183fe5511ad99aeaae1a32b5245bd020e36 19-Jun-2014 Jungshik Jang <jayjang@google.com> Add for System Audio Mode

Note that this is skeleton change and do not merge
till get full review from outside of CEC team.

This change introduce four apis for System Audio Mode

1. boolean canChangeSystemAudioMode()
- Whether to change system audio mode or not.

2. setSystemAudioMode(boolean enabled, IHdmiControlCallback callback);
- Change system audio mode.

3. add/removeSystemAudioModeChangeLister.
- Register/deregister listner for AudioModeChange.

4. getSystemAudioMode()
- Whether to system audio is enabled or not.

Change-Id: I1e82365155a9f7f6c3ac5d9db4871cf6bad46865
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
13c030e828a90fcfc57b52024b72326757cec583 20-Jun-2014 Jinsuk Kim <jinsukkim@google.com> Do not have HdmiControlService report deviceEvent for TV itself

DeviceEvent should be used only for the other logical device,
not the TV device itself.

Also fixed a but not updating the logical address after the allocation.

Change-Id: I80cec9d5bb4b95d003c9d1c7ea13f02d7e76b322
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
4893c7efde52411ad051ef5c20251439f4098eac 19-Jun-2014 Jinsuk Kim <jinsukkim@google.com> Report device status event in HdmiControlService

This change allows the event listener (TIF) to get notified
of the CEC logical device status change (addition/removal),
and update the available tv inputs accordingly.

Change-Id: I7f2798ad47212120ecac8093ad281f683a3d125e
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a062a9339add79a84862a34e363e3e454a6ec435 18-Jun-2014 Jinsuk Kim <jinsukkim@google.com> Implement portSelect/sendKeyEvent for HdmiControlService

TIF (TV Input Framework) uses these API to switch inputs, send
keys for selected device on CEC bus. Also renamed getActiveInput
to getActivePortId to use a unified term for port/input.

Change-Id: I8196825c0d960988cc1c0bb58a628ccd8ab1957e
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3ecdd832c77483c909fbf90d17d0e6d97ca365ee 17-Jun-2014 Jungshik Jang <jayjang@google.com> Fix missing iteration policy on device discover action

Device polling requires both pick policy and pick iteration policy,
however, device discovery action has no iteration policy.
Along with fix, move send result and pick policy constants
to HdmiConstants package

Change-Id: Ibbcfdc482a189bbc3aa2c61143422541da78447d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3e1e33f13b524b26188dd4a97469ce21518c8d0d 17-Jun-2014 Jungshik Jang <jayjang@google.com> Merge "Rearrange ownership between Hdmi control modules."
79c58a4b97f27ede6a1b680d2fece9c2a0edf7b7 16-Jun-2014 Jungshik Jang <jayjang@google.com> Rearrange ownership between Hdmi control modules.

Here is a list of changes on this. (R: rationale)
1. HdmiCecLocalDeviceTv takes over responsibilty of device info
management.
R: All devices infos are added or removed by only Tv's
device discovery and hot plug detection mecanism

2. Each HdmiCecLocalDevice manages FeatureAction and Cec
message cache.
R: There is no direct connection between actions that
are created in different device action. If there is
an same actions created from different local device,
they should be managed independently.

3. Active path and logical address is managed by
HdmiCecLocalDevice.
R: All device should know active path of current source.

4. All system audio & ARC features are handled by
HdmiCecLocalDeviceTv
R: In terms of ARC, theoretically, any device can be transmiter of
ARC but TV is the de facto device
On other hands, for system audio Tv is the recipeint
of request.

Change-Id: Iac9ff43fb41798ed4f94c61d23345fe5fe777fbb
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
0d3985a977886a0d6d6bb7ba6d048c1e21b05a24 16-Jun-2014 Jinsuk Kim <jinsukkim@google.com> Added an argument isPressed to HdmiControlService#sendKeyEvent

sendKeyEvent requires additional argument isPressed to handled
both up/down key event.

Change-Id: I0080adc72920dd7ae4e4dae041781f76a6658f9b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
6d97f5b91c6c82f28a2a3a5d3b922f0e5844e733 16-Jun-2014 Jinsuk Kim <jinsukkim@google.com> A few more APIs for HdmiControlService

Added following APIs in HdmiControlService:

- portSelect
- sendKeyEvent
- getPortInfo
- addDeviceEventListener

Some are not fleshed out yet. Will work on it in a follow up CL.

Change-Id: Ia8c635176c0378f6e8db589bf714d82bf21ce85d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
60cffce420db4c3395f86d3b9bb36003adf26f5d 12-Jun-2014 Jungshik Jang <jayjang@google.com> Refine new device action.

There are many ways to initiate new device action
1. When receives <Report Physcial Address>
2. When receives <Active Source> from unregistered device.

If new device is audio system, it should start
ARC and system audio initiation action.

Along with this consolidate device remove actions.

Change-Id: I189afd8bec7270d6a1734a28632593b71932d9e8
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
401e3de791c0e2a4348361fbd560da9530156e22 14-Jun-2014 Jinsuk Kim <jinsukkim@google.com> Add methods in HdmiControlService fort port_id/path conversion

Use HdmiPortInfo list to get the port ID from a given routing path,
and vice versa. This is useful when you need to get the HDMI port
to which a certain device is attached in its hierarchy by its routing
path.

Change-Id: If1e7e8fdd005671d4e1fbb04dc26b24885320a92
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
0340bbc89f8162f9c2a298c98b03bfcdd1bc6e87 05-Jun-2014 Jinsuk Kim <jinsukkim@google.com> RoutingControlAction for HdmiControlService

Routing control action is initiated in various cases, such as manual
TV input port switching, routing change of a different CEC switch,
and so on. The action determines the device to be a new active source.

Change-Id: I1efcd6ff1919dd94d6fa0e0ffa6e430c48d4e9c6
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a6ce7708d6124224399241503fadcafe0c4684d4 10-May-2014 Jinsuk Kim <jinsukkim@google.com> DeviceSelectAction for HdmiControlService

DeviceSelectAction is the main handler for the API deviceSelect() which is
used to choose a new active source among logical devices on the bus.

Change-Id: I77582a1f873423fc316d89f67a89a867461a76b2
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
42c9800f4f3acef10d19dca39e8b739546407c04 12-Jun-2014 Jungshik Jang <jayjang@google.com> Use model name for local devices' osd name.

Till we find better name use model name as local devices' osd name.
Note that all local devices share display name.

Change-Id: I97e51d76f8cb9511acfe854b7bbe276eec56a661
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
092b445ef898e3c1e5b2918b554480940f0f5a28 11-Jun-2014 Jungshik Jang <jayjang@google.com> Move message handling logic to local device instead of service.

Local device is in charge of handling incoming messages
and for some messages such as <set menum language> or
<report physical address> each device has slightly different
behavior. Instread of checking destination address and
local device status from service, this change leaves it
to each local device.
Note that some messages are still left on service
and will be refactored in the following changes.

Along with this, following changes are included.
1. add missing jin interfaces
set_option
set_audio_return_channel
is_connected
Note that get_port_info is under review of jinsuk's change
2. if tv device receives <Report Physical Address>,
starts NewDeviceAction.
3. add constants variables related to new interfaces.
4. add two helper methods for physical address and vendor
id handling

Change-Id: I9c9d04744bc09fbf38431ecfa6e77097b0618a37
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a466929979a92a578d4ba00093fefa57cfb982b4 10-Jun-2014 Jungshik Jang <jayjang@google.com> Use cached message in NewDeviceAction.

Vendor id and osd name can be cached in be reused
later.
Along with this, fix a bug on HotplugDetectionAction.

Change-Id: I0583a9c266eed4281a99a59b1301f41b3e155505
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e81e108c4035ea8933525baa8108cb392f8abf5d 05-Jun-2014 Jungshik Jang <jayjang@google.com> Implement cec message cache.

HDMI bus for CEC is quite slow and it may cause conflict
or timeout during device discovery stage or hot-plug
detection stage. However, some static information, such
as physical address, vendor id or osd name are usually
sent automatically when a device is connected, and
almost never change after updated.

Change-Id: I4df9d27ef1af04ee35d63a764580fed07c32d15d
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
0f8b4b770c49b83fa8260833d8e1ec5c721a05d3 28-May-2014 Jungshik Jang <jayjang@google.com> Implement hotplug detection sequence.

Hotplug detection is periodic operation to detect new/removed device.
In case of directly connected device fires hotplug devices
but remote devices which are plugged in hdmi switch may not
report their existence.
Hotplug action polls all devices in regular base; 5s for
system audio (only when it's active) 15s for others.

Change-Id: I77c308ecfd5d6bf92f306923fa5ac9eabdad4127
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
3ee65720e91c7f92ad5a034d7052122a606aa8d5 03-Jun-2014 Jungshik Jang <jayjang@google.com> Refactor HdmiCecLocalDevice and logical address allocation logic.

1. Factor out logical allocation logic to HdmiControlService.
2. Contains a reference to HdmiControlService rather than
HdmiCecController so that it enables to access service's logic
directly.
3. Move launch device discovery logic to HdmiCecLocalDeviceTv.

Change-Id: Ic97b4d51311a3c18f6d586c2245cac410cbd370e
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
63a2e0696ce2a04fbe0f1f00cfe9c93189f944da 27-May-2014 Yuncheol Heo <ycheo@google.com> Add SystemAudioAction(FromAvr|FromTv).

The system audio can be initiated by Tv itself or by AVR through
<Set System Audio Mode> CEC message.

This CL also includes:
- Add HdmiConstants, HdmiUtil class to handle various constants and
utility functions.
- Add default message dispatcher to all queued actions.
- Add an argument on HdmiControlService.removeAction(class) to prevent
from removing the caller itself.

Change-Id: I9fd9089bed876f04b58c483879b64edfae94a298
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
8b308d93c8fdcc7304b33d9b445ae3807eae97c8 29-May-2014 Jungshik Jang <jayjang@google.com> Start Device Discovery after logical address allocation.

Usually TV initiates Device Discovery sequence after logical address
allocation of local devices. For that added new callback interface
to AddressAllocationCallback to HdmiCecDevice.
Along with this, add onAddressAllocated to HdmiLocalDevice so that
start sending local device information once logical allocation is done.

Change-Id: I4cdc5dd7770674a17a0f23c383a6c1ca221e3104
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
8692fc68a413c7aca75f094bb02bcbabcc277c73 29-May-2014 Jinsuk Kim <jinsukkim@google.com> Stop publishing HdmiCecService, start publishing HdmiControlService

HdmiCecService will soon be deprecated and replaced with HdmiControlService.
Stopped publishing the service, and turned the corresponding manager to
stub so that it will do nothing but print out a warning msg instead.

Will help the app transition to the new service in the meantime. Once
the migration is finished, will gut out all the HdmiCecService/
HdmiCecManager stuff.

Change-Id: Ic34a69c4fb99f4e5a2c8323538195204ab16a545
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
c3923ea50dd0b161ba84941c071d34bb98c0700a 28-May-2014 Jinsuk Kim <jinsukkim@google.com> Dispatch incoming CEC messages to feature actions

This CL dispatches incoming CEC messages to feature actions that
the service manages.

Change-Id: I9221d6a25648846327d00fe5404aaf1e8ec786ce
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
cc5ef8c918e96516a5c51cc40735a1b8a24d8497 27-May-2014 Jungshik Jang <jayjang@google.com> Implement device discovery sequence.

When device discover is launched it goes through the following step

1. clear all existing devices
2. send <Polling Message> of all logical addresses
excecpt one of local device
3. Once got all allocated logical addresses, gather physical address of
them
4. Once got physical address of them, gather display name of them
5. Once got display names, gather vendor id of them
5. Once got vendor id of them, register all gathered info to
internal device info list.

Change-Id: Ic9aca3b15d88ac7650f10b6d0bfa9c97923975e8
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
7fe2ae0fe9c24f0a1a5ddf20850069b56af2c2fd 26-May-2014 Jinsuk Kim <jinsukkim@google.com> Hook up the CEC playback API to service internal logic.

This change enables CEC playback API (oneTouchPlay, queryDisplayStatus).
Also updated local device list type to SparseArray to make it easy
to get one based on device type.

Change-Id: I6f88b2dac2d873c493a90411549a4e5719a5e460
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
02bb4265ac41e1974ec7d4793e6c2a0ed2adc3c4 23-May-2014 Jungshik Jang <jayjang@google.com> Implement <Polling Message>.

When Device Discovery is launched or Hot-plug detection is
launched, the first step of it is to send <Polling Message>
to all remote devices. According to type of feature,
it may have different retry count for sending <Polling Message>.

As <Polling Message> to all devices should be serialized operation
it runs on io thread as single operation.

Along with this, added assertRunOnIoThread and
assertRunOnServiceThread used to make sure that all methods are
called in proper thread.

Change-Id: I2d2df0216867c188e99ba24b216ec73f3396eeae
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
ece603b7955938d6001c376f351ca0a2219330ac 23-May-2014 Yuncheol Heo <ycheo@google.com> Add the constants for the callback result of SendCecCommand().

- Move the send failure warning messages into HdmiCecController.sendCommand()
from each Actions.
- Stringfy with more detail messages for some opcodes.

Change-Id: Ib7ce24dd2a1f290e6c3a0b26738772ef1d4a9630
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
d643f764f72efc1e7aa67392bf9ac40720ae14c3 22-May-2014 Jungshik Jang <jayjang@google.com> Add SendMessageCallback to Hdmi control service.

As we have separate IO thread, we should have async callback
mechanism to get result of send request.
For that, I added SendMessageCallback interface to HdmiControl
Service
Along with this, replace message-based IO handling with
post Runnable based one for consistency

Change-Id: I61cf5b751b4f2af3b34956060869f3512f161d11
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
78d695d8ba532214b02e7f18e0ccf89cf099163d 13-May-2014 Jinsuk Kim <jinsukkim@google.com> Add feature actions for HDMI-CEC playback device

- OneTouchPlayAction
- DevicePowerStatusAction
- addHotplugEventListener
- removeHotplugEventListener

Change-Id: Ia7f31507ca62127efbacbbfe07ab43ba1f9bd4cf
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e1a2e26a03e76279c9b03bdd81f92df70f8707e7 21-May-2014 Jungshik Jang <jayjang@google.com> Merge "Add several actions for ARC (Audio Return Channel)"
2f51aec689226e259d08bf04d838251f249572e3 20-May-2014 Jungshik Jang <jayjang@google.com> Fix NullPointerException on init of HdmiMhlController.

Change-Id: I2f79ce0ef3a368c2fcc8d047de2dcad914679e0c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
67ea521d14f366fe5aac09e512865d31bfa0ee53 15-May-2014 Jungshik Jang <jayjang@google.com> Add several actions for ARC (Audio Return Channel)

ARC channel is established by both TV and AV Reciever.
From TV, it sends <Request ARC Initiation> and AVR
responds with <Initiate ARC>.
From AVR, it can be initiated by sending <Initiate ARC> directly
to TV.
Once TV receives <Initiate ARC> it sets up ARC internally
and replies <Report ARC Initiated> to AVR.
Termination steps are almost same except for message name
(use Terminate instread of Initiation).

In order to implement the above steps, this change introduces
following classes.

RequestArcInitiation(Termination)Action:
handles <Request ARC Initiation> (<Request ARC Termination>)
RequestArcAction handles common logic of them.

SetArcTransmissionStateAction:
handles ARC set up, enabling/disabling ARC and
reports results to AVR.

<Initiate ARC> and <Terminate ARC> handles directly in
HdmiControlService

Along with this, this change has implmentation for
add&removeAction. To avoid synchronization issue
they are isolated to main thread.

Change-Id: I3c5cf7c777e6c1de50d63ce4643b191dfe15fe1f
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
4b0b0391d5b3ef289e00423ec701b450ac2a0eb3 19-May-2014 Jinsuk Kim <jinsukkim@google.com> Merge "Initialize internal CEC logical devices"
be9cd8eb3fe64a572f9c7dfc41f04defd46a752d 15-May-2014 Jungshik Jang <jayjang@google.com> Add ARC commands

ARC, Audio Return Channel is newly introduced in HDMI CEC 1.4.
Here is a list of new command
<Initiate ARC>
<Report ARC Initiated>
<Report ARC Terminated>
<Request ARC Initiation>
<Request ARC Termination>
<Terminate ARC>

Along with it replaced <Get OSD Name> with <Give OSD Name>
which is renamed in CEC 1.4.

Change-Id: If4a7aedef839c8413a8e3b5f66f3df0c7234104b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a8a5e50c6f9ba3ae0ff59eda76354e93515d6f8f 15-May-2014 Jinsuk Kim <jinsukkim@google.com> Initialize internal CEC logical devices

Allocates logical address of internal HDMI-CEC logical device(s)
using the resource config_hdmiCecLogicalDeviceType.

Change-Id: I1a0d2f7bce36fc643887241f03161dc053d6c25c
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
a1fa91fe263c483cf13066e2847a440de2cd52a5 08-May-2014 Jungshik Jang <jayjang@google.com> Implement handlers for system information query command.

System information query commands are stateless command and
it should be replied immediately when it receives query command.
Here is a list of command handler (and it's reply) implemented
in this change.
1. <Get Menu Language> -> <Set Menu Language>
2. <Give(Get) OSD Name> -> <Set OSD Name>
3. <Give Physical Address> -> <Report Physical Address>
4. <Give Device Vendor ID> -> <Device Vendor Id>
5. <Give CEC Version> -> <CEC Version>

In order to centralize all cec message building, added new
builder class, HdmiCecMessageBuilder for HdmiCecMessage.
Accordingly, all helper methods for building of HdmiCecMessage
are moved to HdmiCecMessageBuilder class.

Change-Id: Ib7c5d2b0cb3d69d51159af8bc277ffb49a60909b
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
c70d2295dd3fb87ce8c81c704688d1ad05043b4d 30-Apr-2014 Jinsuk Kim <jinsukkim@google.com> Define Feature action for obtaining info on a new CEC device

Feature action (or action) is a unit of CEC command flow that accomplish
a certain feature. This CL introduces an abstract class FeatureAction,
and a concrete one NewDeviceAction that is used to obtain detailed
information on a new logical device on the CEC bus.

Change-Id: I94a7e75fbb76fe547f07f9588a93c7ea5a85d856
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
e9c77c88ea34a66f83a94f960547275c0ff6bd07 24-Apr-2014 Jungshik Jang <jayjang@google.com> Implement native send and receive logic for HdmiCecController.

This change includes native jni implementation for
incoming and outgoing message of CEC.
For incoming message, native layer converts it into three
pieces, source address (initiator), destination address (follower)
and data body which includes opcode. In Java layer, it is delegated to
main io thread. For now all messages are rejected by sending <Feature Abort>
to initiator.
For outoging message, all messages are sent to io thread and it delegates
it into native layer. Native logic converts it into cec_message and
pass it to HAL so that HAL performs sending message.
In order to handle <Feature Abort> message, added [Abort reason] which is
defined in hdmi_cec.h.

Change-Id: If9fd74745f476105e5cfae964e39c78bae69d3e2
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java
0792d37385e60aa8d73f8df174d0a32f4f618bc4 23-Apr-2014 Jungshik Jang <jayjang@google.com> Implement skeleton of new HDMI Control Service.

HdmiCecService is a system service handling HDMI-CEC features
and command. Recently we found out that industry has more
requirements to support HDMI-CEC. Also, MHL is another
standard should be in our pocket. Basically, MHL is
a standard to support communication between mobile device
and TV or Av device. As CEC is a control standard over HDMI
cable, MHL has control channel for peer device.
There behavior is very similiar. Both have commands that
can change Tv's current input and can send/receive key
to other device to control other deivce or TV.

In order to cover both CEC and MHL, current HdmiCecService
implementation has limitation. We had several
session of discussion and decided to refactor
HdmiCecService into HdmiControlService.
For each standard it will have separate controller instance
like HdmiCecController and HdmiMhlController.

In this change I didn't touch original HdmiCecService
because some component, like cast receiver, uses HdmiCecService.
For a while we will keep HdmiCecService until HdmiControlService
accomodates all features of HdmiCecService.

Change-Id: I5485280ab803dbf071d898bfbe34be0b11ce7958
/frameworks/base/services/core/java/com/android/server/hdmi/HdmiControlService.java