Fix bluetooth event exclusive use issue
authorJoohyun Kim <joohyune.kim@samsung.com>
Tue, 28 May 2013 13:19:27 +0000 (22:19 +0900)
committerJoohyun Kim <joohyune.kim@samsung.com>
Tue, 28 May 2013 13:21:06 +0000 (22:21 +0900)
Change-Id: Id1654b88487840a1e9a630a07206cac962defd29
Signed-off-by: Joohyun Kim <joohyune.kim@samsung.com>
src/FSys_DeviceManagerService.cpp

index 497f2bd..85a822a 100644 (file)
@@ -241,7 +241,6 @@ _DeviceManagerService::AddInterestedApp(int pid)
        if(isInitBluetooth == false)
        {
                SysLog(NID_SYS, "Bluetooth headset event is reserved.");
-               media_key_reserve(app_media_key_handler, null);
 
                int btResult = 0;
                btResult = bt_initialize();
@@ -260,6 +259,10 @@ _DeviceManagerService::AddInterestedApp(int pid)
        Integer* pPid = new (std::nothrow) Integer(pid);
        __interestedPidList.Add(*pPid);
 
+       if(__interestedPidList.GetCount() > 0)
+       {
+               media_key_reserve(app_media_key_handler, null);
+       }
 }
 
 void
@@ -273,9 +276,14 @@ _DeviceManagerService::RemoveInterestedApp(int pid)
                if(pPid->value == pid)
                {
                        __interestedPidList.RemoveAt(count, true);
-                       return;
+                       break;
                }
        }
+
+       if(__interestedPidList.GetCount() == 0)
+       {
+               media_key_release();
+       }
 }
 
 void