OSDN Git Service

CEC: Make deviceSelect to active device a no-op
authorJinsuk Kim <jinsukkim@google.com>
Tue, 5 Aug 2014 03:48:35 +0000 (12:48 +0900)
committerJinsuk Kim <jinsukkim@google.com>
Tue, 5 Aug 2014 21:04:44 +0000 (21:04 +0000)
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

services/core/java/com/android/server/hdmi/HdmiCecLocalDeviceTv.java
services/core/java/com/android/server/tv/TvInputHardwareManager.java

index 70d108a..b36c176 100644 (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.
index ba79fed..08ac210 100644 (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);