Defer showing window when appcontrol-reset is being done 28/231828/4
authorSurya Kumar <surya.kumar7@samsung.com>
Tue, 18 Feb 2020 13:33:05 +0000 (19:03 +0530)
committerSurya Kumar <surya.kumar7@samsung.com>
Mon, 27 Apr 2020 10:22:52 +0000 (10:22 +0000)
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 <surya.kumar7@samsung.com>
(cherry picked from commit a4a4da6c20b97bb809b579b050c4dc07f5f3e7f1)

wrt_app/src/runtime.js
wrt_app/src/web_application.js

index af747b2..606fe2b 100755 (executable)
@@ -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();
                     }
index 270a1ef..556ca14 100644 (file)
@@ -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' ||