Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit 2f3c8a8

Browse files
keianhzobluemarvin
authored andcommitted
Set session stack active state based on the window visibility (#1717)
1 parent 9f84d3f commit 2f3c8a8

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,6 @@ protected void onPause() {
341341
}
342342
mAudioEngine.pauseEngine();
343343

344-
SessionStore.get().onPause();
345-
346344
mWindows.onPause();
347345

348346
for (Widget widget: mWidgets.values()) {
@@ -365,7 +363,7 @@ protected void onResume() {
365363
mOffscreenDisplay.onResume();
366364
}
367365

368-
SessionStore.get().onResume();
366+
mWindows.onResume();
369367

370368
mAudioEngine.resumeEngine();
371369
for (Widget widget: mWidgets.values()) {

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/WindowWidget.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,20 @@ protected void onDismiss() {
239239
}
240240
}
241241

242+
@Override
243+
public void onPause() {
244+
super.onPause();
245+
mSessionStack.setActive(false);
246+
}
247+
248+
@Override
249+
public void onResume() {
250+
super.onResume();
251+
if (isVisible()) {
252+
mSessionStack.setActive(true);
253+
}
254+
}
255+
242256
public void close() {
243257
TelemetryWrapper.closeWindowEvent(mWindowId);
244258

@@ -837,6 +851,7 @@ public void setVisible(boolean aVisible) {
837851
if (mWidgetPlacement.visible == aVisible) {
838852
return;
839853
}
854+
mSessionStack.setActive(aVisible);
840855
mWidgetPlacement.visible = aVisible;
841856
if (!aVisible) {
842857
if (mIsBookmarksVisible || mIsHistoryVisible) {

app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,21 @@ public void resumeCompositor() {
364364

365365
public void onPause() {
366366
saveState();
367+
for (WindowWidget window: mRegularWindows) {
368+
window.onPause();
369+
}
370+
for (WindowWidget window: mPrivateWindows) {
371+
window.onPause();
372+
}
373+
}
374+
375+
public void onResume() {
376+
for (WindowWidget window: mRegularWindows) {
377+
window.onResume();
378+
}
379+
for (WindowWidget window: mPrivateWindows) {
380+
window.onResume();
381+
}
367382
}
368383

369384
public void onDestroy() {

0 commit comments

Comments
 (0)