[Feature][S300AI][task-view-1866][voice] add battery only voice app control

Change-Id: I3b25d391d8203e698ca52cb07e03f6a9d314b1aa
diff --git a/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_battery.c b/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_battery.c
index abd28f9..04ca86d 100644
--- a/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_battery.c
+++ b/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_battery.c
@@ -503,6 +503,29 @@
 	return -1;
 }
 
+static int is_ccapp_running() 
+{
+    FILE *fp;
+    char buffer[256];
+    const char *cmd = "ps -eo comm | grep -w ccapp";
+
+    fp = popen(cmd, "r");
+    if (fp == NULL)
+	{
+        perror("popen");
+        return 0;
+    }
+
+    if (fgets(buffer, sizeof(buffer), fp) != NULL)
+	{
+        pclose(fp);
+        return 1;
+    }
+
+    pclose(fp);
+    return 0;
+}
+
 static void mmi_set_battery_voice_process(SINT32 voltagepower)
 {
 	char battery_voice_voltage[8] = {0};
@@ -521,9 +544,12 @@
 	{
 		if(1 == kill_flag)
 		{
-			kill_flag = 0;
-			system("echo spi0.0 > /sys/bus/spi/drivers/slic_tw_spi/bind"); //open slic
-			system("ccapp &"); //start ccapp
+			if(!is_ccapp_running())
+			{
+				kill_flag = 0;
+				system("echo spi0.0 > /sys/bus/spi/drivers/slic_tw_spi/bind"); //open slic
+				system("ccapp &"); //start ccapp
+			}
 		}
 	}
 	else
@@ -532,9 +558,14 @@
 		{
 			if((0 == atoi(battery_voice_voltage)) || (voltagepower <= atoi(battery_voice_voltage)))
 			{
-				kill_flag = 1;
-				system("killall ccapp"); //close ccapp
-				system("echo spi0.0 > /sys/bus/spi/drivers/slic_tw_spi/unbind"); //close slic
+				if(is_ccapp_running())
+				{
+					kill_flag = 1;
+					system("killall ccapp"); //close ccapp
+					system("cat /dev/slic");
+					system("echo spi0.0 > /sys/bus/spi/drivers/slic_tw_spi/unbind"); //close slic
+				}
+				
 			}
 		}
 	}