Reset mIsActiveSource in source local device when new Active Source is
recorded

In Hdmi local source device, mIsActiveSource is used to represent if the
current device is the current Active Source or not. But when we receive
<System Audio Mode Request> or <Active Source> with a new Active Source,
we did not update mIsActiveSource when reset Active Source.

Test: manual
Bug: 131629012
Change-Id: Ief369a724fe9c2bac13db7af24cdbbfb5b732185
(cherry picked from commit cf0c95a51776f7a3b54f50d61709abcb362c324c)
diff --git a/services/core/java/com/android/server/hdmi/HdmiControlService.java b/services/core/java/com/android/server/hdmi/HdmiControlService.java
index 9aaf33c..fe29060 100644
--- a/services/core/java/com/android/server/hdmi/HdmiControlService.java
+++ b/services/core/java/com/android/server/hdmi/HdmiControlService.java
@@ -2819,6 +2819,21 @@
             mActiveSource.logicalAddress = logicalAddress;
             mActiveSource.physicalAddress = physicalAddress;
         }
+        // If the current device is a source device, check if the current Active Source matches
+        // the local device info. Set mIsActiveSource of the local device accordingly.
+        for (HdmiCecLocalDevice device : getAllLocalDevices()) {
+            // mIsActiveSource only exists in source device, ignore this setting if the current
+            // device is not an HdmiCecLocalDeviceSource.
+            if (!(device instanceof HdmiCecLocalDeviceSource)) {
+                continue;
+            }
+            if (logicalAddress == device.getDeviceInfo().getLogicalAddress()
+                && physicalAddress == getPhysicalAddress()) {
+                ((HdmiCecLocalDeviceSource) device).setIsActiveSource(true);
+            } else {
+                ((HdmiCecLocalDeviceSource) device).setIsActiveSource(false);
+            }
+        }
     }
 
     // This method should only be called when the device can be the active source