CEC: Make deviceSelect to active device a no-op

Changing input to already the active source should return
immediately without initiating routing control. This is also required
for processing the incoming <Active Source>

Also set the flag in intent for input change to start a new
activity from a service. The service fails to launch an activity
without it.

Bug: 15570939
Change-Id: I9b20b31137dfa4dc847bc43cc7fd35e669d0dec7
This commit is contained in:
Jinsuk Kim
2014-08-05 12:48:35 +09:00
parent 976e8bd201
commit 58500f43ec
2 changed files with 6 additions and 0 deletions

View File

@@ -165,6 +165,11 @@ final class HdmiCecLocalDeviceTv extends HdmiCecLocalDevice {
@ServiceThreadOnly
void deviceSelect(int targetAddress, IHdmiControlCallback callback) {
assertRunOnServiceThread();
ActiveSource active = getActiveSource();
if (active.isValid() && targetAddress == active.logicalAddress) {
invokeCallback(callback, HdmiControlManager.RESULT_SUCCESS);
return;
}
if (targetAddress == Constants.ADDR_INTERNAL) {
handleSelectInternalSource();
// Switching to internal source is always successful even when CEC control is disabled.

View File

@@ -930,6 +930,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
if (inputId != null) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(TvContract.buildChannelUriForPassthroughTvInput(inputId));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);
} else {
Slog.w(TAG, "onChanged: InputId cannot be found for :" + device);