sensor: update app uninstall event dbus signal
[platform/core/context/context-provider.git] / src / app-stats / AppStatsLogger.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include "AppStatisticsTypes.h"
18 #include "AppStatsLogger.h"
19
20 using namespace ctx;
21
22 AppStatsLogger::AppStatsLogger() :
23         ContextProvider(APP_SUBJ_LOGGER),
24         __initializer(NULL),
25         __installMon(NULL),
26         __launchMon(NULL)
27 {
28         __initializer = new(std::nothrow) AppDbInitializer();
29         IF_FAIL_VOID_TAG(__initializer, _E, "Memory allocation failed");
30
31         __installMon = new(std::nothrow) AppInstallMonitor();
32         __launchMon = new(std::nothrow) AppUseMonitor();
33         IF_FAIL_CATCH_TAG(__installMon && __launchMon, _E, "Memory allocation failed");
34         return;
35
36 CATCH:
37         delete __installMon;
38         delete __launchMon;
39         __installMon = NULL;
40         __launchMon = NULL;
41 }
42
43 AppStatsLogger::~AppStatsLogger()
44 {
45         delete __installMon;
46         delete __launchMon;
47 }
48
49 void AppStatsLogger::getPrivilege(std::vector<const char*> &privilege)
50 {
51         privilege.push_back(PRIV_APP_HISTORY);
52 }
53
54 int AppStatsLogger::subscribe(Json option, Json* requestResult)
55 {
56         return ERR_NONE;
57 }
58
59 int AppStatsLogger::unsubscribe(Json option)
60 {
61         return ERR_NONE;
62 }