Merge "Gallery2: Fix status bar and menu list are overlapped in photopage." into android_ui.lnx.1.2-dev
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java
index 11be8c6..8ca584a 100644
--- a/src/com/android/gallery3d/app/ActivityState.java
+++ b/src/com/android/gallery3d/app/ActivityState.java
@@ -46,6 +46,7 @@
     protected static final int FLAG_SCREEN_ON_ALWAYS = 8;
     protected static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 16;
     protected static final int FLAG_SHOW_WHEN_LOCKED = 32;
+    protected static final int FLAG_SCREEN_FULL = 64;
 
     protected AbstractGalleryActivity mActivity;
     protected Bundle mData;
@@ -164,6 +165,12 @@
         } else {
             params.flags &= ~WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED;
         }
+
+        if (0 != (mFlags & FLAG_SCREEN_FULL)) {
+            params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
+        } else {
+            params.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
+        }
         win.setAttributes(params);
     }
 
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index ac89a03..9f7a054 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -41,6 +41,7 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
+import android.view.WindowManager;
 import android.widget.RelativeLayout;
 import android.widget.ShareActionProvider;
 import android.widget.Toast;
@@ -1470,6 +1471,7 @@
         }
         mActivity.getGLRoot().unfreeze();
         mHandler.removeMessages(MSG_UNFREEZE_GLROOT);
+        showFullScreen(false);
 
         DetailsHelper.pause();
         // Hide the detail dialog on exit
@@ -1490,6 +1492,19 @@
         if (mMediaSet != null) mMediaSet.clearDeletion();
     }
 
+    private void showFullScreen(boolean show) {
+        Window win = mActivity.getWindow();
+        WindowManager.LayoutParams winParams = win.getAttributes();
+        if (show) {
+            //set full screen
+            winParams.flags |= (WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        } else {
+            //cancel full screen
+            winParams.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
+        }
+        win.setAttributes(winParams);
+    }
+
     @Override
     public void onCurrentImageUpdated() {
         mActivity.getGLRoot().unfreeze();
@@ -1580,6 +1595,9 @@
             mActivity.getStateManager().finishState(this);
             return;
         }
+        //set full screen to hide the status bar
+        showFullScreen(true);
+
         transitionFromAlbumPageIfNeeded();
 
         mActivity.getGLRoot().freeze();
diff --git a/src/com/android/gallery3d/app/SlideshowPage.java b/src/com/android/gallery3d/app/SlideshowPage.java
index ca46ce3..ffc5dbf 100644
--- a/src/com/android/gallery3d/app/SlideshowPage.java
+++ b/src/com/android/gallery3d/app/SlideshowPage.java
@@ -113,7 +113,7 @@
     @Override
     public void onCreate(Bundle data, Bundle restoreState) {
         super.onCreate(data, restoreState);
-        mFlags |= (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR);
+        mFlags |= (FLAG_HIDE_ACTION_BAR | FLAG_HIDE_STATUS_BAR | FLAG_SCREEN_FULL);
         if (data.getBoolean(KEY_DREAM)) {
             // Dream screensaver only keeps screen on for plugged devices.
             mFlags |= FLAG_SCREEN_ON_WHEN_PLUGGED | FLAG_SHOW_WHEN_LOCKED;