2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <native_service/frameworkunified_application.h>
19 #include <native_service/frameworkunified_framework_if.h>
20 #include <native_service/frameworkunified_service_protocol.h>
22 #include "ss_resm_resourcemanagerlog.h"
23 #include "system_service/resm_type.h"
25 extern void FlushMemInfo(void);
27 // Called at process startup
28 /********************************************************
29 * EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp)
31 * System callbacks that applications should address.
32 ********************************************************/
33 EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) {
34 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
35 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
37 // API to Register Notification for Service Availability.
38 eStatus = FrameworkunifiedRegisterServiceAvailabilityNotification(hApp, NTFY_ResourceMgr_Availability);
39 if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
40 // LCOV_EXCL_START 4: NSFW error case.
41 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
42 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Failed to Register Service Availability Notification:%s",
43 NTFY_ResourceMgr_Availability);
45 // LCOV_EXCL_STOP 4: NSFW error case.
47 // API to Publish Service Availability Notification.
48 eStatus = FrameworkunifiedPublishServiceAvailability(hApp, FALSE);
49 if (eFrameworkunifiedStatusOK != eStatus) { // LCOV_EXCL_BR_LINE 4: NSFW error case.
50 // LCOV_EXCL_START 4: NSFW error case.
51 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
52 FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__,
53 "Failed to Publish Service Availability Notification:0x%x", eStatus);
54 // LCOV_EXCL_STOP 4: NSFW error case.
56 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
60 // Called at process termination
61 /********************************************************
62 * EFrameworkunifiedStatus FrameworkunifiedOnDestroy
63 ********************************************************/
64 EFrameworkunifiedStatus FrameworkunifiedOnDestroy(HANDLE hApp) { // LCOV_EXCL_START 14 Resident process, not called by NSFW
65 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
66 EFrameworkunifiedStatus eStatus = eFrameworkunifiedStatusOK;
67 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
68 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
71 // LCOV_EXCL_STOP 14 Resident process, not called by NSFW
72 /********************************************************
73 * EFrameworkunifiedStatus FrameworkunifiedOnDebugDump
74 ********************************************************/
75 EFrameworkunifiedStatus FrameworkunifiedOnDebugDump(HANDLE hApp) { //LCOV_EXCL_START 7:debug code
76 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
77 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
78 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
79 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
82 //LCOV_EXCL_STOP 7:debug code
83 /********************************************************
84 * EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp)
85 ********************************************************/
86 EFrameworkunifiedStatus FrameworkunifiedOnStart(HANDLE hApp) {
87 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
88 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
89 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
93 /********************************************************
94 * EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp)
95 ********************************************************/
96 EFrameworkunifiedStatus FrameworkunifiedOnStop(HANDLE hApp) {
97 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
98 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
100 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
104 /********************************************************
105 * EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp)
106 ********************************************************/
107 EFrameworkunifiedStatus FrameworkunifiedOnPreStart(HANDLE hApp) {
108 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
109 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
110 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
114 /********************************************************
115 * EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp)
116 ********************************************************/
117 EFrameworkunifiedStatus FrameworkunifiedOnPreStop(HANDLE hApp) {
118 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
119 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
120 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
124 /********************************************************
125 * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp)
126 ********************************************************/
127 EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStart(HANDLE hApp) {
128 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
129 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
130 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
134 /********************************************************
135 * EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp)
136 ********************************************************/
137 EFrameworkunifiedStatus FrameworkunifiedOnBackgroundStop(HANDLE hApp) {
138 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
139 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
140 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
144 /********************************************************
145 * EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp)
146 ********************************************************/
147 EFrameworkunifiedStatus FrameworkunifiedCreateStateMachine(HANDLE hApp) { // LCOV_EXCL_START 8: not use StateMachine
148 AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert
149 EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK;
150 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+");
151 FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-");
154 // LCOV_EXCL_STOP 8: not use StateMachine