TvInputHardwareManager: always try patch recreate if null

TvInputHardwareImpl constructor registers for an audio port update
listener which can be triggered causing updateAudioConfigLocked() and for
mAudioSource and mAudioSink to be initialized but with mActiveConfig
null. On subsequent setSurface(), mActiveConfig is set and
updateAudioConfigLocked() called, however sink and source may not be
updated. Under such conditions, the audio patch may never be created.
Add a mAudioPatch null check for determining whether the audio patch
should be created.

Test: atest CtsTvTestCases:BundledTvInputServiceTest#testTune
      on yukawa TV build with 1) mock tv input hal, 2) mock hdmi tv
      input service and 3) mock primary HAL hdmi in support
Change-Id: Ic92d926759d4a87eda4851630bee946af66f6984
This commit is contained in:
Dean Wheatley
2020-12-24 08:44:04 +11:00
parent 3a7861281b
commit c52b5e533c

View File

@@ -950,7 +950,7 @@ class TvInputHardwareManager implements TvInputHal.Callback {
AudioPortConfig sourceConfig = mAudioSource.activeConfig();
List<AudioPortConfig> sinkConfigs = new ArrayList<>();
AudioPatch[] audioPatchArray = new AudioPatch[] { mAudioPatch };
boolean shouldRecreateAudioPatch = sourceUpdated || sinkUpdated;
boolean shouldRecreateAudioPatch = sourceUpdated || sinkUpdated || mAudioPatch == null;
for (AudioDevicePort audioSink : mAudioSink) {
AudioPortConfig sinkConfig = audioSink.activeConfig();