Enhance logs 62/162362/3
authorZofia Grzelewska <z.abramowska@samsung.com>
Thu, 30 Nov 2017 09:55:17 +0000 (10:55 +0100)
committerZofia Grzelewska <z.abramowska@samsung.com>
Thu, 30 Nov 2017 12:35:11 +0000 (13:35 +0100)
Change-Id: I2f92b9d1eae7c597fb1411b26f3be5393fb4c80c

src/notification-daemon/Logic.cpp

index 33b11b97292faf416cc0241466dd497d9d036479..57197cf8193c515683c6e6ebca0f2c82143f09e5 100644 (file)
@@ -89,6 +89,7 @@ std::string clientResponseToPolicy(int clientResponse) {
 }
 
 void Logic::addChannelFd(Protocol::ConnectionFd fd, const Protocol::Credentials &creds) {
+    ALOGD("Adding new client with fd " << fd);
     auto it = m_connToInfo.find(fd);
     if (it != m_connToInfo.end()) {
         ALOGE("Connection with fd : " << fd << " already exists. Closing connection");
@@ -108,6 +109,7 @@ void Logic::addChannelFd(Protocol::ConnectionFd fd, const Protocol::Credentials
 }
 
 void Logic::updateChannelFd(Protocol::ConnectionFd fd, Ecore_Fd_Handler_Flags flags) {
+    ALOGD("Updating channel with fd " << fd << " and flags " << flags);
     auto it = m_fdInfo.find(fd);
     if (it != m_fdInfo.end()) {
         m_fdInfo[fd].status = FdChange::CHANGE;
@@ -126,6 +128,9 @@ void Logic::updateChannelFd(Protocol::ConnectionFd fd, Ecore_Fd_Handler_Flags fl
 }
 
 void Logic::removeChannelFd(Protocol::ConnectionFd fd) {
+    ALOGD("Removing channel with fd " << fd);
+    m_connToInfo.erase(fd);
+
     auto it = m_fdInfo.find(fd);
     if (it == m_fdInfo.end()) {
         return;
@@ -151,12 +156,15 @@ Eina_Bool Logic::clientChHandler(void *data, Ecore_Fd_Handler *handler) {
 }
 
 Eina_Bool Logic::processChannel(int fd, int mask) {
+    ALOGD("Porcesing fd " << fd << " with mask " << mask);
     updateChannel(fd, mask);
 
     switch (m_fdInfo[fd].status) {
     case FdChange::NONE:
+        ALOGD("Fd is mark for renewal");
         return ECORE_CALLBACK_RENEW;
     case FdChange::DEL: {
+        ALOGD("Fd is marked for deletion");
         // Remove all pending events from this fd
         auto queueIt = std::remove_if(m_pendingEvents.begin(), m_pendingEvents.end(),
                 [fd](const FdEvent &fdEvent) {return fdEvent.id.fd == fd;});
@@ -198,7 +206,7 @@ void Logic::addEvent(Protocol::ConnectionFd fd, Protocol::RequestId id, const st
 }
 
 void Logic::popup(Protocol::ConnectionFd fd, Protocol::RequestId id, const std::string &privilege) {
-    ALOGD("Request for privilege " << privilege);
+    ALOGD("Request for privilege " << privilege << " from fd " << fd << " with id " << id);
 
     auto it = m_connToInfo.find(fd);
     if (it == m_connToInfo.end()) {
@@ -347,10 +355,11 @@ void Logic::run() {
 }
 
 bool Logic::setPolicy(const ConnectionInfo &conn, const std::string &lastPolicy) {
+    ALOGD("Setting policy for app " << conn.appId << " with last policy " << lastPolicy);
     std::string currentPrivacy;
 
     PrivaciesSequence &privSeq = m_eventToPrivaciesSeq[m_currentEvent];
-    if (!privSeq.getCurrentPrivacy(currentPrivacy)) {
+    if (!privSeq.getCurrentPrivacy(currentPrivacy) && lastPolicy == "Allow") {
         ALOGD("Privilege is allowed completely");
     }