Minor fix isSimActivate() 51/76351/1
authorOleksander Kostenko <o.kostenko@samsung.com>
Thu, 23 Jun 2016 12:10:34 +0000 (15:10 +0300)
committerOleksandr Kostenko <o.kostenko@samsung.com>
Thu, 23 Jun 2016 12:17:14 +0000 (05:17 -0700)
Change-Id: I52f9b4bc11409e4c2b9d11543088b5882c44210b
Signed-off-by: Oleksander Kostenko <o.kostenko@samsung.com>
src/Common/MsgEngine/src/private/MsgStoragePrivate.cpp
src/Common/MsgEngine/src/private/MsgStoragePrivate.h
src/Common/SystemSettingsManager/inc/SystemSettingsManager.h
src/Common/SystemSettingsManager/src/SystemSettingsManager.cpp

index 1965c41..05051b2 100644 (file)
@@ -79,28 +79,6 @@ void MsgStoragePrivate::msg_storage_change_cb(msg_handle_t handle, msg_storage_c
     }
 }
 
-bool MsgStoragePrivate::isSimActive() const
-{
-    bool res = false;
-    telephony_handle_list_s tel_handle_list;
-    if(telephony_init(&tel_handle_list) == TELEPHONY_ERROR_NONE)
-    {
-        if(tel_handle_list.count > 0)
-        {
-            telephony_h tel_handle = tel_handle_list.handle[0];
-            telephony_network_service_state_e serv_state;
-            if(telephony_network_get_service_state(tel_handle, &serv_state) == TELEPHONY_ERROR_NONE)
-            {
-                res = (serv_state == TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE);
-                MSG_LOG("serv_state = ", serv_state);
-            }
-        }
-        telephony_deinit(&tel_handle_list);
-    }
-
-    return res;
-}
-
 MsgStoragePrivate::~MsgStoragePrivate()
 {
 }
@@ -136,13 +114,6 @@ MessageSMSListRef MsgStoragePrivate::getSimMsgList()
     msg_set_int_value(listCond, MSG_LIST_CONDITION_SIM_INDEX_INT, 1);
     msg_set_int_value(listCond, MSG_LIST_CONDITION_STORAGE_ID_INT, MSG_STORAGE_SIM);
 
-    if(!isSimActive())
-    {
-        MSG_LOG_ERROR("SIM_CARD_IS_NOT_ACTIVE!");
-        msg_release_struct(&listCond);
-        return nullptr;
-    }
-
     if(msg_get_message_list2(m_ServiceHandle, listCond, &msgList) == 0)
     {
         res.reset(new SmsStructListPrivate(true, msgList));
index 8d05bd5..a21cc13 100644 (file)
@@ -77,7 +77,6 @@ namespace Msg
             static void msg_storage_change_cb(msg_handle_t handle, msg_storage_change_type_t storageChangeType, msg_id_list_s *pMsgIdList, void *user_param);
 
             MessageSMS *createSms();
-            bool isSimActive() const;
 
         private:
             msg_handle_t m_ServiceHandle;
index 21833ae..94b8939 100644 (file)
@@ -33,6 +33,7 @@ namespace Msg
             void addListener(ISystemSettingsManager &l);
             void removeListener(ISystemSettingsManager&l);
             bool isSimInserted() const;
+            bool isSimActive() const;
             bool isMobileDataEnabled() const;
 
         private:
index 7c59ae8..c174b7e 100644 (file)
@@ -73,6 +73,24 @@ bool SystemSettingsManager::isSimInserted() const
     return res;
 }
 
+bool SystemSettingsManager::isSimActive() const
+{
+    bool res = false;
+
+    if(m_TelHandleList.count > 0)
+    {
+        telephony_h telHandle = m_TelHandleList.handle[0];
+        telephony_network_service_state_e servState;
+        if(telephony_network_get_service_state(telHandle, &servState) == TELEPHONY_ERROR_NONE)
+        {
+            res = (servState == TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE);
+            MSG_LOG("servState = ", servState);
+        }
+    }
+
+    return res;
+}
+
 bool SystemSettingsManager::isMobileDataEnabled() const
 {
     bool res = false;