From e162b3ab6ed8ca9b6920a9694170735f6336c090 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Thu, 28 Nov 2019 18:15:18 +0100 Subject: [PATCH] Avoid duplicated GeckoSession setActive calls (#2392) * Avoid duplicated GeckoSession setActive calls * Ensure we save state and call Telemetry --- .../mozilla/vrbrowser/browser/engine/Session.java | 4 +++- .../org/mozilla/vrbrowser/ui/widgets/Windows.java | 13 ------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java index 56606b123..ddd50f426 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/engine/Session.java @@ -658,7 +658,9 @@ public void setActive(boolean aActive) { } if (mState.mSession != null) { - mState.mSession.setActive(aActive); + if (mState.isActive() != aActive) { + mState.mSession.setActive(aActive); + } mState.setActive(aActive); } else if (aActive) { restore(); diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java index c70114722..a3ede2886 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java @@ -412,24 +412,11 @@ public void onPause() { mIsPaused = true; saveState(); - for (WindowWidget window: mRegularWindows) { - window.onPause(); - } - for (WindowWidget window: mPrivateWindows) { - window.onPause(); - } } public void onResume() { mIsPaused = false; - for (WindowWidget window: mRegularWindows) { - window.onResume(); - } - for (WindowWidget window: mPrivateWindows) { - window.onResume(); - } - TelemetryWrapper.resetOpenedWindowsCount(mRegularWindows.size(), false); TelemetryWrapper.resetOpenedWindowsCount(mPrivateWindows.size(), true); }