Bug 1134192 - Add ActivityUtils.isFullScreen. r=mfinkle, a=lizzard
authorMichael Comella <michael.l.comella@gmail.com>
Mon, 23 Feb 2015 13:11:21 -0800
changeset 250079 f18e2aecea6d
parent 250078 e7319d343f20
child 250080 b23a690fa325
push id4497
push userryanvm@gmail.com
push date2015-02-25 20:26 +0000
treeherdermozilla-beta@b23a690fa325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lizzard
bugs1134192
milestone37.0
Bug 1134192 - Add ActivityUtils.isFullScreen. r=mfinkle, a=lizzard A more complete solution would rework our fullscreen support to ensure the flags are consistently used (e.g. reader mode just uses low_profile even though ActivityUtils.setFullScreen does both low profile and fullscreen).
mobile/android/base/util/ActivityUtils.java
--- a/mobile/android/base/util/ActivityUtils.java
+++ b/mobile/android/base/util/ActivityUtils.java
@@ -31,9 +31,21 @@ public class ActivityUtils {
 
             window.getDecorView().setSystemUiVisibility(newVis);
         } else {
             window.setFlags(fullscreen ?
                             WindowManager.LayoutParams.FLAG_FULLSCREEN : 0,
                             WindowManager.LayoutParams.FLAG_FULLSCREEN);
         }
     }
+
+    public static boolean isFullScreen(final Activity activity) {
+        final Window window = activity.getWindow();
+
+        if (Versions.feature11Plus) {
+            final int vis = window.getDecorView().getSystemUiVisibility();
+            return (vis & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;
+        } else {
+            final int flags = window.getAttributes().flags;
+            return ((flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0);
+        }
+    }
 }