Bug 1369815 - Set the display mode for standalone PWA r=droeh
☠☠ backed out by 4871dc084c88 ☠ ☠
authorJames Willcox <snorp@snorp.net>
Thu, 10 Aug 2017 11:56:17 -0500
changeset 374793 a758c86dd864ccabbdb4225075bf932d4c146683
parent 374792 d25a5921d961a0f5dc392a785f5d46704ca82bfa
child 374794 e018aed689755170416b0bda839cc5c7f01c6764
push id93765
push userjwillcox@mozilla.com
push dateTue, 15 Aug 2017 14:30:19 +0000
treeherdermozilla-inbound@4fb119706335 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdroeh
bugs1369815
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1369815 - Set the display mode for standalone PWA r=droeh MozReview-Commit-ID: EGCskj6pwkC
mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
--- a/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
+++ b/mobile/android/base/java/org/mozilla/gecko/webapps/WebAppActivity.java
@@ -177,16 +177,39 @@ public class WebAppActivity extends AppC
 
         GeckoScreenOrientation.ScreenOrientation orientation =
             GeckoScreenOrientation.screenOrientationFromString(orientString);
         int activityOrientation = GeckoScreenOrientation.screenOrientationToAndroidOrientation(orientation);
 
         setRequestedOrientation(activityOrientation);
     }
 
+    private void updateDisplayMode(JSONObject manifest) {
+        String displayMode = manifest.optString("display");
+
+        GeckoViewSettings.DisplayMode mode;
+        switch (displayMode) {
+            case "standalone":
+                mode = GeckoViewSettings.DisplayMode.STANDALONE;
+                break;
+            case "fullscreen":
+                mode = GeckoViewSettings.DisplayMode.FULLSCREEN;
+                break;
+            case "minimal-ui":
+                mode = GeckoViewSettings.DisplayMode.MINIMAL_UI;
+                break;
+            case "browser":
+            default:
+                mode = GeckoViewSettings.DisplayMode.BROWSER;
+                break;
+        }
+
+        mGeckoView.getSettings().setInt(GeckoViewSettings.USE_DISPLAY_MODE, mode.value());
+    }
+
     private Integer readColorFromManifest(JSONObject manifest) {
         final String colorStr = manifest.optString("theme_color", null);
         if (colorStr != null) {
             return ColorUtil.parseStringColor(colorStr);
         }
         return null;
     }