From 51b868a4854fda360f61dc1b26989bf244c5e944 Mon Sep 17 00:00:00 2001 From: SangYong Park Date: Wed, 9 Feb 2022 15:43:06 +0900 Subject: [PATCH 01/16] Remove WRTWindow and WRTWebContents modules . remove unnecesary modules . fix typescript build errors Change-Id: I1338fbea96f612e4087dcea2e56be656063a9a60 Signed-off-by: SangYong Park --- packaging/wrtjs.spec | 4 +-- wrt_app/addon/browser/modules/messaging.ts | 5 ++-- wrt_app/addon/browser/modules/window.ts | 45 +++++++++++++++--------------- wrt_app/browser/wrt_web_contents.ts | 32 --------------------- wrt_app/browser/wrt_window.ts | 44 ----------------------------- wrt_app/src/runtime.ts | 2 +- wrt_app/src/tv/web_application_tv.ts | 4 +-- wrt_app/src/web_application.ts | 9 ++---- 8 files changed, 34 insertions(+), 111 deletions(-) delete mode 100644 wrt_app/browser/wrt_web_contents.ts delete mode 100644 wrt_app/browser/wrt_window.ts diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index b729517..e605fba 100644 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -23,9 +23,9 @@ Source: %{name}-%{version}.tar.gz # The category is public feature %if "%{?profile}" != "tv" && "%{?profile}" != "wearable" && "%{?_with_da_profile}" != "1" %ifarch armv7l - %define _use_nmt 1 + %define _use_nmt 0 %endif - %define _use_category 1 + %define _use_category 0 %endif BuildRequires: pkgconfig(chromium-efl) diff --git a/wrt_app/addon/browser/modules/messaging.ts b/wrt_app/addon/browser/modules/messaging.ts index eeccb5f..7a68b39 100644 --- a/wrt_app/addon/browser/modules/messaging.ts +++ b/wrt_app/addon/browser/modules/messaging.ts @@ -7,6 +7,7 @@ export const on = function (channel: string, listener: (event: Electron.IpcMainE }; export const send = function (winId: number, channel: string, ...args: any[]) { - let window = BrowserWindow.fromId(winId); - window.webContents.send(channel, ...args); + const window = BrowserWindow.fromId(winId); + if (window) + window.webContents.send(channel, ...args); }; diff --git a/wrt_app/addon/browser/modules/window.ts b/wrt_app/addon/browser/modules/window.ts index 1a5e7c2..b775fe8 100644 --- a/wrt_app/addon/browser/modules/window.ts +++ b/wrt_app/addon/browser/modules/window.ts @@ -1,40 +1,41 @@ 'use strict'; import { dialog, BrowserWindow } from 'electron'; -import * as WRTWebContents from '../../../browser/wrt_web_contents'; -import { WRTWindow } from '../../../browser/wrt_window'; -export const loadURL= function (winId: number, url: string) { - let window = BrowserWindow.fromId(winId); - window.loadURL(url); +export const loadURL = function (winId: number, url: string) { + const window = BrowserWindow.fromId(winId); + if (window) + window.loadURL(url); }; -export const showMessageBox = function (winId: number, options: Electron.MessageBoxOptions) { - let window = BrowserWindow.fromId(winId); - let showMessageBox = (dialog.showMessageBoxSync || dialog.showMessageBox); - showMessageBox(window, options); +export const showMessageBox = function (winId: number, options: Electron.MessageBoxOptions) { + const showMessageBox = (dialog.showMessageBoxSync || dialog.showMessageBox); + const window = BrowserWindow.fromId(winId); + if (window) + showMessageBox(window, options); }; export const show = function (winId: number) { - let window = BrowserWindow.fromId(winId); - window.show(); + const window = BrowserWindow.fromId(winId); + if (window) + window.show(); }; -export const executeJavaScript= function (winId: number, string: string) { - let window = BrowserWindow.fromId(winId); - window.webContents.executeJavaScript(string, true); +export const executeJavaScript = function (winId: number, string: string) { + const window = BrowserWindow.fromId(winId); + if (window) + window.webContents.executeJavaScript(string, true); }; export const open = function (url: string) { - let window = new WRTWindow( - { webPreferences: { - nodeIntegration: true, - nodeIntegrationInSubFrames: true, - nodeIntegrationInWorker: false, - nativeWindowOpen: true, - }, - webContents: WRTWebContents.create(), + const window = new BrowserWindow({ + webPreferences: { + nodeIntegration: true, + nodeIntegrationInSubFrames: true, + nodeIntegrationInWorker: false, + nativeWindowOpen: true, + }, }); window.loadURL(url); return window.id; diff --git a/wrt_app/browser/wrt_web_contents.ts b/wrt_app/browser/wrt_web_contents.ts deleted file mode 100644 index 38ab268..0000000 --- a/wrt_app/browser/wrt_web_contents.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -const binding: NativeWRTjs.WRTWebContentsBinding = process.wrtBinding('wrt_web_contents'); -const { WRTWebContents } = binding; -const { WebContents: ElectronWebContents } = process.wrtBinding('electron_browser_web_contents'); - -const parent = ElectronWebContents.prototype; -ElectronWebContents.prototype = WRTWebContents.prototype; - -Object.setPrototypeOf(WRTWebContents.prototype, parent); - -WRTWebContents.prototype._init = function () { - parent._init.call(this); -} - -export const create = (options = {}) => { - return binding.create(options); -} diff --git a/wrt_app/browser/wrt_window.ts b/wrt_app/browser/wrt_window.ts deleted file mode 100644 index ebb7423..0000000 --- a/wrt_app/browser/wrt_window.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { BrowserWindow } from 'electron'; -import * as WRTWebContents from '../browser/wrt_web_contents'; - -export const { WRTWindow } = process.wrtBinding('wrt_window'); - -Object.setPrototypeOf(WRTWindow.prototype, BrowserWindow.prototype); - -WRTWindow.prototype._init = function () { - (BrowserWindow.prototype as any)._init.call(this); - // This removes a macOS specific hack present in electron - // that causes side effects on Tizen - this.webContents.removeAllListeners('load-url'); - if (typeof this.setup === 'function') - this.setup(); - this.constructor = BrowserWindow; - this.webContents.on('new-window', (event: Electron.NewWindowWebContentsEvent, - url: string, - frameName: string, - disposition: ('default' | 'foreground-tab' | 'background-tab' | 'new-window' | 'save-to-disk' | 'other'), - options: any) => { - event.preventDefault(); - if (!options.webContents) { - options.webContents = WRTWebContents.create(); - options.webContents.loadURL(url); - } - event.newGuest = new WRTWindow(options); - }); -} diff --git a/wrt_app/src/runtime.ts b/wrt_app/src/runtime.ts index f92cfeb..6cb1e77 100644 --- a/wrt_app/src/runtime.ts +++ b/wrt_app/src/runtime.ts @@ -132,7 +132,7 @@ class Runtime { const Module = require('module'); Module.globalPaths.push(wrt.getAppPath()); let filePath = src[7] === '/' ? src.substr(8) : src.substr(7); // strip "file://" - let pkgJson = require(filePath); + let pkgJson: any = require(filePath); let pos = filePath.lastIndexOf('/'); let mainJsPath = (pos !== -1 ? filePath.substr(0, pos + 1) : '') + diff --git a/wrt_app/src/tv/web_application_tv.ts b/wrt_app/src/tv/web_application_tv.ts index eeaaae5..ca8a5d0 100644 --- a/wrt_app/src/tv/web_application_tv.ts +++ b/wrt_app/src/tv/web_application_tv.ts @@ -174,9 +174,9 @@ Then you can get profile log from the initial loading.`; this.webApplication.windowList.forEach((window) => { //clear webframe cache this.tv.clearWebCache(window.webContents); - window.webContents.session.clearCache(function() { + window.webContents.session.clearCache().then(() => { console.log('clear session Cache complete'); - }) + }); }); } diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index 640b49c..b206872 100644 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -16,10 +16,8 @@ 'use strict'; -import { app, session } from 'electron'; +import { BrowserWindow, app, session } from 'electron'; import { wrt } from '../browser/wrt'; -import * as WRTWebContents from '../browser/wrt_web_contents'; -import { WRTWindow } from '../browser/wrt_window'; import { addonManager } from './addon_manager'; import { WebApplicationDelegate } from '../common/web_application_delegate'; import { WebApplicationDelegateTV } from './tv/web_application_tv'; @@ -53,7 +51,7 @@ export class WebApplication { this.profileDelegate = new WebApplicationDelegate(this); } this.setupEventListener(options); - this.mainWindow = new WRTWindow(this.getWindowOption(options)); + this.mainWindow = new BrowserWindow(this.getWindowOption(options)); this.initDisplayDelay(); this.setupMainWindowEventListener(); } @@ -166,7 +164,7 @@ export class WebApplication { }); } - private getWindowOption(options: RuntimeOption): NativeWRTjs.WRTWindowConstructorOptions { + private getWindowOption(options: RuntimeOption): Electron.BrowserWindowConstructorOptions { return { fullscreen: false, backgroundColor: this.defaultBackgroundColor, @@ -178,7 +176,6 @@ export class WebApplication { nodeIntegrationInWorker: false, nativeWindowOpen: true, }, - webContents: WRTWebContents.create(), }; } -- 2.7.4 From 29c7e688eafd0dffcf231ecf58f78a3484800d5b Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Fri, 11 Feb 2022 09:47:08 +0900 Subject: [PATCH 02/16] [Tizen 7.0] Sync up branches from tizen_6.5 to tizen [Service] Terminate service apps one by one https://review.tizen.org/gerrit/#/c/platform/framework/web/wrtjs/+/267413/ [Service] Support requestTrustedRemoteMessagePort https://review.tizen.org/gerrit/#/c/platform/framework/web/wrtjs/+/267572/ Change-Id: I0ac239a8f731be00f0eabc6b01413c8b0c52362b Signed-off-by: DongHyun Song --- wrt_app/service/device_api_router.ts | 42 ++++++++++++++++++++++++++++-------- wrt_app/service/service_manager.ts | 19 ++++++++++++++-- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index 98cbe03..b0a2b6d 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -11,7 +11,6 @@ export class DeviceAPIRouter { funcGetMetadata: any; funcGetPackageInfo: any; funcRequestLocalMessagePort: any; - funcRequestTrustedLocalMessagePort: any; id: string; serviceId: string; @@ -19,6 +18,7 @@ export class DeviceAPIRouter { callerAppId: string; permissions: string[]; pkgApiVersion: string; + messagePortInfo: any; constructor(id: string, isGlobal: boolean) { this.id = id; @@ -28,6 +28,7 @@ export class DeviceAPIRouter { this.packageId = wrt.getPackageId(id); this.permissions = []; this.pkgApiVersion = ''; + this.messagePortInfo = {}; this.initWebapis(); if (isGlobal) { @@ -324,19 +325,28 @@ export class DeviceAPIRouter { refineMessagePortApis() { this.funcRequestLocalMessagePort = global.tizen.messageport.requestLocalMessagePort; - this.funcRequestTrustedLocalMessagePort = - global.tizen.messageport.requestTrustedLocalMessagePort; - const registerMessagePort = (name: string, portName: string) => { + const registerMessagePort = (name: string, portName: string, appId?: string, callback?: any) => { + let portInfo = `${name}::${this.serviceId}::${portName}`; + if (this.messagePortInfo[portInfo] === 'created') { + callback?.(); + return; + } let data_payload = [ - new global.tizen.ApplicationControlData(name, [ portName ]), - + new global.tizen.ApplicationControlData(name, [portName]), ]; + if (appId) { + data_payload.push(new global.tizen.ApplicationControlData('appId', [appId])); + } let appControl = new global.tizen.ApplicationControl( - "http://tizen.org/appcontrol/operation/default", null, null, null, - data_payload, null); + "http://tizen.org/appcontrol/operation/default", null, null, null, + data_payload, null); global.tizen.application.launchAppControl(appControl, this.serviceId, - () => console.debug(`'${this.serviceId}::${name}' is requsted`)); + () => { + console.debug(`'${portInfo}' is requsted`) + callback?.(); + this.messagePortInfo[portInfo] = 'created'; + }); } global.tizen.messageport.requestLocalMessagePort = (portName: string) => { @@ -347,5 +357,19 @@ export class DeviceAPIRouter { registerMessagePort('requestTrustedLocalMessagePort', portName); return this.funcRequestLocalMessagePort(portName); } + global.tizen.messageport.requestTrustedRemoteMessagePort = (appId: string, portName: string) => { + return { + messagePortName: portName, + appId, + isTrusted: true, + sendMessage: (data: any, localMessagePort?: any) => { + registerMessagePort('requestTrustedRemoteMessagePort', portName, appId, + () => { + let remotePort = global.tizen.messageport.requestRemoteMessagePort(this.serviceId, portName); + remotePort.sendMessage(data, localMessagePort); + }); + } + } + } } } diff --git a/wrt_app/service/service_manager.ts b/wrt_app/service/service_manager.ts index fe3fd77..c639eba 100644 --- a/wrt_app/service/service_manager.ts +++ b/wrt_app/service/service_manager.ts @@ -6,12 +6,24 @@ interface WorkerMap { [id: string]: any; } let workers: WorkerMap = {}; +let dyingWorkerQueue: WorkerMap = {}; Object.defineProperty(global, 'serviceType', { value: wrt.getServiceModel(), writable: false }); +function checkDyingWorker() { + let dyingWorkers = Object.keys(dyingWorkerQueue); + if (dyingWorkers.length) { + let workerId = dyingWorkers[0]; + if (dyingWorkerQueue[workerId] === 'will-terminate') { + dyingWorkerQueue[workerId] = 'terminated'; + workers[workerId].terminate(); + } + } +} + function createWorker(id: string, startService: string, filename: string) { if (workers[id]) { workers[id].postMessage({ type: 'wake' }); @@ -27,14 +39,17 @@ function createWorker(id: string, startService: string, filename: string) { }); workers[id].on('message', (message: string) => { if (message === 'will-terminate') { - workers[id].terminate(); + dyingWorkerQueue[id] = message; + checkDyingWorker(); } }); workers[id].on('exit', (code: number) => { wrt.tv?.serviceUmount(id); + delete dyingWorkerQueue[id]; delete workers[id]; let runningServices = Object.keys(workers); - console.debug(`exit code(${code}), remain services(${runningServices})`); + console.debug(`${id} terminated, remain services(${runningServices})`); + checkDyingWorker(); }); } -- 2.7.4 From 33baa98aefc7b5dffbb9f9ca93e672d8a618c88f Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Tue, 4 Jan 2022 12:05:15 +0900 Subject: [PATCH 03/16] [DeviceHome] Send push registration id Send push registration id with device info, which is given from wrt-service-broker when push connection is established. Change-Id: I8858983bf4f7f85072e1bd5dfa170d1f419d2f3c Signed-off-by: DongHyun Song --- device_home/service/initializer/service.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/device_home/service/initializer/service.js b/device_home/service/initializer/service.js index 1d782a0..d3db0ab 100755 --- a/device_home/service/initializer/service.js +++ b/device_home/service/initializer/service.js @@ -22,10 +22,23 @@ class Initializer { console.log(`${TAG} failed to get device_ip`); return; } + let req_id = ''; + let req_appcontrol = tizen.application.getCurrentApplication().getRequestedAppControl(); + if (req_appcontrol) { + let data = req_appcontrol.appControl.data; + data.forEach((bundle) => { + if (bundle.key === 'push_reg_id') { + req_id = bundle.value[0]; + return false; + } + }) + } + const device = { device_ip: this.device_ip, device_name: this.device_name, - login_id: this.login_id + login_id: this.login_id, + req_id }; console.log(`${TAG} device :`, device); const data = JSON.stringify(device); -- 2.7.4 From 32173918d0ebb7ac60cb0ee83b99de0f617e04f6 Mon Sep 17 00:00:00 2001 From: Surya Kumar Date: Tue, 22 Feb 2022 21:29:44 +0530 Subject: [PATCH 04/16] [HOTFIX] Skip chromium-efl revision check Revision check is failing with latest M94 chromium-efl rpm, breaking wrtjs rpm installation, so skipping the check temporarily Change-Id: I909cf665e4c6abf2ee71abcdaf6b898f3cb5d679 Signed-off-by: Surya Kumar --- packaging/wrtjs.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index e605fba..c62a600 100644 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -257,7 +257,7 @@ else fi echo -e "* please re-install chromium-efl as revision $WRTJS_REVISION first." echo -e "*****************************************************\033[m" - exit 1 + echo -e "but going through" fi %post -- 2.7.4 From 62b8195365302d43a2f707422f254e510358fb16 Mon Sep 17 00:00:00 2001 From: Surya Kumar Date: Fri, 25 Feb 2022 16:38:22 +0530 Subject: [PATCH 05/16] Revert "[HOTFIX] Skip chromium-efl revision check" This reverts commit 32173918d0ebb7ac60cb0ee83b99de0f617e04f6 since fix has landed from chromium-efl side Depends on: https://review.tizen.org/gerrit/271727 Change-Id: I6296b34fcdba68c81fe5ab5494fca8a0f52fafd6 Signed-off-by: Surya Kumar --- packaging/wrtjs.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index c62a600..e605fba 100644 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -257,7 +257,7 @@ else fi echo -e "* please re-install chromium-efl as revision $WRTJS_REVISION first." echo -e "*****************************************************\033[m" - echo -e "but going through" + exit 1 fi %post -- 2.7.4 From b4ac724e0687b9f02e5e33826bfdc15faca593cd Mon Sep 17 00:00:00 2001 From: Surya Kumar Date: Tue, 1 Mar 2022 12:53:10 +0530 Subject: [PATCH 06/16] Disable typescript checks temporarily This change disables strict TS checks to resolve M85 SR build failures Change-Id: I919041e13c7fbc9415d86cb0547f889a380c42f7 Signed-off-by: Surya Kumar --- wrt_app/addon/browser/modules/window.ts | 2 ++ wrt_app/src/web_application.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/wrt_app/addon/browser/modules/window.ts b/wrt_app/addon/browser/modules/window.ts index b775fe8..4ee3195 100644 --- a/wrt_app/addon/browser/modules/window.ts +++ b/wrt_app/addon/browser/modules/window.ts @@ -1,3 +1,5 @@ +// @ts-nocheck + 'use strict'; import { dialog, BrowserWindow } from 'electron'; diff --git a/wrt_app/src/web_application.ts b/wrt_app/src/web_application.ts index b206872..bdf777f 100644 --- a/wrt_app/src/web_application.ts +++ b/wrt_app/src/web_application.ts @@ -1,3 +1,5 @@ +// @ts-nocheck + /* * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved * -- 2.7.4 From 9b23c1bb96d0d1f1e137e6f3edfcefe182516ad3 Mon Sep 17 00:00:00 2001 From: "yman.son" Date: Mon, 7 Mar 2022 15:18:01 +0900 Subject: [PATCH 07/16] [VD] add metadata-profile.xml Create a description of some metadata being used by the VD. This will be managed by PLATZ system. (SE team request) Change-Id: If9ea8c67f2aaf6db085aceef4bf7136338ab9fba Signed-off-by: yman.son --- packaging/metadata-profile.xml | 60 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 packaging/metadata-profile.xml diff --git a/packaging/metadata-profile.xml b/packaging/metadata-profile.xml new file mode 100755 index 0000000..8eb87d7 --- /dev/null +++ b/packaging/metadata-profile.xml @@ -0,0 +1,60 @@ + + + + + Y + 1.0 + + false | true + + + true : Normal device. + false : Low performance device. (Priority is higher than this metadata.) + + + + + + + + N + 1.0 + + true | false + + + false + + + + + + + + Y + 1.0 + + true | false + + + false : Opaque window. + + + + + + + + N + 1.0 + + true | false + + + true + + + + + + -- 2.7.4 From 5172c7c332f15f9f91fabbcd412d43dcc723ae6d Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Fri, 4 Mar 2022 10:20:55 +0900 Subject: [PATCH 08/16] [Service][VD] Add webapis.getPreviewData() This provides preview tiles data for DeviceHome service. Related chromium-efl patch: https://review.tizen.org/gerrit/269316/ Change-Id: I2c4df503ab1791a63768bd5effdd82f99ad9fdca Signed-off-by: DongHyun Song --- wrt_app/service/device_api_router.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index b0a2b6d..5f30ad0 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -56,11 +56,23 @@ export class DeviceAPIRouter { global.webapis.postPlainNotification = (title: string, message: string, timeout?: number) => { return wrt.postPlainNotification(title, message, timeout ?? 10); } + global.webapis.getPreviewData = (packageId: string) => { + try { + if (wrt.tv) + return wrt.tv.getPreviewData(packageId); + else + throw 'This API is only for TV profile'; + } catch(e) { + console.debug(`wrt.tv.getPreviewData('${packageId}') failed, ${e}`); + return { images: 'no' }; + } + } Object.defineProperties(global.webapis, { getCallerAppId: { writable: false, enumerable: true }, getPackageId: { writable: false, enumerable: true }, getServiceId: { writable: false, enumerable: true }, postPlainNotification: { writable: false, enumerable: true }, + getPreviewData: { writable: false, enumerable: true }, }); this.initMDEWebapis(); this.initEdgeWebapis(); -- 2.7.4 From 256507147ae41cf61365756cac27a616a7a23d82 Mon Sep 17 00:00:00 2001 From: zhaosy Date: Thu, 10 Mar 2022 14:53:55 +0800 Subject: [PATCH 09/16] [VD]Show window for preload app in deeplink scenario If app is preload, and then deeplink launch it, doesn't call show window, so app is not showing in foreground. Change-Id: I0c1f9eeacc06cbbc0b6332077167540185164c36 Signed-off-by: zhaosy --- wrt_app/src/tv/web_application_tv.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wrt_app/src/tv/web_application_tv.ts b/wrt_app/src/tv/web_application_tv.ts index ca8a5d0..65e7499 100644 --- a/wrt_app/src/tv/web_application_tv.ts +++ b/wrt_app/src/tv/web_application_tv.ts @@ -231,6 +231,9 @@ Then you can get profile log from the initial loading.`; this.webApplication.sendAppControlEvent(); return false; } else { + if (!this.webApplication.mainWindow.isVisible()) + this.webApplication.show(); + let skipReload = appControl.getData('SkipReload'); if (skipReload == 'Yes') { console.log('skipping reload'); -- 2.7.4 From ad13bc8f7207c7b27a5e050a48b79cb3c4a97ae8 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Thu, 10 Mar 2022 17:23:22 +0900 Subject: [PATCH 10/16] [Service][VD] Add mde APIs to handle remote input 'updateRemoteInput' is an API to fill the input string at the IME input field. 'selectRemoteInput' is an API to submit the string of IME form. Change-Id: I2ff3f77d267e0e6e8e586485c8b590b78f96d241 Signed-off-by: DongHyun Song --- wrt_app/service/device_api_router.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index 5f30ad0..afbd161 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -99,6 +99,12 @@ export class DeviceAPIRouter { global.webapis.mde.initVirtualEventGenerator = (type: number) => { return mde.initVirtualEventGenerator(type); } + global.webapis.mde.updateRemoteInput = (inputString: string) => { + mde.updateRemoteInput(inputString); + } + global.webapis.mde.selectRemoteInput = () => { + mde.selectRemoteInput(); + } } global.webapis.mde.getCurrentLoginId = () => { return mde.getCurrentLoginId(); -- 2.7.4 From 896a407d511e7961c7160c771a01fdbb9fc3772a Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Mon, 14 Mar 2022 15:11:20 +0900 Subject: [PATCH 11/16] [Service][TV] Introduce ServiceMessage This introduces service message notification for DeviceHome The case doesn't use Samsung IME, the UI app can utilize ServiceMessage to catch propagating message from DeviceHome. notifyServiceMessage() will give a message only to foreground application. Change-Id: If36cb754382fc2c0f6d186c212a40c28ccf3eb9b Signed-off-by: DongHyun Song --- wrt_app/common/service_message.ts | 20 ++++++++++++++++++++ wrt_app/service/device_api_router.ts | 2 ++ 2 files changed, 22 insertions(+) create mode 100644 wrt_app/common/service_message.ts diff --git a/wrt_app/common/service_message.ts b/wrt_app/common/service_message.ts new file mode 100644 index 0000000..4080701 --- /dev/null +++ b/wrt_app/common/service_message.ts @@ -0,0 +1,20 @@ +import { wrt } from '../browser/wrt'; + +let foregroundAppMessagePort: any = null; +let lastForegroundApp: string = ''; + +export function notifyServiceMessage(type: string, message: string) { + let foregroundApp = wrt.tv?.getForegroundApp(); + if (!foregroundApp || foregroundApp == 'none') + return; + + try { + if (!foregroundAppMessagePort || lastForegroundApp != foregroundApp) { + foregroundAppMessagePort = + global.tizen.messageport.requestRemoteMessagePort(foregroundApp, 'wrt.message.port'); + lastForegroundApp = foregroundApp; + } + if (foregroundAppMessagePort) + foregroundAppMessagePort.sendMessage([{key: type, value: ['', message]}]); + } catch { } +} diff --git a/wrt_app/service/device_api_router.ts b/wrt_app/service/device_api_router.ts index afbd161..eed2979 100644 --- a/wrt_app/service/device_api_router.ts +++ b/wrt_app/service/device_api_router.ts @@ -1,4 +1,5 @@ import { wrt } from '../browser/wrt'; +import * as ServiceMessage from '../common/service_message'; export class DeviceAPIRouter { currentApplication: any; @@ -101,6 +102,7 @@ export class DeviceAPIRouter { } global.webapis.mde.updateRemoteInput = (inputString: string) => { mde.updateRemoteInput(inputString); + ServiceMessage.notifyServiceMessage('remote-input', inputString); } global.webapis.mde.selectRemoteInput = () => { mde.selectRemoteInput(); -- 2.7.4 From 87546938930b8d7f30cc3f5a686d019a77ff809f Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Mon, 14 Mar 2022 15:12:47 +0900 Subject: [PATCH 12/16] [Service] Debugging condole.log with ServiceMessage There is no way to get the console message with commercial products because Tizen SDK cannot get the 'dlog' actually. - 'dlog' is disabled on release firmware. Thus, this way provides a new way to catch the console message of service application by UI application's message port - local message port 'wrt.message.port' - message format : {'service-log' : message } Change-Id: Ia42dbecb9daa492ffe58b4b5550d804569190232 Signed-off-by: DongHyun Song --- wrt_app/common/service_message.ts | 31 +++++++++++++++++++++++++++++-- wrt_app/service/service_runner.ts | 13 +++++-------- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/wrt_app/common/service_message.ts b/wrt_app/common/service_message.ts index 4080701..33ceb3b 100644 --- a/wrt_app/common/service_message.ts +++ b/wrt_app/common/service_message.ts @@ -1,7 +1,9 @@ import { wrt } from '../browser/wrt'; +let funcConsoleLog: any = null; let foregroundAppMessagePort: any = null; let lastForegroundApp: string = ''; +const wrtCommonPort = 'wrt.message.port'; export function notifyServiceMessage(type: string, message: string) { let foregroundApp = wrt.tv?.getForegroundApp(); @@ -11,10 +13,35 @@ export function notifyServiceMessage(type: string, message: string) { try { if (!foregroundAppMessagePort || lastForegroundApp != foregroundApp) { foregroundAppMessagePort = - global.tizen.messageport.requestRemoteMessagePort(foregroundApp, 'wrt.message.port'); + global.tizen.messageport.requestRemoteMessagePort(foregroundApp, wrtCommonPort); lastForegroundApp = foregroundApp; } if (foregroundAppMessagePort) - foregroundAppMessagePort.sendMessage([{key: type, value: ['', message]}]); + foregroundAppMessagePort.sendMessage([{ key: type, value: ['', message] }]); } catch { } } + +export function initConsoleMessageNotification(id: string) { + try { + let mainAppId = wrt.getMainAppId(id); + if (!mainAppId) + return; + + let mainAppMessagePort = global.tizen.messageport.requestRemoteMessagePort( + mainAppId, wrtCommonPort); + if (!mainAppMessagePort) + return; + + Object.defineProperty(global, 'mainAppMessagePort', + { value: mainAppMessagePort, writable: false }); + + funcConsoleLog = console.log; + console.log = (log: any) => { + funcConsoleLog(log); + if (global.mainAppMessagePort) { + let value = [id, log.toString()]; + global.mainAppMessagePort.sendMessage([{ key: 'service-log', value }]); + } + } + } catch { } +} \ No newline at end of file diff --git a/wrt_app/service/service_runner.ts b/wrt_app/service/service_runner.ts index c7e40d2..405c9e9 100644 --- a/wrt_app/service/service_runner.ts +++ b/wrt_app/service/service_runner.ts @@ -3,11 +3,7 @@ import * as XWalkExtension from '../common/wrt_xwalk_extension'; import { DeviceAPIRouter } from './device_api_router'; import { isMainThread, parentPort, workerData } from 'worker_threads'; import { wrt } from '../browser/wrt'; - -Object.defineProperty(global, 'serviceType', { - value: wrt.getServiceModel(), - writable: false -}); +import * as ServiceMessage from '../common/service_message'; function isServiceApplication() { return global['serviceType'] !== 'UI'; @@ -90,6 +86,7 @@ export function start(id: string, filename: string) { console.debug(`serviceType : ${global['serviceType']}`) new DeviceAPIRouter(id, isGlobalService()); printAppControlData(id); + ServiceMessage.initConsoleMessageNotification(id); // This is for awaking up uv loop. if (isGlobalService()) { @@ -146,9 +143,9 @@ function run() { process.exit(); } - Object.defineProperty(global, 'internalId', { - value: id, - writable: false + Object.defineProperties(global, { + 'internalId': { value: id, writable: false }, + 'serviceType': { value: wrt.getServiceModel(), writable: false } }); let filename = workerData.filename; -- 2.7.4 From 3f3746a295456a15adf97f49ce18fa4e5ef1eb2b Mon Sep 17 00:00:00 2001 From: "yman.son" Date: Fri, 25 Mar 2022 16:51:11 +0900 Subject: [PATCH 13/16] [VD] resolve metadata-profile.xml parsing error if use the metadata sample used for config.xml, need add xmlns information to the profile. Change-Id: Ic935970691f3ca5b4148521e868858255c33c816 Signed-off-by: yman.son --- packaging/metadata-profile.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/metadata-profile.xml b/packaging/metadata-profile.xml index 8eb87d7..bb68518 100755 --- a/packaging/metadata-profile.xml +++ b/packaging/metadata-profile.xml @@ -1,5 +1,5 @@ - + Y -- 2.7.4 From 124042b9cc4c28c514d218a1b92e5feb239baf1d Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Wed, 23 Mar 2022 09:46:07 +0900 Subject: [PATCH 14/16] [Service] Unset post callbacks Unexpectedly, post callbacks can be fired from webapi worker thread after its wrt::api::XwalkExtension instance was destroyed. Thus, this will unset the post callbacks on unloadInstance API. Related chromium-efl patch: https://review.tizen.org/gerrit/272695/ Change-Id: I82e5bdfc48bed4b4d208ca6dd485bdffd1c31a0d Signed-off-by: DongHyun Song --- wrt_app/common/wrt_xwalk_extension.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wrt_app/common/wrt_xwalk_extension.ts b/wrt_app/common/wrt_xwalk_extension.ts index 4e32394..c0c9971 100644 --- a/wrt_app/common/wrt_xwalk_extension.ts +++ b/wrt_app/common/wrt_xwalk_extension.ts @@ -230,6 +230,9 @@ export const setRuntimeMessageHandler = (handler: (type: string, data?: string, } export let cleanup = () => { + for (const name in extensions_) { + extensions_[name].unloadInstance(); + } delete global.tizen; instance = undefined; } -- 2.7.4 From dab685448500e096a504ba992755513502307b8e Mon Sep 17 00:00:00 2001 From: liwei Date: Wed, 13 Apr 2022 17:22:11 +0800 Subject: [PATCH 15/16] [VD] Send appcontrol data to app in 'ResumeWithAppControl' Send appcontrol data to app side when appcontrol data 'ResumeWithAppControl =Yes',then app can use the key/value flexibility. Change-Id: Id3101bf03c1fc35885e08871c582ea7d4bd7dea8 Signed-off-by: liwei --- wrt_app/src/tv/web_application_tv.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wrt_app/src/tv/web_application_tv.ts b/wrt_app/src/tv/web_application_tv.ts index 65e7499..d3668fc 100644 --- a/wrt_app/src/tv/web_application_tv.ts +++ b/wrt_app/src/tv/web_application_tv.ts @@ -219,6 +219,7 @@ Then you can get profile log from the initial loading.`; handleAppControlEvent(appControl: any) { this.launchMode = appControl.getData('http://samsung.com/appcontrol/data/launch_mode'); this.preloadStatus = 'none'; + let resumeWithAppControl = appControl.getData('ResumeWithAppControl'); if (this.launchMode === 'runningAsBackground') { this.webApplication.suspended = false; @@ -226,7 +227,7 @@ Then you can get profile log from the initial loading.`; this.webApplication.windowList[this.webApplication.windowList.length - 1].hide(); this.webApplication.sendAppControlEvent(); return false; - } else if (this.launchMode === 'runningAsForeground') { + } else if ((this.launchMode === 'runningAsForeground') || (resumeWithAppControl === 'Yes')) { this.webApplication.resume(); this.webApplication.sendAppControlEvent(); return false; -- 2.7.4 From ae6a06f318887167255a3d599a5d23b5a200d525 Mon Sep 17 00:00:00 2001 From: DongHyun Song Date: Wed, 20 Apr 2022 16:07:51 +0900 Subject: [PATCH 16/16] [DeviceHome][VD] Fix setting the 'wsa' path The start page includes 'wsa' path, then replace the base path as /res/wsa/client/ for tmg app. Change-Id: Iaed061140e26ee04a78402fb1879bc861f7cb4a4 Signed-off-by: DongHyun Song --- 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 138dd23..4cf8593 100755 --- a/device_home/service/service.js +++ b/device_home/service/service.js @@ -357,7 +357,7 @@ var HTTPserverStart = function() { if (is_tv) { platform_app_path = '/opt/usr/apps'; - if (!fs.existsSync(path.join(__dirname, platform_client_res_path))) { + if (__dirname.indexOf('/wsa/') > -1) { platform_client_res_path = '/res/wsa/client'; } console.log(`${TAG} TV Profile`); -- 2.7.4