Bug 1612785 - GVE should set WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_* via onMetaViewportFitChange. r=geckoview-reviewers,snorp

This is follow up of bug 1574307 (and bug 1503656).

Differential Revision: https://phabricator.services.mozilla.com/D61431

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Makoto Kato 2020-02-06 16:55:15 +00:00
parent 1852a29c3b
commit 494b9d8d45

View File

@ -1135,6 +1135,22 @@ public class GeckoViewActivity
}
return null;
}
@Override
public void onMetaViewportFitChange(final GeckoSession session, final String viewportFit) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
return;
}
WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
if (viewportFit.equals("cover")) {
layoutParams.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
} else if (viewportFit.equals("contain")) {
layoutParams.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER;
} else {
layoutParams.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
}
getWindow().setAttributes(layoutParams);
}
}
private class ExampleProgressDelegate implements GeckoSession.ProgressDelegate {