gengxin
authorCCC <2393524978@qq.com>
Tue, 28 Nov 2023 08:53:26 +0000 (16:53 +0800)
committerCCC <2393524978@qq.com>
Tue, 28 Nov 2023 08:53:26 +0000 (16:53 +0800)
2.sdk/sdk/gui/lv_watch/lv_apps/sos/sos.c

index f661e18..ea41ec8 100644 (file)
@@ -76,10 +76,12 @@ static void set_sos_status(uint8_t state)
 
 void sos_destory(void)
 {
-    if(SOS_GIF_ON == get_sos_status()) 
+       lv_obj_t * activity_obj = lv_watch_get_activity_obj(ACT_ID_SOS);
+    if(SOS_GIF_ON == get_sos_status() && (NULL != activity_obj)) 
        {
         lv_watch_png_cache_all_free();
-        lv_sos_ext_t * ext = lv_obj_get_ext_attr(lv_watch_get_activity_obj(ACT_ID_SOS));
+        //lv_sos_ext_t * ext = lv_obj_get_ext_attr(lv_watch_get_activity_obj(ACT_ID_SOS));
+        lv_sos_ext_t * ext = lv_obj_get_ext_attr(activity_obj);
         gif_close(ext->gif_info);
         ext->gif_info = NULL;
         lv_task_del(ext->gif_task_p);
@@ -233,50 +235,43 @@ lv_obj_t * sos_create(lv_obj_t * activity_obj)
 
 lv_res_t mmi_key_back_sos_btn_action(void)
 {
-#ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
-       if(true == mmi_watch_is_in_do_not_disturb_time())
+       if(false == watch_modem_sim_present_check_req())
        {
-               return LV_RES_OK;
-       }
-#endif
+               printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               return LV_RES_INV;
+       } 
 
-       lv_obj_t * phone_obj = lv_watch_get_activity_obj(ACT_ID_PHONE);
-       if(phone_obj) 
+    if(true == mmi_active_screen_is_prohibit_interrupted()
+               #ifdef __MMI_ZHSX_SUPPORT_DO_NOT_DISTURB__
+               || true == mmi_watch_is_in_do_not_disturb_time()
+               #endif
+               )
        {
-               /* don't process sos or shutdown */
-               return LV_RES_OK;
+               return LV_RES_INV;
        }
 
-       if(false == watch_modem_sim_present_check_req())
+       lv_watch_go_home();
+       //lv_watch_png_cache_all_free();
+
+       if(true == mmi_sos_number_is_empty())
        {
                printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-               //shutdown_create_btn_action(NULL,LV_EVENT_CLICKED);
-       } 
-       else 
+               sos_no_contacts_create(NULL);
+    }
+       else
        {
-               lv_watch_go_home();
-               lv_watch_png_cache_all_free();
-
-               if(true == mmi_sos_number_is_empty())
+               if(true == mmi_watch_tcp_connect_state_get()
+                       && true == mmi_protocol_watch_bind_state_get()
+                       )
                {
                        printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-                       sos_no_contacts_create(NULL);
-           }
-               else
-               {
-                       if(true == mmi_watch_tcp_connect_state_get()
-                               && true == mmi_protocol_watch_bind_state_get()
-                               )
-                       {
-                               printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-                               mmi_protocol_action_sos();
-                       }
-
-                       printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
-                       lv_obj_t * obj = sos_create(NULL);
-                       if(obj == NULL) 
-                               return LV_RES_OK;
+                       mmi_protocol_action_sos();
                }
+
+               printf("[@CHENG_DEBUG][%s][%d]: \n", __FUNCTION__, __LINE__);
+               lv_obj_t * obj = sos_create(NULL);
+               if(obj == NULL) 
+                       return LV_RES_INV;
        }
 
        return LV_RES_OK;