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

Change-Id: I304d8bd4860f69aedae5456f63061b3086909984
diff --git a/lynq/S300AI/ap/app/ccapp/cc_proc.c b/lynq/S300AI/ap/app/ccapp/cc_proc.c
index 1b2cc5b..c173581 100755
--- a/lynq/S300AI/ap/app/ccapp/cc_proc.c
+++ b/lynq/S300AI/ap/app/ccapp/cc_proc.c
@@ -1384,6 +1384,7 @@
     switch(state)

     { 

     case 0://Z_MMIACC_CALL_STATE_ACTIVE

+        cfg_set("voice_status", "active");

         if (g_Cc_CallDetail.slaveObj[cid].state == ZCC_S_TALKING_S)//held->active

         {

             SLIC_Start_PCM();

@@ -1505,6 +1506,7 @@
         memcpy(g_Cc_CallDetail.number, num, ZDIAL_NUM_MAX);

         break;

     case 6://Z_MMIACC_CALL_STATE_END

+        cfg_set("voice_status", "");

     	zCcApp_Vts_CleanReq();

     	if(zCc_findCID_by_number(num)==0)

     		break;

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 f4884db..abd28f9 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,45 @@
 	return -1;
 }
 
+static void mmi_set_battery_voice_process(SINT32 voltagepower)
+{
+	char battery_voice_voltage[8] = {0};
+	char voice_status[8] = {0};
+	static int kill_flag = 0;
+
+	cfg_get_item("battery_voice_voltage", battery_voice_voltage, sizeof(battery_voice_voltage));
+	cfg_get_item("voice_status", voice_status, sizeof(voice_status));
+	
+	if(0 == strcmp(voice_status, "active"))
+	{
+		return;
+	}
+	
+	if(mmi_read_usb_insert_status())
+	{
+		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
+		}
+	}
+	else
+	{
+		if(0 == kill_flag)
+		{
+			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
+			}
+		}
+	}
+
+	return;
+}
+
 /**********************************************************************************
 *º¯Êý˵Ã÷£ºµçѹÂÖѯ¶¨Ê±Æ÷»Øµ÷º¯Êýÿ20Ãë¶ÁÒ»´Îµçѹ
  ***********************************************************************************/
@@ -538,6 +577,8 @@
 				}
 			}
 		}
+		mmi_set_battery_voice_process(voltagepower);
+
 		set_wake_unlock(MMI_GET_POWER_LOCK_ID);
 		mmi_sleep(CHECK_POWER_TIME_INTERVAL);
 	}
diff --git a/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_common.h b/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_common.h
index cb0074d..9ede874 100755
--- a/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_common.h
+++ b/lynq/S300AI/ap/app/zte_comm/zte_mmi/mmi_common.h
@@ -1300,7 +1300,7 @@
 SINT32 zMMI_Handle_Msg_Atest_Key(VOID *data);
 SINT32 zMMI_Handle_Msg_Atest_Chg(VOID *data);
 SINT32 mmi_file_operate(char *filepath, char *buf);
-
+BOOL mmi_read_usb_insert_status(VOID);
 
 
 
diff --git a/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user b/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user
index 36d785d..4ade36f 100755
--- a/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user
+++ b/lynq/S300AI/ap/project/zx297520v3/prj_cpe/fs/normal/rootfs/etc_ro/default/default_parameter_user
@@ -557,4 +557,4 @@
 call_csp_number=
 #for voice end
 wifi_switch_status=
-battery_voice_voltage=0
+battery_voice_voltage=3600