Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e58b13fc authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "TvInput: Update active config on stream config change" into main

parents 7343d81c 66b698a6
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -237,6 +237,27 @@ class TvInputHardwareManager implements TvInputHal.Callback {
            }
            int previousConfigsLength = connection.getConfigsLengthLocked();
            int previousCableConnectionStatus = connection.getInputStateLocked();

            if (configs != null) {
                /*
                   This method is called when a new connection is created or when there is a change
                   in the stream configuration. When a new connection is created,
                   connection.mConfigs is null. If the stream is updated and a new config is
                   generated, it is added to the configs array by TvInputHal. This new added
                   configuration has to be marked as the current active config for this connection.
                */
                TvStreamConfig nextActiveConfig = configs[0];
                for (TvStreamConfig config : configs) {
                    if (config.getGeneration() > nextActiveConfig.getGeneration()) {
                        nextActiveConfig = config;
                    }
                }
                final TvInputHardwareImpl hardwareImpl = connection.getHardwareImplLocked();
                if (hardwareImpl != null) {
                    hardwareImpl.mActiveConfig = nextActiveConfig;
                }
            }

            connection.updateConfigsLocked(configs);
            String inputId = mHardwareInputIdMap.get(deviceId);
            if (inputId != null) {