[Bugfix][T108][bug-view-2354]Fix device band changed

            Only Configure: No
            Affected branch: mbtk_source_ds
            Affected module: system
            Is it affected on IC: only ASR
            Self-test: yes
            Doc Update: no

Change-Id: I5cb00c61411dbde81461b1606a31ab2aa45377a2
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index 180e932..1c55e2c 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -2917,6 +2917,32 @@
     return NULL;
 }

 

+static int check_device_info(void)
+{
+    mbtk_device_info_basic_t info_basic;
+    memset(&info_basic,0,sizeof(mbtk_device_info_basic_t));
+    int result = mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_BASIC, &info_basic, sizeof(mbtk_device_info_basic_t));
+    if(result != 0)
+    {
+        LOGE("mbtk_dev_info_read(BASIC) fail. reset \n");
+	return -1;
+    }
+    return 0;
+}
+
+static int config_file_exists(void)
+{
+    ATResponse *response = NULL;
+
+    int err = at_send_command(portType_2_portId(MBTK_SIM_1, ATPORTTYPE_0), "AT*MRD_CDF=Q,TTPCom_NRAM2_CUSTOMIZATION_DATA.gki", &response);
+    if(err < 0 || response->success == 0)
+    {
+        LOGD("config_file gki check fail \n");
+        return 0;
+    }
+    return -1;
+}
+
 static void band_support_init()

 {

     mbtk_device_info_modem_t info_modem;

@@ -3049,7 +3075,7 @@
 
 OK
 */
-/*
+
 static void* band_config_thread()
 {
     band_info.band_set_success = FALSE;

@@ -3083,7 +3109,7 @@
     LOGD("Set Band thread exit.");
     return NULL;
 }
-*/
+
 

 

 int ril_server_start()

@@ -3096,10 +3122,15 @@
 
     //check cfun and sim card status
     ril_at_ready_process();
-

+
+    // check device info
+    int check_res = check_device_info();
+
+    // check gki config 
+    int file_res = config_file_exists();
+
     // Init support band.

     band_support_init();

-
     //any AT instruction that is not sent through pack_process_thread needs to precede the thread
     //thread create
     if(ril_info.sock_listen_fd > 0)

@@ -3201,8 +3232,8 @@
     char buff[10];
     memset(buff, 0, 10);
     property_get("persist.mbtk.band_config", buff, "");
-    /*
-    if(strlen(buff) == 0) {
+    
+    if(strlen(buff) == 0 && check_res == 0 && file_res == 0) {
         pthread_t band_pid;
         if(pthread_create(&band_pid, &thread_attr, band_config_thread, NULL))
         {
@@ -3211,8 +3242,6 @@
     }
 
     pthread_attr_destroy(&thread_attr);

-    */
-

     if(asr_auto_data_call_enable()) {

         ril_cid_start = MBTK_RIL_CID_2;