fixed a defect not to be shown the package list in the privacy-setting 00/90600/4 accepted/tizen/3.0/mobile/20161015.034230 accepted/tizen/common/20161003.062643 accepted/tizen/mobile/20161005.080032 submit/tizen/20161001.075614 submit/tizen_3.0_mobile/20161015.000006
authorKyoungyong Lee <k.y.lee@samsung.com>
Sat, 1 Oct 2016 07:26:46 +0000 (16:26 +0900)
committerKyoungyong Lee <k.y.lee@samsung.com>
Sat, 1 Oct 2016 07:49:27 +0000 (16:49 +0900)
Change-Id: I770d04d4895c1f3f99210611ca42f23fb512d990

19 files changed:
client/src/PrivacyChecker.cpp [changed mode: 0755->0644]
client/src/PrivacyGuardClient.cpp [changed mode: 0755->0644]
client/src/SocketClient.cpp [changed mode: 0755->0644]
client/src/privacy_guard_client.cpp [changed mode: 0755->0644]
client/src/privacy_guard_client_internal_types.h [changed mode: 0755->0644]
common/inc/IPrivacyGuard.h [changed mode: 0755->0644]
common/inc/PrivacyGuardCommon.h [changed mode: 0755->0644]
common/inc/PrivacyGuardTypes.h [changed mode: 0755->0644]
common/inc/PrivacyIdInfo.h [changed mode: 0755->0644]
common/inc/SocketConnection.h [changed mode: 0755->0644]
common/inc/SocketStream.h [changed mode: 0755->0644]
common/inc/Utils.h [changed mode: 0755->0644]
server/src/CynaraService.cpp [changed mode: 0755->0644]
server/src/NotificationServer.cpp [changed mode: 0755->0644]
server/src/PrivacyGuardDaemon.cpp [changed mode: 0755->0644]
server/src/PrivacyGuardDb.cpp [changed mode: 0755->0644]
server/src/SocketService.cpp [changed mode: 0755->0644]
server/src/main.cpp [changed mode: 0755->0644]
server/src/privacy_guard_daemon.cpp [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index 5e04ee5..43b433a
@@ -152,6 +152,7 @@ int
 PrivacyChecker::checkMonitorPolicyWithPrivilege(const int userId, const std::string packageId, const std::string privilegeId, std::string &privacyId, int &monitorPolicy)
 {
        checkMonitorByPrivilege(privilegeId);
+
        if (m_isMonitorEnable == true) {
                int res = PrivacyIdInfo::getPrivacyIdFromPrivilege(privilegeId, privacyId);
                TryReturn(res == PRIV_GUARD_ERROR_SUCCESS, res, , "getPrivacyIdFromPrivilege : %d", res);
@@ -166,6 +167,7 @@ void*
 PrivacyChecker::runSignalListenerThread(void* pData)
 {
        pthread_detach(pthread_self());
+
        PG_LOGI("Running g main loop for signal");
 
        initializeDbus();
old mode 100755 (executable)
new mode 100644 (file)
index f7d7b59..f3e2e2a
@@ -150,9 +150,8 @@ PrivacyGuardClient::PgAddMonitorPolicy(const int userId, const std::string pkgId
 
        res = m_pSocketClient->connect();
        if(res != PRIV_GUARD_ERROR_SUCCESS) {
+               PG_LOGD("Cannot connect to the socket. So change to the offline mode");
                isServerOperation = false;
-               PG_LOGE("connect : %d", res);
-               PG_LOGD("Failed to connect. So change to the offline mode");
        } else {
                isServerOperation = true;
        }
old mode 100755 (executable)
new mode 100644 (file)
index 84a3b53..542e3f7
@@ -72,6 +72,7 @@ int SocketClient::disconnect()
        //Socket should be already closed by server side,
        //even though we should close it in case of any errors
        close(m_socketFd);
+
        PG_LOGI("Client disconnected");
 
        return PRIV_GUARD_ERROR_SUCCESS;
old mode 100755 (executable)
new mode 100644 (file)
index 4831429..734ac43
@@ -343,7 +343,6 @@ int privacy_guard_client_foreach_privacy_package_id(const int user_id, privacy_g
                return retval;
        }
 
-
        if (packageList.size() == 0)
                return PRIV_GUARD_ERROR_NO_DATA;
 
old mode 100755 (executable)
new mode 100644 (file)
index ce59c3b..7d70705
@@ -28,5 +28,4 @@ extern "C" {
 }
 #endif
 
-
 #endif //_PRIVACY_GUARD_CLIENT_INTERNAL_TYPES_H_
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 4d3b51b..1d85a85
@@ -14,8 +14,8 @@
  *    limitations under the License.
  */
 
-#ifndef _IPRIVACYGUARD_H_
-#define _IPRIVACYGUARD_H_
+#ifndef _IPRIVACY_GUARD_H_
+#define _IPRIVACY_GUARD_H_
 
 #include <string>
 #include <mutex>
@@ -40,4 +40,4 @@ public:
        int getAppPackagePrivacyInfo(const std::string pkgId, std::list < std::pair <std::string, bool > > & pList);
 };
 
-#endif // _IPRIVACYGUARD_H_
\ No newline at end of file
+#endif // _IPRIVACY_GUARD_H_
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 97a5067..3fea18d
@@ -21,4 +21,4 @@
 #include <db-util.h>
 #include <stdbool.h>
 
-#endif // PRIVACYGUARDCOMMON_H_
+#endif // _PRIVACY_GUARD_COMMON_H_
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index cb42e05..b7a6cec
 #define CYNARA_BUFFER_SIZE 100
 #define USER_APP_PREFIX "User::App::"
 #define USER_APP_PREFIX_LEN 11
-#define GLOBAL_APP_USER_ID 0
 #define USER_PKG_PREFIX "User::Pkg::"
 #define USER_PKG_PREFIX_LEN 11
-#define ROOT_USER_ID 0
 #define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
 
 typedef struct _privacy_data_s {
old mode 100755 (executable)
new mode 100644 (file)
index fe414e8..0584bbf
@@ -34,9 +34,6 @@ public:
        static int getPrivacyIdListFromPrivilegeList(const std::list< std::string > privilegeList, std::list< std::string >& privacyIdList);
        static bool isValidPrivacyId(const std::string privacyId);
        static int getAllPrivacyId(std::list< std::string >& privacyIdList);
-       //static int getPrivaycDisplayName(const std::string privacyId, std::string& displayName);
-       //static int getPrivaycDescription(const std::string privacyId, std::string& description);
-       //static int isFeatureEnabled(const char* feature, bool& enabled);
 };
 
-#endif //_PRIVACYIDINFO_H_
+#endif //_PRIVACYIDINFO_H_
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 5e24bb5..b1bd880
@@ -39,7 +39,6 @@ class EXTERN_API SocketConnection
 {
 
 public:
-
        explicit SocketConnection(int socket_fd) : m_socketStream(socket_fd){
                PG_LOGI("Created");
        }
@@ -440,7 +439,6 @@ public:
                return write(*pList);
        }
 
-
 private:
        SocketStream m_socketStream;
 };
old mode 100755 (executable)
new mode 100644 (file)
index 0f6b53c..460d6b6
@@ -33,6 +33,7 @@ public:
 
        int readStream(size_t num, void * bytes);
        int writeStream(size_t num, const void * bytes);
+
 private:
        int throwWithErrnoMessage(std::string specificInfo);
        int m_socketFd;
old mode 100755 (executable)
new mode 100644 (file)
index 4082012..c50c85c
@@ -56,7 +56,6 @@
 
 //////////////////////////////////////////////////////////////////////////
 
-
 #define IF_MATCH_RET_ERROR(condition, msgFormat, error)        \
        if (condition) { \
                PG_LOGE(msgFormat, error); \
@@ -129,4 +128,5 @@ class Utils
 public:
        static std::string toHash (std::string src);
 };
+
 #endif //_UTILS_H_
old mode 100755 (executable)
new mode 100644 (file)
index 12601c1..19db318
@@ -306,7 +306,7 @@ CynaraService::updateDb(cynara_monitor_entry **monitor_entries)
                                        PG_LOGE("Failed to do pkgmgrinfo_pkginfo_is_global [%d]", res);
                                } else {
                                        if (is_global == true) {
-                                               userId = GLOBAL_APP_USER_ID;
+                                               userId = GLOBAL_USER;
                                        }
                                }
                                pkgmgrinfo_pkginfo_destroy_pkginfo(pkg_handle);
old mode 100755 (executable)
new mode 100644 (file)
index 04fc883..f4a0c1c
@@ -60,6 +60,7 @@ NotificationServer::initialize(void)
        TryReturn(!dbus_error_is_set(&error), PRIV_GUARD_ERROR_SYSTEM_ERROR, dbus_error_free(&error), "dbus_bus_add_match : %s", error.message);
 
        m_initialized = true;
+
        return PRIV_GUARD_ERROR_SUCCESS;
 }
 
old mode 100755 (executable)
new mode 100644 (file)
index c57e38d..84b56e5
@@ -18,7 +18,6 @@
 #include "PrivacyGuardDaemon.h"
 #include "PrivacyInfoService.h"
 #include "SocketService.h"
-// [CYNARA]
 #include <CynaraService.h>
 
 PrivacyGuardDaemon* PrivacyGuardDaemon::pInstance = NULL;
@@ -56,7 +55,6 @@ PrivacyGuardDaemon::initialize(void)
        PG_LOGD("calling PrivacyInfoService::registerCallbacks(pSocketService)");
        PrivacyInfoService::registerCallbacks(pSocketService);
 
-       // [CYNARA]
        if (pCynaraService == NULL)
                pCynaraService = new CynaraService();
 
@@ -79,7 +77,6 @@ PrivacyGuardDaemon::start(void)
                PG_LOGE("FAIL");
        }
 
-       // [CYNARA]
        PG_LOGD("calling pCynaraService->start()");
        if (pCynaraService == NULL)
                return PRIV_GUARD_ERROR_NOT_INITIALIZED;
old mode 100755 (executable)
new mode 100644 (file)
index af86fb0..0fcdc79
@@ -27,6 +27,7 @@
 
 #define PRIVACY_GUARD_DAYS 7
 #define UNIX_TIME_ONE_DAY (24 * 60 * 60) // 86400 secs
+#define BUF_SIZE 256
 
 std::mutex PrivacyGuardDb::m_singletonMutex;
 PrivacyGuardDb* PrivacyGuardDb::m_pInstance = NULL;
@@ -73,7 +74,7 @@ PrivacyGuardDb::openSqliteDB(void)
        res = sqlite3_open_v2(PRIVACY_DB_PATH, &m_sqlHandler, SQLITE_OPEN_READWRITE, NULL);
        if(res == SQLITE_OK) {
                PG_LOGI("monitor db is opened successfully");
-//             sqlite3_wal_autocheckpoint(m_sqlHandler, 1);
+               //sqlite3_wal_autocheckpoint(m_sqlHandler, 1);
                m_bDBOpen = true;
        }
        else {
@@ -198,7 +199,10 @@ int
 PrivacyGuardDb::PgCheckPrivacyPackage(const int userId, const std::string packageId, bool &isPrivacyPackage)
 {
        int res = -1;
-       static const std::string query = std::string("SELECT COUNT(*) FROM MonitorPolicy WHERE USER_ID=? AND PKG_ID=?");
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "SELECT COUNT(*) FROM MonitorPolicy WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=?", GLOBAL_USER);
+       static const std::string query = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -371,6 +375,8 @@ int
 PrivacyGuardDb::PgForeachTotalPrivacyCountOfPackage(const int userId, const int startDate, const int endDate, std::list < std::pair < std::string, int > >& packageInfoList)
 {
        int res = -1;
+       char buf[BUF_SIZE];
+       sqlite3_stmt* infoStmt;
 
        // [CYNARA] Flush Entries
        res = cynara_monitor_entries_flush(p_cynara_monitor);
@@ -382,9 +388,11 @@ PrivacyGuardDb::PgForeachTotalPrivacyCountOfPackage(const int userId, const int
                }
        }
 
-       static const std::string PKGID_SELECT = std::string("SELECT DISTINCT PKG_ID FROM StatisticsMonitorInfo WHERE USER_ID=? AND USE_DATE>=? AND USE_DATE<=?");
-       static const std::string PKGINFO_SELECT = std::string("SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE USER_ID=? AND PKG_ID=? AND USE_DATE>=? AND USE_DATE<=?");
-       sqlite3_stmt* infoStmt;
+       snprintf(buf, BUF_SIZE, "SELECT DISTINCT PKG_ID FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=%d) AND USE_DATE>=? AND USE_DATE<=?", GLOBAL_USER);
+       static const std::string PKGID_SELECT = std::string(buf);
+
+       snprintf(buf, BUF_SIZE, "SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=? AND USE_DATE>=? AND USE_DATE<=?", GLOBAL_USER);
+       static const std::string PKGINFO_SELECT = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -448,10 +456,10 @@ PrivacyGuardDb::PgForeachTotalPrivacyCountOfPackage(const int userId, const int
 }
 
 int
-PrivacyGuardDb::PgForeachTotalPrivacyCountOfPrivacy(const int userId, const int startDate, const int endDate,
-               std::list < std::pair < std::string, int > >& privacyInfoList)
+PrivacyGuardDb::PgForeachTotalPrivacyCountOfPrivacy(const int userId, const int startDate, const int endDate, std::list < std::pair < std::string, int > >& privacyInfoList)
 {
        int res = -1;
+       char buf[BUF_SIZE];
 
        // [CYNARA] Flush Entries
        res = cynara_monitor_entries_flush(p_cynara_monitor);
@@ -463,7 +471,8 @@ PrivacyGuardDb::PgForeachTotalPrivacyCountOfPrivacy(const int userId, const int
                }
        }
 
-       static const std::string PRIVACY_SELECT = std::string("SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE USER_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?");
+       snprintf(buf, BUF_SIZE, "SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=%d) AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?", GLOBAL_USER);
+       static const std::string PRIVACY_SELECT = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -520,6 +529,8 @@ PrivacyGuardDb::PgForeachPrivacyCountByPrivacyId(const int userId, const int sta
                const std::string privacyId, std::list < std::pair < std::string, int > >& packageInfoList)
 {
        int res = -1;
+       sqlite3_stmt* infoStmt;
+       char buf[BUF_SIZE];
 
        // [CYNARA] Flush Entries
        res = cynara_monitor_entries_flush(p_cynara_monitor);
@@ -531,9 +542,11 @@ PrivacyGuardDb::PgForeachPrivacyCountByPrivacyId(const int userId, const int sta
                }
        }
 
-       static const std::string PKGID_SELECT = std::string("SELECT DISTINCT PKG_ID FROM StatisticsMonitorInfo WHERE USER_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?");
-       static const std::string PKGINFO_SELECT = std::string("SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE USER_ID=? AND PKG_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?");
-       sqlite3_stmt* infoStmt;
+       snprintf(buf, BUF_SIZE, "SELECT DISTINCT PKG_ID FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=%d) AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?", GLOBAL_USER);
+       static const std::string PKGID_SELECT = std::string(buf);
+
+       snprintf(buf, BUF_SIZE, "SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?", GLOBAL_USER);
+       static const std::string PKGINFO_SELECT = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -609,6 +622,7 @@ PrivacyGuardDb::PgForeachPrivacyCountByPackageId(const int userId, const int sta
                const std::string packageId, std::list < std::pair < std::string, int > >& privacyInfoList)
 {
        int res = -1;
+       char buf[BUF_SIZE];
 
        // [CYNARA] Flush Entries
        res = cynara_monitor_entries_flush(p_cynara_monitor);
@@ -620,7 +634,8 @@ PrivacyGuardDb::PgForeachPrivacyCountByPackageId(const int userId, const int sta
                }
        }
 
-       static const std::string PRIVACY_SELECT = std::string("SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE USER_ID=? AND PKG_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?");
+       snprintf(buf, BUF_SIZE, "SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?", GLOBAL_USER);
+       static const std::string PRIVACY_SELECT = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -679,7 +694,10 @@ PrivacyGuardDb::PgGetMonitorPolicy(const int userId, const std::string packageId
 {
 
        int res = -1;
-       static const std::string query = std::string("SELECT MONITOR_POLICY FROM MonitorPolicy WHERE USER_ID=? AND PKG_ID=? AND PRIVACY_ID=?");
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "SELECT MONITOR_POLICY FROM MonitorPolicy WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=? AND PRIVACY_ID=?", GLOBAL_USER);
+       static const std::string query = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -776,7 +794,10 @@ int
 PrivacyGuardDb::PgForeachMonitorPolicyByPackageId(const int userId, const std::string packageId, std::list <privacy_data_s>& privacyInfoList)
 {
        int res = -1;
-       static const std::string query = std::string("SELECT DISTINCT PRIVACY_ID, MONITOR_POLICY FROM MonitorPolicy WHERE USER_ID=? AND PKG_ID=?");
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "SELECT DISTINCT PRIVACY_ID, MONITOR_POLICY FROM MonitorPolicy WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=?", GLOBAL_USER);
+       static const std::string query = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -825,7 +846,10 @@ int
 PrivacyGuardDb::PgForeachPrivacyPackageId(const int userId, std::list < std::string > &packageList)
 {
        int res = -1;
-       static const std::string query = std::string("SELECT DISTINCT PKG_ID FROM MonitorPolicy WHERE USER_ID=?");
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "SELECT DISTINCT PKG_ID FROM MonitorPolicy WHERE (USER_ID=? OR USER_ID=%d)", GLOBAL_USER);
+       static const std::string query = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -866,11 +890,16 @@ int
 PrivacyGuardDb::PgForeachPackageInfoByPrivacyId(const int userId, const std::string privacyId, std::list < package_data_s > &packageInfoList)
 {
        int res = -1;
-       static const std::string query = std::string("SELECT DISTINCT PKG_ID, MONITOR_POLICY FROM MonitorPolicy WHERE (USER_ID=? OR USER_ID=0) AND PRIVACY_ID=?");
-       static const std::string PKGINFO_SELECT = std::string("SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=0) AND PKG_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?");
        sqlite3_stmt* infoStmt;
        time_t start_date, today_midnight, end_date;
        struct tm date;
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "SELECT DISTINCT PKG_ID, MONITOR_POLICY FROM MonitorPolicy WHERE (USER_ID=? OR USER_ID=%d) AND PRIVACY_ID=?", GLOBAL_USER);
+       static const std::string query = std::string(buf);
+
+       snprintf(buf, BUF_SIZE, "SELECT COUNT(*) FROM StatisticsMonitorInfo WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=? AND PRIVACY_ID=? AND USE_DATE>=? AND USE_DATE<=?", GLOBAL_USER);
+       static const std::string PKGINFO_SELECT = std::string(buf);
 
        // get start~end date (for 7 days)
        end_date = time(NULL);
@@ -893,7 +922,6 @@ PrivacyGuardDb::PgForeachPackageInfoByPrivacyId(const int userId, const std::str
                        PG_LOGE("cynara_monitor_entries_flush FAIL [%d]", res);
                }
        }
-
        m_dbMutex.lock();
 
        // initialize
@@ -971,7 +999,10 @@ int
 PrivacyGuardDb::PgUpdateMonitorPolicy(const int userId, const std::string packageId, const std::string privacyId, const int monitorPolicy)
 {
        int res = -1;
-       static const std::string query = std::string("UPDATE MonitorPolicy SET MONITOR_POLICY=? WHERE USER_ID=? AND PKG_ID=? AND PRIVACY_ID=?");
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "UPDATE MonitorPolicy SET MONITOR_POLICY=? WHERE (USER_ID=? OR USER_ID=%d) AND PKG_ID=? AND PRIVACY_ID=?", GLOBAL_USER);
+       static const std::string query = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -1057,7 +1088,10 @@ int
 PrivacyGuardDb::PgUpdateMainMonitorPolicy(const int userId, const bool mainMonitorPolicy)
 {
        int res = -1;
-       static const std::string query = std::string("UPDATE MainMonitorPolicy SET MAIN_MONITOR_POLICY=? WHERE USER_ID=?");
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "UPDATE MainMonitorPolicy SET MAIN_MONITOR_POLICY=? WHERE (USER_ID=? OR USER_ID=%d)", GLOBAL_USER);
+       static const std::string query = std::string(buf);
 
        m_dbMutex.lock();
 
@@ -1101,9 +1135,11 @@ PrivacyGuardDb::PgUpdateMainMonitorPolicy(const int userId, const bool mainMonit
 int
 PrivacyGuardDb::PgGetMainMonitorPolicy(const int userId, bool &mainMonitorPolicy)
 {
-
        int res = -1;
-       static const std::string query = std::string("SELECT MAIN_MONITOR_POLICY FROM MainMonitorPolicy WHERE USER_ID=?");
+       char buf[BUF_SIZE];
+
+       snprintf(buf, BUF_SIZE, "SELECT MAIN_MONITOR_POLICY FROM MainMonitorPolicy WHERE (USER_ID=? OR USER_ID=%d)", GLOBAL_USER);
+       static const std::string query = std::string(buf);
 
        m_dbMutex.lock();
 
old mode 100755 (executable)
new mode 100644 (file)
index 8744ae1..e3cfd90
@@ -39,12 +39,10 @@ SocketService::SocketService(void)
        , m_signalToClose(-1)
        , m_mainThread(-1)
 {
-       //PG_LOGD("SocketService() called.");
 }
 
 SocketService::~SocketService(void)
 {
-       //PG_LOGD("~SocketService() called.");
 }
 
 int
@@ -86,8 +84,6 @@ SocketService::initialize(void)
 int
 SocketService::start(void)
 {
-       //PG_LOGI("SocketService starting");
-
        sigset_t sigset;
        sigemptyset(&sigset);
 //     if ( sigaddset(&sigset, m_signalToClose) == -1 )
@@ -107,19 +103,15 @@ SocketService::start(void)
 
        m_mainThread = mainThread;
 
-       //PG_LOGI("SocketService started");
-
        return PRIV_GUARD_ERROR_SUCCESS;
 }
 
 void*
 SocketService::serverThread(void* pData)
 {
-       //PG_LOGD("serverThread() called.");
        pthread_detach(pthread_self());
        SocketService &t = *static_cast< SocketService* > (pData);
 
-       //PG_LOGD("Running main thread");
        int ret = t.mainloop();
        if (ret < 0) {
                return (void*) 1;
@@ -131,8 +123,6 @@ SocketService::serverThread(void* pData)
 int
 SocketService::mainloop(void)
 {
-       //PG_LOGD("mainloop() called.");
-
        char buf[BUF_SIZE];
 
        if( listen(m_listenFd, MAX_LISTEN) == -1 ){
@@ -226,11 +216,10 @@ SocketService::mainloop(void)
 void*
 SocketService::connectionThread(void* pData)
 {
-       //PG_LOGD("connectionThread() called.");
        pthread_detach(pthread_self());
        std::unique_ptr<ConnectionInfo> connectionInfo (static_cast<ConnectionInfo *>(pData));
        SocketService &t = *static_cast<SocketService *>(connectionInfo->pData);
-       //PG_LOGI("Starting connection thread");
+
        int ret = t.connectionService(connectionInfo->connFd);
        if (ret < 0)
        {
@@ -239,15 +228,12 @@ SocketService::connectionThread(void* pData)
                close(connectionInfo->connFd);
                return (void*)1;
        }
-       //PG_LOGI("Client serviced");
        return (void*)0;
 }
 
 int
 SocketService::connectionService(int fd)
 {
-       //PG_LOGD("connectionService() called.");
-
        SocketConnection connector = SocketConnection(fd);
        std::string interfaceName, methodName;
 
@@ -280,23 +266,17 @@ SocketService::connectionService(int fd)
 //             }
 //     }
 
-       //PG_LOGI("Calling service");
        m_callbackMap[interfaceName][methodName]->serviceCallback(&connector);
 
-       //PG_LOGI("Removing client");
        removeClientSocket(fd);
        close(fd);
 
-       //PG_LOGI("Call served");
-
        return PRIV_GUARD_ERROR_SUCCESS;
 }
 
 int
 SocketService::stop(void)
 {
-       //PG_LOGD("Stopping");
-
        char buf[BUF_SIZE];
 
        if(close(m_listenFd) == -1)
@@ -315,23 +295,18 @@ SocketService::stop(void)
        }
        pthread_join(m_mainThread, NULL);
 
-       //PG_LOGD("Stopped");
-
        return PRIV_GUARD_ERROR_SUCCESS;
 }
 
 int
 SocketService::shutdown(void)
 {
-       //PG_LOGD("called");
        return PRIV_GUARD_ERROR_SUCCESS;
 }
 
 int
 SocketService::registerServiceCallback(const std::string &interfaceName,  const std::string &methodName, socketServiceCallback callbackMethod)
 {
-       //PG_LOGD("called");
-
        if(NULL == callbackMethod)
        {
                PG_LOGE("Null callback");
@@ -352,8 +327,6 @@ SocketService::registerServiceCallback(const std::string &interfaceName,  const
 void
 SocketService::addClientSocket(int clientSocket)
 {
-       //PG_LOGD("called");
-
        std::lock_guard<std::mutex> guard(m_clientSocketListMutex);
        m_clientSocketList.push_back(clientSocket);
 }
@@ -361,8 +334,6 @@ SocketService::addClientSocket(int clientSocket)
 void
 SocketService::removeClientSocket(int clientSocket)
 {
-       //PG_LOGD("called");
-
        std::lock_guard<std::mutex> guard(m_clientSocketListMutex);
        m_clientSocketList.remove(clientSocket);
 }
@@ -370,8 +341,6 @@ SocketService::removeClientSocket(int clientSocket)
 bool
 SocketService::popClientSocket(int * pClientSocket)
 {
-       //PG_LOGD("called");
-
        std::lock_guard<std::mutex> guard(m_clientSocketListMutex);
        if(m_clientSocketList.empty())
                return false;
@@ -384,8 +353,6 @@ SocketService::popClientSocket(int * pClientSocket)
 void
 SocketService::closeConnections(void)
 {
-       //PG_LOGD("called");
-
        int clientSocket;
        char buf[BUF_SIZE];
        PG_LOGI("Closing client sockets");
@@ -396,6 +363,4 @@ SocketService::closeConnections(void)
                        PG_LOGE("close() : %s", strerror_r(errno, buf, sizeof(buf)));
                }
        }
-
-       //PG_LOGD("Connections closed");
 }
old mode 100755 (executable)
new mode 100644 (file)
index 6050163..528355b
 #include <glib.h>
 #include "PrivacyGuardDaemon.h"
 
-// [kylee76]temp
-#include "Utils.h"
-
 int
 main(int argc, char* argv[])
 {
-       PG_LOGD("called");
        PrivacyGuardDaemon* pDaemon = PrivacyGuardDaemon::getInstance();
 
-       PG_LOGD("pDaemon->initialize()");
        pDaemon->initialize();
-       PG_LOGD("pDaemon->start()");
        pDaemon->start();
 
        GMainLoop* pLoop;
        pLoop = g_main_new(TRUE);
 
-       PG_LOGD("g_main_loop_run(pLoop)");
        g_main_loop_run(pLoop);
 
-       PG_LOGD("pDaemon->stop()");
        pDaemon->stop();
-       PG_LOGD("pDaemon->shutdown()");
        pDaemon->shutdown();
 
        return 0;
old mode 100755 (executable)
new mode 100644 (file)
index 892bfe1..efd2ca2
 int privacy_guard_daemon_initialize(void)
 {
        PrivacyGuardDaemon* pPrivacyDaemon = PrivacyGuardDaemon::getInstance();
-
        return pPrivacyDaemon->initialize();
 }
 
 int privacy_guard_daemon_start(void)
 {
        PrivacyGuardDaemon* pInstance = PrivacyGuardDaemon::getInstance();
-
        return pInstance->start();
 }
 
 int privacy_guard_daemon_stop(void)
 {
        PrivacyGuardDaemon* pInstance = PrivacyGuardDaemon::getInstance();
-
        return pInstance->stop();
 }
 
 int privacy_guard_daemon_shutdown(void)
 {
        PrivacyGuardDaemon* pInstance = PrivacyGuardDaemon::getInstance();
-
        return pInstance->shutdown();
 }