From 5a7f3b5ebc8533f7545dc1b031a0458e4c317280 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Fri, 3 Sep 2021 10:57:33 +0900 Subject: [PATCH 01/16] [Service] Remove initializeExtensionOnMain Instead of calling tizen.systeminfo.getPropertyValue(), we can generate TaskQueue instance explicitly with below patch. https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/263460/ Change-Id: Ib88acbe03058a2b8149c060b800157095cec2d80 Signed-off-by: DongHyun Song --- wrt_app/service/service_manager.ts | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/wrt_app/service/service_manager.ts b/wrt_app/service/service_manager.ts index 8e0c5bb..9f8d3e5 100644 --- a/wrt_app/service/service_manager.ts +++ b/wrt_app/service/service_manager.ts @@ -1,6 +1,5 @@ import { Worker, isMainThread } from 'worker_threads'; import { wrt } from '../browser/wrt'; -import * as XWalkExtension from '../common/wrt_xwalk_extension'; interface WorkerMap { [id: string]: any; @@ -46,19 +45,8 @@ function terminateWorker(id: string, delay: number) { workers[id].postMessage({ type: 'stop', delay }); } -let initializeExtensionOnMain = () => { - initializeExtensionOnMain = () => {}; - 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", () => { }, () => { }); -} - export function startService(id: string, filename: string) { console.debug(`startService - ${id}`); - initializeExtensionOnMain(); if (global['serviceType'] === 'STANDALONE') { let ids = id.split(':'); let serviceId = ids[0]; -- 2.7.4 From 5a11880f5ee44a3afff091f1a57b8cec91d592c8 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Mon, 27 Sep 2021 10:17:48 +0900 Subject: [PATCH 02/16] [Service] Apply wrt.finalizeService() Calls wrt.finalizeService(internalid) when service app stopped to remove service app information. Releated patch: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/264585/ Change-Id: Iee85542cbea732d0d34bef5e3efbfb366087201d Signed-off-by: DongHyun Song --- wrt_app/service/service_manager.ts | 3 +-- wrt_app/service/service_runner.ts | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wrt_app/service/service_manager.ts b/wrt_app/service/service_manager.ts index 9f8d3e5..22f51fc 100644 --- a/wrt_app/service/service_manager.ts +++ b/wrt_app/service/service_manager.ts @@ -5,7 +5,6 @@ interface WorkerMap { [id: string]: any; } let workers: WorkerMap = {}; -let runner: any; Object.defineProperty(global, 'serviceType', { value: wrt.getServiceModel(), @@ -31,7 +30,7 @@ function createWorker(id: string, startService: string, filename: string) { }); workers[id].on('exit', (code: number) => { delete workers[id]; - let runningServices = Object.keys(workers).length; + let runningServices = Object.keys(workers); console.debug(`exit code(${code}), remain services(${runningServices})`); }); } diff --git a/wrt_app/service/service_runner.ts b/wrt_app/service/service_runner.ts index 1955c53..d110017 100644 --- a/wrt_app/service/service_runner.ts +++ b/wrt_app/service/service_runner.ts @@ -16,6 +16,7 @@ function isServiceApplication() { function isGlobalService() { return global['serviceType'] === 'GLOBAL'; } + function printAppControlData(id: string) { let reqAppControl = global.tizen.application.getCurrentApplication().getRequestedAppControl(); if (reqAppControl) { @@ -132,6 +133,9 @@ export function stop(id: string) { } } catch (e) { console.debug(`exception on stop: ${e}`); + } finally { + if (isGlobalService()) + wrt.finalizeService(id); } } -- 2.7.4 From 3d90478d2a93e0eaa4ae4741a0e158a50bf65828 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Tue, 28 Sep 2021 02:50:57 -0700 Subject: [PATCH 03/16] [DeviceHome] Don't use specific IP address Official domain devicehome.net is used instead of specific IP address. Change-Id: Ib48080a584d931b43b2e0ac6c8da78abae631bcc Signed-off-by: Youngsoo Choi --- device_home/service/service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device_home/service/service.js b/device_home/service/service.js index 7463a57..bd4aeb5 100755 --- a/device_home/service/service.js +++ b/device_home/service/service.js @@ -20,7 +20,7 @@ const sessionMiddleware = session({ secure: false, }}); -const PUBLIC_DOMAIN = 'http://219.254.222.198'; +const PUBLIC_DOMAIN = 'http://devicehome.net'; const TAG = '[DeviceHome][service.js]' const TIZEN_WEB_APP_SHARED_RESOURCES = 'shared/res/'; const WEBCLIP_DIRECTORY = 'webclip'; -- 2.7.4 From b74ec6d1b163d85f09498dbfbb89620f07d39f9b Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Wed, 29 Sep 2021 13:41:32 +0900 Subject: [PATCH 04/16] [Service][VD] Change path of DeviceHome tmg Installation by wrt-service-broker, change the tmg file path to /home/owner/apps_rw/xwalk-service/device_home.tmg (User::App::Shared) This path will be allowable to use mount by privileged-service. Related chromium-efl patch: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/264755/ Change-Id: Idee01a75854592fb60b8c37656b7d1f3c5fd751c Signed-off-by: DongHyun Song --- packaging/wrtjs.spec | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index 6e21167..9576b3a 100644 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -39,7 +39,6 @@ BuildRequires: pkgconfig(dlog) BuildRequires: app-signer %if 0%{?_use_d2d} BuildRequires: squashfs -BuildRequires: vd-wgt-backend %endif %endif BuildRequires: hash-signer, zip @@ -199,16 +198,18 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/ %if "%{?tizen_profile_name}" == "tv" %define _d2d_app_file_name device_home.tmg %define _d2d_app_extension tmg + %define _d2d_install_path %{TZ_SYS_HOME}/owner/apps_rw/xwalk-service %else %define _d2d_app_file_name device_home.wgt %define _d2d_app_extension wgt + %define _d2d_install_path %{_appdir}/.preload-rw-wgt %endif install -m 0644 key.pem device_home/signaling_server/gen/ install -m 0644 cert.pem device_home/signaling_server/gen/ tizen/build/build_app.sh %{buildroot} device_home %{_d2d_app_file_name} %{_d2d_app_extension} platform %{?profile} - install -d %{buildroot}%{_appdir}/.preload-rw-wgt/ - install -m 0755 %{buildroot}/%{_d2d_app_file_name} %{buildroot}%{_appdir}/.preload-rw-wgt/ + install -d %{buildroot}/%{_d2d_install_path} + install -m 0755 %{buildroot}/%{_d2d_app_file_name} %{buildroot}/%{_d2d_install_path}/ rm -f %{buildroot}/%{_d2d_app_file_name} %endif @@ -258,7 +259,7 @@ fi %post %if "%{?_local_build}" == "1" %if 0%{?_use_d2d} - pkgcmd -i -t wgt -p %{_appdir}/.preload-rw-wgt/%{_d2d_app_file_name} + pkgcmd -i -t wgt -p %{_d2d_install_path}/%{_d2d_app_file_name} %endif %endif @@ -271,7 +272,7 @@ rm -fr %{buildroot} %manifest packaging/wrtjs.manifest %license LICENSE %if 0%{?_use_d2d} - %{_appdir}/.preload-rw-wgt/%{_d2d_app_file_name} + %{_d2d_install_path}/%{_d2d_app_file_name} %endif %if "%{?tizen_profile_name}" != "tv" %caps(cap_setgid,cap_sys_admin=ei) %{_bindir}/wrt-loader -- 2.7.4 From 592d9604bbca422c4db7accf7de11a8202d702cc Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Thu, 30 Sep 2021 10:30:24 +0900 Subject: [PATCH 05/16] Move FlushData() after setEnable() With low-end product, FlushData() looks to take too much time to flush StoragePartition. Then renderer can be not stopped immediately. Change-Id: Ibc96785878fd92e26d08e92dcffa9b9e6d39fb9d Signed-off-by: DongHyun Song --- wrt_app/src/web_application.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index 1238497..b68bf17 100755 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -308,6 +308,10 @@ export class WebApplication { } } + private isPausable() { + return !this.profileDelegate.canIgnoreSuspend() && !this.backgroundRunnable(); + } + suspend() { if (this.suspended || this.inQuit) return; @@ -317,10 +321,7 @@ export class WebApplication { addonManager.emit('lcSuspend', this.mainWindow.id); this.windowList[this.windowList.length - 1].hide(); } - this.flushData(); - if (this.profileDelegate.canIgnoreSuspend()) - return; - if (!this.backgroundRunnable()) { + if (this.isPausable()) { this.windowList.forEach((window) => window.setEnabled(false)); if (!this.multitaskingSupport) { setTimeout(() => { @@ -329,6 +330,7 @@ export class WebApplication { }, 0); } } + this.flushData(); } resume() { @@ -344,11 +346,11 @@ export class WebApplication { quit() { console.log('WebApplication : quit'); - this.flushData(); this.windowList.forEach((window) => { window.removeAllListeners(); window.setEnabled(false); }); + this.flushData(); this.inQuit = false; } -- 2.7.4 From 0d1228515ec0c88f14085386c1edbed3b5792980 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Thu, 30 Sep 2021 21:00:12 -0700 Subject: [PATCH 06/16] [DeviceHome] Move to error.html if tau library isn't loaded If tau library isn't loaded porperly, this moves current page to error.html. Change-Id: I06d43d2f2c32138e75b43e199dd9bf474fa35a1c Signed-off-by: Youngsoo Choi --- device_home/client/client.html | 6 +++++- device_home/client/css/style.css | 15 +++++++++++++++ device_home/client/error.html | 25 +++++++++++++++++++++++++ device_home/client/js/client.js | 9 ++++----- 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100755 device_home/client/error.html diff --git a/device_home/client/client.html b/device_home/client/client.html index 34e5a63..c2c03c2 100755 --- a/device_home/client/client.html +++ b/device_home/client/client.html @@ -14,6 +14,11 @@ + @@ -96,4 +101,3 @@ - diff --git a/device_home/client/css/style.css b/device_home/client/css/style.css index c9c1750..f1d7d0a 100755 --- a/device_home/client/css/style.css +++ b/device_home/client/css/style.css @@ -55,6 +55,21 @@ display: inline; } +.error-body { + background-color: #F2F2F2; + color: #505050; +} + +.error-msg { + text-align: left; + line-height: 23px; + color: #505050; + display: block; + margin-top: 100px; + margin-left: 20px; + padding-bottom: 20px; +} + body { /*disable-pull-to-refresh-effect*/ overscroll-behavior: contain; diff --git a/device_home/client/error.html b/device_home/client/error.html new file mode 100755 index 0000000..2de403f --- /dev/null +++ b/device_home/client/error.html @@ -0,0 +1,25 @@ + + + + + + + My Device App + + + + + +
+

+ Error +

+
+

+ Service is not available due to network issue +

+
+
+ + + diff --git a/device_home/client/js/client.js b/device_home/client/js/client.js index 3e1a6a1..c7f8fc2 100755 --- a/device_home/client/js/client.js +++ b/device_home/client/js/client.js @@ -3,15 +3,14 @@ * Back key event handler */ window.addEventListener("tizenhwkey", function (ev) { - var activePopup = null, - page = null, - pageid = ""; + let page = null; + let pageId = ''; if (ev.keyName === "back") { page = document.getElementsByClassName("ui-page")[0]; - pageid = page ? page.id : ""; + pageId = page ? page.id : ""; - if (pageid === "main" ) { + if (pageId === "main" || ev.target.id === "error-page") { try { /** * Exit application -- 2.7.4 From 58ec81468652bdc8a4a1f579d4498d1dfe2a6596 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Thu, 30 Sep 2021 22:20:35 -0700 Subject: [PATCH 07/16] fixup! [DeviceHome] Move to error.html if tau library isn't loaded The file name causing network issue is added into the error message. Change-Id: I49b845b75a467f9e5a5fc1f17795d0d7e98f1c5c Signed-off-by: Youngsoo Choi --- device_home/client/client.html | 16 ++++++++-------- device_home/client/css/style.css | 6 +----- device_home/client/error.html | 14 ++++++++++---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/device_home/client/client.html b/device_home/client/client.html index c2c03c2..91f4fab 100755 --- a/device_home/client/client.html +++ b/device_home/client/client.html @@ -5,20 +5,20 @@ My Device App - + + - - + + - diff --git a/device_home/client/css/style.css b/device_home/client/css/style.css index f1d7d0a..3e7b5eb 100755 --- a/device_home/client/css/style.css +++ b/device_home/client/css/style.css @@ -61,13 +61,9 @@ } .error-msg { - text-align: left; - line-height: 23px; color: #505050; display: block; - margin-top: 100px; - margin-left: 20px; - padding-bottom: 20px; + text-align: center; } body { diff --git a/device_home/client/error.html b/device_home/client/error.html index 2de403f..b62d84e 100755 --- a/device_home/client/error.html +++ b/device_home/client/error.html @@ -14,12 +14,18 @@

Error

-
-

- Service is not available due to network issue -

+
+

Service is not available

+

due to network issue of

+

+ -- 2.7.4 From 97c713c6f3edf8d3e8a8a2792c06ed0a632f9903 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Tue, 5 Oct 2021 09:51:18 +0900 Subject: [PATCH 08/16] fixup! [Service][VD] Change DeviceHome tmg path With TV image building, it cannot copy a file to /home/owner/... It should be /etc/skel. This folders will copy /home/owner after adduser Change-Id: I6841e604dba552c48f33f5d86bd004ce76ebee38 --- packaging/wrtjs.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index 9576b3a..0a24a03 100644 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -198,7 +198,7 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/ %if "%{?tizen_profile_name}" == "tv" %define _d2d_app_file_name device_home.tmg %define _d2d_app_extension tmg - %define _d2d_install_path %{TZ_SYS_HOME}/owner/apps_rw/xwalk-service + %define _d2d_install_path /etc/skel/apps_rw/xwalk-service %else %define _d2d_app_file_name device_home.wgt %define _d2d_app_extension wgt -- 2.7.4 From 38983178b88c5aa1aa40b243ceadcc3a458fd616 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Mon, 4 Oct 2021 18:22:41 -0700 Subject: [PATCH 09/16] [DeviceHome] Don't download library from not manageable CDN The mustache library CDN can't be manageable by Samsung. So, we can't deal with any network issue of the library repository. It's safer to keep it in local resource because it's only 6.38KB. Change-Id: I420c74e68e2ade3424245f66bd99abc11c5ed695 Signed-off-by: Youngsoo Choi --- device_home/client/client.html | 2 +- device_home/client/js/lib/mustache.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 device_home/client/js/lib/mustache.js diff --git a/device_home/client/client.html b/device_home/client/client.html index 91f4fab..025676a 100755 --- a/device_home/client/client.html +++ b/device_home/client/client.html @@ -14,8 +14,8 @@ - + diff --git a/device_home/client/js/lib/mustache.js b/device_home/client/js/lib/mustache.js new file mode 100644 index 0000000..4326b92 --- /dev/null +++ b/device_home/client/js/lib/mustache.js @@ -0,0 +1 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Mustache=t()}(this,function(){"use strict";var e=Object.prototype.toString,t=Array.isArray||function(t){return"[object Array]"===e.call(t)};function n(e){return"function"==typeof e}function r(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function i(e,t){return null!=e&&"object"==typeof e&&t in e}var o=RegExp.prototype.test;var a=/\S/;function s(e){return!function(e,t){return o.call(e,t)}(a,e)}var c={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};var p=/\s*/,u=/\s+/,l=/\s*=/,h=/\s*\}/,f=/#|\^|\/|>|\{|&|=|!/;function g(e){this.string=e,this.tail=e,this.pos=0}function d(e,t){this.view=e,this.cache={".":this.view},this.parent=t}function v(){this.templateCache={_cache:{},set:function(e,t){this._cache[e]=t},get:function(e){return this._cache[e]},clear:function(){this._cache={}}}}g.prototype.eos=function(){return""===this.tail},g.prototype.scan=function(e){var t=this.tail.match(e);if(!t||0!==t.index)return"";var n=t[0];return this.tail=this.tail.substring(n.length),this.pos+=n.length,n},g.prototype.scanUntil=function(e){var t,n=this.tail.search(e);switch(n){case-1:t=this.tail,this.tail="";break;case 0:t="";break;default:t=this.tail.substring(0,n),this.tail=this.tail.substring(n)}return this.pos+=t.length,t},d.prototype.push=function(e){return new d(e,this)},d.prototype.lookup=function(e){var t,r,o,a=this.cache;if(a.hasOwnProperty(e))t=a[e];else{for(var s,c,p,u=this,l=!1;u;){if(e.indexOf(".")>0)for(s=u.view,c=e.split("."),p=0;null!=s&&p0?i[i.length-1][4]:n;break;default:r.push(t)}return n}(function(e){for(var t,n,r=[],i=0,o=e.length;i"===a?s=this.renderPartial(o,t,n,i):"&"===a?s=this.unescapedValue(o,t):"name"===a?s=this.escapedValue(o,t,i):"text"===a&&(s=this.rawValue(o)),void 0!==s&&(c+=s);return c},v.prototype.renderSection=function(e,r,i,o,a){var s=this,c="",p=r.lookup(e[1]);if(p){if(t(p))for(var u=0,l=p.length;u0||!n)&&(i[o]=r+i[o]);return i.join("\n")},v.prototype.renderPartial=function(e,t,r,i){if(r){var o=this.getConfigTags(i),a=n(r)?r(e[1]):r[e[1]];if(null!=a){var s=e[6],c=e[5],p=e[4],u=a;0==c&&p&&(u=this.indentPartial(a,p,s));var l=this.parse(u,o);return this.renderTokens(l,t,r,u,i)}}},v.prototype.unescapedValue=function(e,t){var n=t.lookup(e[1]);if(null!=n)return n},v.prototype.escapedValue=function(e,t,n){var r=this.getConfigEscape(n)||y.escape,i=t.lookup(e[1]);if(null!=i)return"number"==typeof i&&r===y.escape?String(i):r(i)},v.prototype.rawValue=function(e){return e[1]},v.prototype.getConfigTags=function(e){return t(e)?e:e&&"object"==typeof e?e.tags:void 0},v.prototype.getConfigEscape=function(e){return e&&"object"==typeof e&&!t(e)?e.escape:void 0};var y={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(e){w.templateCache=e},get templateCache(){return w.templateCache}},w=new v;return y.clearCache=function(){return w.clearCache()},y.parse=function(e,t){return w.parse(e,t)},y.render=function(e,n,r,i){if("string"!=typeof e)throw new TypeError('Invalid template! Template should be a "string" but "'+(t(o=e)?"array":typeof o)+'" was given as the first argument for mustache#render(template, view, partials)');var o;return w.render(e,n,r,i)},y.escape=function(e){return String(e).replace(/[&<>"'`=\/]/g,function(e){return c[e]})},y.Scanner=g,y.Context=d,y.Writer=v,y}); \ No newline at end of file -- 2.7.4 From 59e7517b0c2cfcf1bd4152d2de891289e6652eb4 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Tue, 5 Oct 2021 05:36:57 +0000 Subject: [PATCH 10/16] [Service][VD] Change DeviceHome tmg path (skel --> /opt/data) with using /etc/skel folder, duplicated files are created as each account. we will change this path to /opt/data/device_home Change-Id: I86fab3b14fc3b6497797b5bc39a99cac08239989 Signed-off-by: DongHyun Song --- packaging/wrtjs.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index 0a24a03..784e037 100644 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -198,7 +198,7 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/ %if "%{?tizen_profile_name}" == "tv" %define _d2d_app_file_name device_home.tmg %define _d2d_app_extension tmg - %define _d2d_install_path /etc/skel/apps_rw/xwalk-service + %define _d2d_install_path %{TZ_SYS_DATA}/device_home %else %define _d2d_app_file_name device_home.wgt %define _d2d_app_extension wgt -- 2.7.4 From 8c4dbf280f29e6d8360780ff8ae6c8de1ff98a60 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Wed, 6 Oct 2021 06:25:04 +0000 Subject: [PATCH 11/16] Revert "[Service] Remove initializeExtensionOnMain" This reverts commit 5a7f3b5ebc8533f7545dc1b031a0458e4c317280. Smack problems are comming without this patch. "CreateTaskQueue" cannot solve the previous smack issue correctly. Change-Id: I1d71ca855bb30b6e71634d715c026ddd935d6573 --- wrt_app/service/service_manager.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wrt_app/service/service_manager.ts b/wrt_app/service/service_manager.ts index 9f8d3e5..8e0c5bb 100644 --- a/wrt_app/service/service_manager.ts +++ b/wrt_app/service/service_manager.ts @@ -1,5 +1,6 @@ import { Worker, isMainThread } from 'worker_threads'; import { wrt } from '../browser/wrt'; +import * as XWalkExtension from '../common/wrt_xwalk_extension'; interface WorkerMap { [id: string]: any; @@ -45,8 +46,19 @@ function terminateWorker(id: string, delay: number) { workers[id].postMessage({ type: 'stop', delay }); } +let initializeExtensionOnMain = () => { + initializeExtensionOnMain = () => {}; + 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", () => { }, () => { }); +} + export function startService(id: string, filename: string) { console.debug(`startService - ${id}`); + initializeExtensionOnMain(); if (global['serviceType'] === 'STANDALONE') { let ids = id.split(':'); let serviceId = ids[0]; -- 2.7.4 From 775504e6cb956d7304f7c38df42f6254f61c80b0 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Wed, 6 Oct 2021 13:39:33 +0900 Subject: [PATCH 12/16] [VD] Set focus of last web contents After closed another WRTWindow, the last web contents has no focus until any registered key is handled. This patch will give focus on the last web contents when WRTWindow closed. Related patch: https://review.tizen.org/gerrit/#/c/platform/framework/web/chromium-efl/+/264955/ Change-Id: I43475272f757a05be05aa51ca7ff5dbac659bf6b Signed-off-by: DongHyun Song --- wrt_app/common/web_application_delegate.ts | 1 + wrt_app/src/tv/web_application_tv.ts | 4 ++++ wrt_app/src/web_application.ts | 7 +++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/wrt_app/common/web_application_delegate.ts b/wrt_app/common/web_application_delegate.ts index 8d80b78..648ccb4 100644 --- a/wrt_app/common/web_application_delegate.ts +++ b/wrt_app/common/web_application_delegate.ts @@ -29,6 +29,7 @@ export class WebApplicationDelegate { canIgnoreSuspend() { return false; } clearCache() { } clearSuface(webContents: any) { } + focus(webContents: any) { } handleAppControlEvent(appControl: any) { return true; } handleProxyInfo(authInfo: any, callback: any) { return false; } initialize(options: RuntimeOption) { } diff --git a/wrt_app/src/tv/web_application_tv.ts b/wrt_app/src/tv/web_application_tv.ts index 683515f..8a29733 100644 --- a/wrt_app/src/tv/web_application_tv.ts +++ b/wrt_app/src/tv/web_application_tv.ts @@ -264,4 +264,8 @@ Then you can get profile log from the initial loading.`; profileName() { return 'TV'; } + + focus(webContents: any) { + this.tv.focus(webContents); + } } diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index b68bf17..1ba13d7 100755 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -69,8 +69,11 @@ export class WebApplication { console.log(`window closed : #${this.windowList.length}`); let index = this.windowList.indexOf(window); this.windowList.splice(index, 1); - if (!this.inQuit && index === this.windowList.length && this.windowList.length > 0) - this.windowList[this.windowList.length - 1].show(); + if (!this.inQuit && index === this.windowList.length && this.windowList.length > 0) { + let lastWindow = this.windowList[this.windowList.length - 1]; + lastWindow.show(); + this.profileDelegate.focus(lastWindow.webContents); + } }); }); -- 2.7.4 From 824a5f56210b86aab2158d69094a54f5ea9b5f58 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Wed, 6 Oct 2021 22:11:33 -0700 Subject: [PATCH 13/16] [Service][Public] Run device home on booting time The device home runs on booting time on public profile. Change-Id: I903ff09c43bb78345d2209e681c651d8b5c3094d Signed-off-by: Youngsoo Choi --- packaging/config.xml.in | 21 +++++++++++++++++++++ .../config.xml => packaging/config_tv.xml.in | 0 packaging/wrtjs.spec | 3 +++ 3 files changed, 24 insertions(+) create mode 100644 packaging/config.xml.in rename device_home/config.xml => packaging/config_tv.xml.in (100%) diff --git a/packaging/config.xml.in b/packaging/config.xml.in new file mode 100644 index 0000000..2b80c64 --- /dev/null +++ b/packaging/config.xml.in @@ -0,0 +1,21 @@ + + + + + DeviceHome + + + + + + + + + + + + + DeviceHomeService + DeviceHomeService + + diff --git a/device_home/config.xml b/packaging/config_tv.xml.in similarity index 100% rename from device_home/config.xml rename to packaging/config_tv.xml.in diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index 784e037..c149c45 100644 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -199,10 +199,12 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/ %define _d2d_app_file_name device_home.tmg %define _d2d_app_extension tmg %define _d2d_install_path %{TZ_SYS_DATA}/device_home + install -m 0644 packaging/config_tv.xml.in device_home/config.xml %else %define _d2d_app_file_name device_home.wgt %define _d2d_app_extension wgt %define _d2d_install_path %{_appdir}/.preload-rw-wgt + install -m 0644 packaging/config.xml.in device_home/config.xml %endif install -m 0644 key.pem device_home/signaling_server/gen/ install -m 0644 cert.pem device_home/signaling_server/gen/ @@ -259,6 +261,7 @@ fi %post %if "%{?_local_build}" == "1" %if 0%{?_use_d2d} + pkgcmd -un 9z6IujVul3 pkgcmd -i -t wgt -p %{_d2d_install_path}/%{_d2d_app_file_name} %endif %endif -- 2.7.4 From d26dae3a7562b8122972b9c3248c8c31edba9b3c Mon Sep 17 00:00:00 2001 From: Hunseop Jeong Date: Thu, 7 Oct 2021 14:50:21 +0900 Subject: [PATCH 14/16] [SignalingServer] Add a missing api Load the getMyAddress from util. Change-Id: Idd4a1e469c1853da2549cc12a497c6ad85fa0108 Signed-off-by: Hunseop Jeong --- device_home/signaling_server/gen/edge.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device_home/signaling_server/gen/edge.js b/device_home/signaling_server/gen/edge.js index d6f5092..e70cb2d 100644 --- a/device_home/signaling_server/gen/edge.js +++ b/device_home/signaling_server/gen/edge.js @@ -1,3 +1,5 @@ +const { getMyAddress } = require('./util'); + const TAG = 'edge.js'; class Edge { -- 2.7.4 From cb218f9b62d4c3ec19af3fa17f6f3bdc66cef799 Mon Sep 17 00:00:00 2001 From: Hunseop Jeong Date: Thu, 7 Oct 2021 15:09:36 +0900 Subject: [PATCH 15/16] [SignalingServer] Add the https port variable The httpsPort is required to search and run device. Change-Id: I31db885b20a06ca394bf1eeb97b6314bb62c94b0 Signed-off-by: Hunseop Jeong --- device_home/signaling_server/gen/edge.js | 1 + 1 file changed, 1 insertion(+) diff --git a/device_home/signaling_server/gen/edge.js b/device_home/signaling_server/gen/edge.js index e70cb2d..8573ef2 100644 --- a/device_home/signaling_server/gen/edge.js +++ b/device_home/signaling_server/gen/edge.js @@ -1,6 +1,7 @@ const { getMyAddress } = require('./util'); const TAG = 'edge.js'; +const httpsPort = process.env.PORT || process.env.HTTPS_PORT || 5443; class Edge { constructor(service, execType, packageName) { -- 2.7.4 From 6ca3f62a0a268a2cad321c815bcf5bdbfe604769 Mon Sep 17 00:00:00 2001 From: Hunseop Jeong Date: Thu, 7 Oct 2021 17:33:03 +0900 Subject: [PATCH 16/16] [SignalingServer] Fix a connection problem on message port The message port does not guarantee that the connection has been disconnected when the page is reloaded. So, if new connection occurs with the same socket id, the existing connection is disconnected. Change-Id: I0ed924821990129fe22d3adb752700bab0b28be7 Signed-off-by: Hunseop Jeong --- device_home/signaling_server/gen/app.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/device_home/signaling_server/gen/app.js b/device_home/signaling_server/gen/app.js index 5419924..44998f0 100644 --- a/device_home/signaling_server/gen/app.js +++ b/device_home/signaling_server/gen/app.js @@ -177,8 +177,8 @@ function onConnection(socket) { ); for (const client of clients) { - const socket = sockets.get(client); - socket.emit('worker', { + const clientSocket = sockets.get(client); + clientSocket.emit('worker', { event: 'join', workerId: worker.id, socketId: socket.id, @@ -333,6 +333,16 @@ if (supportMessagePort) { const id = value.id; if (event === 'connect') { + // FIXME: The message port does not guarantee that the connection has + // been disconnected when the page is reloaded. Therefore, if a new + // connection occurs with the same id, the existing connection is + // disconnected. + if (sockets.has(id)) { + console.log(TAG, `Disconnect already connected socket: ${id}`); + const socket = sockets.get(id); + socket.handleEvents('disconnect'); + } + const socket = new SocketTizen(id, localPort); socket.on('connection', onConnection); socket.connect(); -- 2.7.4