From 852224164f8d9396307d1e2faa395b2b24d3cf94 Mon Sep 17 00:00:00 2001 From: Surya Kumar Date: Tue, 18 Feb 2020 19:03:05 +0530 Subject: [PATCH] Defer showing window when appcontrol-reset is being done In Appcontrol-reload case, if window is shown before frame rendered, expired content is visible for a considerable time. Avoid it by showing the window only after frame has been rendered Reference: https://review.tizen.org/gerrit/182918 Change-Id: Icd4877727488e40ffe65f5699c0d3a49dc35a208 Signed-off-by: Surya Kumar (cherry picked from commit a4a4da6c20b97bb809b579b050c4dc07f5f3e7f1) --- wrt_app/src/runtime.js | 3 +-- wrt_app/src/web_application.js | 38 +++++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/wrt_app/src/runtime.js b/wrt_app/src/runtime.js index af747b2..606fe2b 100755 --- a/wrt_app/src/runtime.js +++ b/wrt_app/src/runtime.js @@ -183,8 +183,7 @@ class Runtime { if (reload && appControl.getOperation() == 'http://tizen.org/appcontrol/operation/main') reload = false; if (reload) { - _this.webApplication.closeWindows(); - _this.webApplication.mainWindow.loadURL(src); + _this.webApplication.handleAppControlReload(src); } else { _this.webApplication.sendAppControlEvent(); } diff --git a/wrt_app/src/web_application.js b/wrt_app/src/web_application.js index 270a1ef..556ca14 100644 --- a/wrt_app/src/web_application.js +++ b/wrt_app/src/web_application.js @@ -30,7 +30,6 @@ class WebApplication { this.pendingID = 0; this.pendingCallbacks = new Map(); this.windowList = []; - this.firstRendered = false; this.backgroundSupport = wrt.getBackgroundSupport(); this.debugPort = 0; this.inspectorSrc = ''; @@ -52,7 +51,6 @@ class WebApplication { this.defaultBackgroundColor = (wrt.tv ? '#0000' : ((wrt.getPlatformType() === "product_wearable") ? '#000' : '#FFF')); this.defaultTransparent = (wrt.tv ? true : false); - this.suspended = false; this.loadFinished = false; this.runningStatus = 'none'; this.addonEmitter = null; @@ -235,16 +233,8 @@ class WebApplication { detached: true }); } + this.initDisplayDelay(true); let self = this; - if (!wrt.showSplashScreen() && !wrt.tv) { - self.showTimer = setTimeout(() => { - if (!self.suspended) { - console.log('FrameRendered not obtained from engine. To show window, timer fired'); - self.mainWindow.emit('ready-to-show'); - } - }, 2000); - } - this.mainWindow.once('ready-to-show', function() { console.log('mainWindow ready-to-show'); if (self.showTimer) @@ -278,6 +268,32 @@ class WebApplication { self.addonEmitter.emit('contentDidFinishLoad', self.mainWindow.id); }); } + initDisplayDelay(firstLaunch) { + // TODO: On 6.0, this causes a black screen on relaunch + if (firstLaunch) + this.firstRendered = false; + this.suspended = false; + if (this.showTimer) + clearTimeout(this.showTimer); + let splashShown = firstLaunch && wrt.showSplashScreen(); + if (!splashShown && !wrt.tv) { + let self = this; + self.showTimer = setTimeout(() => { + if (!self.suspended) { + console.log('FrameRendered not obtained from engine. To show window, timer fired'); + self.mainWindow.emit('ready-to-show'); + } + }, 2000); + } + if (!firstLaunch && !this.backgroundRunnable()) + this.mainWindow.setEnabled(true); + } + handleAppControlReload(src) { + console.log('WebApplication : handleAppControlReload'); + this.closeWindows(); + this.initDisplayDelay(false); + this.mainWindow.loadURL(src); + } suspendByStatus() { if (this.preloadStatus === 'readyToShow' || this.preloadStatus === 'preload' || -- 2.7.4