Prevent unnecessary xwalk extension loading for UI service 06/314606/2
authorSangYong Park <sy302.park@samsung.com>
Tue, 16 Jul 2024 06:24:34 +0000 (15:24 +0900)
committerSangYong Park <sy302.park@samsung.com>
Thu, 18 Jul 2024 05:07:39 +0000 (14:07 +0900)
Remove xwalk extension loading in main thread if UI service is launched.

Change-Id: I122de3061759cf1c00bd2d93dc2d8ae46aff5367
Signed-off-by: SangYong Park <sy302.park@samsung.com>
wrt_app/service/service_manager.ts
wrt_app/service/service_runner.ts

index a4d33fe4134f7b9f5233910847fbdf7700b8181e..c74728e6b755fd62f4c2293438c5bdaf804f8111 100644 (file)
@@ -118,18 +118,23 @@ function terminateWorker(id: string, delay: number) {
 
 let initializeExtensionOnMain = (id: string) => {
   initializeExtensionOnMain = (id: string) => {};
+
+  const serviceType = global['serviceType'];
+  if (serviceType === 'UI')
+    return;
+
   XWalkExtension.initialize();
   // This is workaround solution to make webapis's singleton worker, which has
   // same smack label with pid's.
   // It must be handled ahead of dropThreadPrivilege()
   // Otherwise, smack violation might hanppen from 'libdbuspolicy'.
   global.tizen.systeminfo.getPropertyValue('CPU', () => { }, () => { });
-  if (global['serviceType'] === 'STANDALONE') {
+  if (serviceType === 'STANDALONE') {
     let ids = id.split(':');
     let serviceId = ids[0];
     let packageId = serviceId.split('.')[0];
     wrt.security?.dropThreadPrivilege(packageId, serviceId);
-  } else if (global['serviceType'] === 'GLOBAL') {
+  } else if (serviceType === 'GLOBAL') {
     global.tizen.alarm.getAll();
   }
 }
index 814de69c880c641629a95001b5d3ebf612871b2f..b5b87fc46995c5c1a87dd2646c26bf244c6281e7 100644 (file)
@@ -69,7 +69,8 @@ let checkLauncherAlive = (id: string) => {
 }
 
 export function start(id: string, filename: string) {
-  if (isServiceApplication()) {
+  const isInServiceProcess = isServiceApplication();
+  if (isInServiceProcess) {
     let ids = id.split(':');
     let serviceId = ids[0];
     let packageId = wrt.getPackageId(id);
@@ -94,7 +95,8 @@ export function start(id: string, filename: string) {
   });
 
   console.debug(`serviceType : ${global['serviceType']}`)
-  deviceApiRouter = new DeviceAPIRouter(id, isGlobalService());
+  if (isInServiceProcess)
+    deviceApiRouter = new DeviceAPIRouter(id, isGlobalService());
   printAppControlData(id);
   ServiceMessage.initConsoleMessageNotification(id);