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
@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.
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);