Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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.
Jump to
Jump to file
Failed to load files.
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