Stop current tuning before starting a new tuning.

If a new tuning request comes before stop old tuning, there is race
condition that the Frontend loop thread may crash while terminate().

Bug: 202335601
Fix: 202335601
Test: atest android.media.tv.tuner.cts
Change-Id: Ic168b585f0a8fe36bd8eeceee3e0b4c83d5388aa
diff --git a/tv/tuner/aidl/default/Demux.cpp b/tv/tuner/aidl/default/Demux.cpp
index 8e83d06..4385461 100644
--- a/tv/tuner/aidl/default/Demux.cpp
+++ b/tv/tuner/aidl/default/Demux.cpp
@@ -343,6 +343,10 @@
 }
 
 void Demux::startFrontendInputLoop() {
+    ALOGD("[Demux] start frontend on demux");
+    // Stop current Frontend thread loop first, in case the user starts a new
+    // tuning before stopping current tuning.
+    stopFrontendInput();
     mFrontendInputThreadRunning = true;
     mFrontendInputThread = std::thread(&Demux::frontendInputThreadLoop, this);
 }