From: liwei Date: Thu, 23 Mar 2023 02:40:12 +0000 (+0800) Subject: [Tizen 7.5 Migration][Service] Only apply tizen.alarm.getAll() in daemon mode X-Git-Tag: submit/tizen/20230331.160026^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a721b3b19cdf3acb5c2698210d7d3fb909c566f;p=platform%2Fframework%2Fweb%2Fwrtjs.git [Tizen 7.5 Migration][Service] Only apply tizen.alarm.getAll() in daemon mode tizen.alarm.getAll() can only be called before drop privilege in daemon mode, bcz in standalone mode, privilge permission issue will happen(error example:MESSAGE=User::Pkg::kk8MbItQ0H; 5001;http://tizen.org/privilege/alarm.get => DENY). Change-Id: Id2f3231deece0446374b0b426473b5100ca2673d Signed-off-by: liwei (cherry picked from commit a93d5915458eaba744589819378f398e2acbc3b1) --- diff --git a/wrt_app/service/service_manager.ts b/wrt_app/service/service_manager.ts index 8ae7279..4209af3 100644 --- a/wrt_app/service/service_manager.ts +++ b/wrt_app/service/service_manager.ts @@ -88,15 +88,22 @@ function terminateWorker(id: string, delay: number) { workers[id].postMessage({ type: 'stop', delay }); } -let initializeExtensionOnMain = () => { - initializeExtensionOnMain = () => {}; +let initializeExtensionOnMain = (id: string) => { + initializeExtensionOnMain = (id: string) => {}; 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", () => { }, () => { }); - global.tizen.alarm.getAll(); + if (global['serviceType'] !== 'STANDALONE') { + global.tizen.alarm.getAll(); + } else { + let ids = id.split(':'); + let serviceId = ids[0]; + let packageId = serviceId.split('.')[0]; + wrt.security?.dropThreadPrivilege(packageId, serviceId); + } } export function startService(id: string, filename: string) { @@ -105,13 +112,7 @@ export function startService(id: string, filename: string) { return; } console.debug(`startService - ${id}`); - initializeExtensionOnMain(); - if (global['serviceType'] === 'STANDALONE') { - let ids = id.split(':'); - let serviceId = ids[0]; - let packageId = serviceId.split('.')[0]; - wrt.security?.dropThreadPrivilege(packageId, serviceId); - } + initializeExtensionOnMain(id); let startService = `${__dirname}/service_runner.js`; createWorker(id, startService, filename); }