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

Prevent duplicated callSurfaceChanged call when exiting immersive mode #2961

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ public boolean hasCapturedBitmap() {
return BitmapCache.getInstance(mContext).hasBitmap(mState.mId);
}

public boolean hasDisplay() {
return mState != null && mState.mDisplay != null;
}

public void purgeHistory() {
if (mState.mSession != null) {
mState.mSession.purgeHistory();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public void onResume() {
super.onResume();
if (isVisible() || mIsInVRVideoMode) {
mSession.setActive(true);
if (!SettingsStore.getInstance(getContext()).getLayersEnabled()) {
if (!SettingsStore.getInstance(getContext()).getLayersEnabled() && !mSession.hasDisplay()) {
Comment on lines 316 to +317
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can just check if the mSession is active and then only call setActive(true) and callSurfaceChanged() if it isn't?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think is safer to keep this check. My worry is that other place of code calls SetActive before this method and in that case we would miss the surfaceChanged call

// Ensure the Gecko Display is correctly recreated.
// See: https://github.com/MozillaReality/FirefoxReality/issues/2880
callSurfaceChanged();
Expand Down