From 1fe3eb31924351ae546e671a9904bd0f114ba8e7 Mon Sep 17 00:00:00 2001 From: kamaljeet Date: Tue, 26 Jun 2018 15:41:50 +0530 Subject: [PATCH] Changes for Signal NeedCleanup Change-Id: If1110fc89432c73b51a5f0ce5412c57d8e0643ba Signed-off-by: kamaljeet --- framework/storage-handler/MsgStorageMessage.cpp | 9 +++++++-- plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp | 19 +++++++++++++------ plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp | 5 +++++ plugin/sms_plugin/SmsPluginMain.cpp | 18 ++++++++++++------ plugin/sms_plugin/SmsPluginStorage.cpp | 5 +++++ 5 files changed, 42 insertions(+), 14 deletions(-) diff --git a/framework/storage-handler/MsgStorageMessage.cpp b/framework/storage-handler/MsgStorageMessage.cpp index e5e9ce4..c3dcf2b 100755 --- a/framework/storage-handler/MsgStorageMessage.cpp +++ b/framework/storage-handler/MsgStorageMessage.cpp @@ -1055,6 +1055,11 @@ msg_error_t MsgStoDeleteMessage(msg_message_id_t msgId, bool bCheckIndication) MSG_DEBUG("Set Memory Status"); plg->setMemoryStatus(simIndex, MSG_SUCCESS); + } else if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_ERR_MESSAGE_COUNT_FULL) { + MSG_DEBUG("Set Memory Status"); + plg->setMemoryStatus(simIndex, MSG_ERR_MESSAGE_COUNT_FULL); + } else { + MSG_DEBUG("Storage event error :Failed to get space info "); } } @@ -3236,8 +3241,8 @@ msg_error_t MsgStoUpdateIMSI(int sim_idx) msg_error_t MsgStoAllowTcsMessage(msg_message_id_t msgId) { MSG_BEGIN(); - MSG_MESSAGE_INFO_S msgInfo = {0,}; - MSG_SENDINGOPT_INFO_S sendOptInfo = {0,}; + MSG_MESSAGE_INFO_S msgInfo = {0, }; + MSG_SENDINGOPT_INFO_S sendOptInfo = {0, }; msg_error_t err = MSG_SUCCESS; err = MsgStoGetMessage(msgId, &msgInfo, &sendOptInfo); diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp index 030f3b1..a2f7adb 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginMain.cpp @@ -29,6 +29,8 @@ #include "SmsCdmaPluginSetting.h" #include "SmsCdmaPluginMain.h" #include +#include + extern "C" { @@ -42,7 +44,10 @@ extern "C" #define BUS_NAME "org.tizen.system.storage" #define PATH_NAME "/Org/Tizen/System/Storage/Lowmem" #define INTERFACE_NAME BUS_NAME".lowmem" -#define MEMBER_NAME "Full" +#define MEMBER_NAME "NeedCleanup" +#define SIGNAL_VAL "Full" + + struct tapi_handle *pTapiHandle = NULL; bool isMemAvailable = true; @@ -322,11 +327,13 @@ static void on_change_received(GDBusConnection *connection, const gchar *sender_ MSG_DEBUG("signal_name = [%s]", signal_name); if (g_strcmp0(signal_name, MEMBER_NAME) == 0) { - gint memStatus; - g_variant_get(parameters, "(i)", &memStatus); - MSG_DEBUG("memStatus = [%d]", memStatus); - if (memStatus == 0) { - SmsPlgSetMemoryStatus(MSG_SUCCESS); + gchar *str_val = NULL; + gint path; + g_variant_get(parameters, "(is)", &path, &str_val); + MSG_DEBUG("path = [%i] and str_val = [%s]", path , str_val); + if (path == TZ_SYS_USER && g_strcmp0(str_val, SIGNAL_VAL) == 0) + { + SmsPlgSetMemoryStatus(MSG_ERR_SIM_STORAGE_FULL); } } } diff --git a/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp b/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp index c573434..7f1d9ee 100755 --- a/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp +++ b/plugin/sms_cdma_plugin/SmsCdmaPluginStorage.cpp @@ -470,6 +470,11 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId) if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_SUCCESS) { MSG_DEBUG("Set Memory Status"); SmsPlgSetMemoryStatus(MSG_SUCCESS); + } else if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_ERR_MESSAGE_COUNT_FULL) { + MSG_DEBUG("Set Memory Status"); + SmsPlgSetMemoryStatus(MSG_ERR_MESSAGE_COUNT_FULL); + } else { + MSG_DEBUG("Storage event error :Failed to get space info "); } } diff --git a/plugin/sms_plugin/SmsPluginMain.cpp b/plugin/sms_plugin/SmsPluginMain.cpp index 5b09f72..768f90f 100755 --- a/plugin/sms_plugin/SmsPluginMain.cpp +++ b/plugin/sms_plugin/SmsPluginMain.cpp @@ -31,6 +31,8 @@ #include "SmsPluginMain.h" #include "SmsPluginDSHandler.h" #include +#include + extern "C" { #include @@ -43,7 +45,9 @@ extern "C" { #define BUS_NAME "org.tizen.system.storage" #define PATH_NAME "/Org/Tizen/System/Storage/Lowmem" #define INTERFACE_NAME BUS_NAME".lowmem" -#define MEMBER_NAME "Full" +#define MEMBER_NAME "NeedCleanup" +#define SIGNAL_VAL "Full" + GDBusConnection *gdbus_conn = NULL; GDBusProxy *gdbus_proxy = NULL; @@ -459,14 +463,16 @@ static void on_change_received(GDBusConnection *connection, const gchar *sender_ MSG_DEBUG("signal_name = [%s]", signal_name); if (g_strcmp0(signal_name, MEMBER_NAME) == 0) { - gint memStatus; - g_variant_get(parameters, "(i)", &memStatus); - MSG_DEBUG("memStatus = [%d]", memStatus); - if (memStatus == 0) { + gchar *str_val = NULL; + gint path; + g_variant_get(parameters, "(is)", &path, &str_val); + MSG_DEBUG("path = [%i] and str_val = [%s]", path , str_val); + if (path == TZ_SYS_USER && g_strcmp0(str_val, SIGNAL_VAL) == 0) + { int sim_count = SmsPluginDSHandler::instance()->getTelHandleCount(); for (int i = 0; i < sim_count; i++) { - SmsPlgSetMemoryStatus(i, MSG_SUCCESS); + SmsPlgSetMemoryStatus(i, MSG_ERR_SIM_STORAGE_FULL); } } } diff --git a/plugin/sms_plugin/SmsPluginStorage.cpp b/plugin/sms_plugin/SmsPluginStorage.cpp index 466f4ed..9fc7fb5 100755 --- a/plugin/sms_plugin/SmsPluginStorage.cpp +++ b/plugin/sms_plugin/SmsPluginStorage.cpp @@ -665,6 +665,11 @@ msg_error_t SmsPluginStorage::deleteSmsMessage(msg_message_id_t msgId) if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_SUCCESS) { MSG_DEBUG("Set Memory Status"); SmsPlgSetMemoryStatus(simIndex, MSG_SUCCESS); + } else if (MsgStoCheckMsgCntFull(dbHandle, &msgType, folderId) == MSG_ERR_MESSAGE_COUNT_FULL) { + MSG_DEBUG("Set Memory Status"); + SmsPlgSetMemoryStatus(simIndex, MSG_ERR_MESSAGE_COUNT_FULL); + } else { + MSG_DEBUG("Storage event error :Failed to get space info "); } } -- 2.7.4