Add option to toggle the new overscan mode.

Change-Id: I552a1c8b36650c558fe6f4e3e1a9e40137d7274f
diff --git a/samples/ApiDemos/res/layout/overscan.xml b/samples/ApiDemos/res/layout/overscan.xml
index ebae5cc..4f4d61f 100644
--- a/samples/ApiDemos/res/layout/overscan.xml
+++ b/samples/ApiDemos/res/layout/overscan.xml
@@ -163,6 +163,14 @@
                         android:text="FULLSCREEN"
                         />
                     <CheckBox
+                        android:id="@+id/windowOverscan"
+                        android:layout_width="wrap_content"
+                        android:layout_height="wrap_content"
+                        android:layout_marginTop="-10dp"
+                        android:textColor="#FFFFFFFF"
+                        android:text="OVERSCAN"
+                        />
+                    <CheckBox
                         android:id="@+id/windowHideActionBar"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/OverscanActivity.java b/samples/ApiDemos/src/com/example/android/apis/view/OverscanActivity.java
index 3097992..87aaa48 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/OverscanActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/OverscanActivity.java
@@ -126,6 +126,18 @@
         win.setAttributes(winParams);
     }
 
+    private void setOverscan(boolean on) {
+        Window win = getWindow();
+        WindowManager.LayoutParams winParams = win.getAttributes();
+        final int bits = WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN;
+        if (on) {
+            winParams.flags |=  bits;
+        } else {
+            winParams.flags &= ~bits;
+        }
+        win.setAttributes(winParams);
+    }
+
     private String getDisplaySize() {
         DisplayMetrics dm = getResources().getDisplayMetrics();
         return String.format("DisplayMetrics = (%d x %d)", dm.widthPixels, dm.heightPixels);
@@ -185,6 +197,14 @@
                     }
                 }
         );
+        ((CheckBox) findViewById(R.id.windowOverscan)).setOnCheckedChangeListener(
+                new CompoundButton.OnCheckedChangeListener() {
+                    @Override
+                    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+                        setOverscan(isChecked);
+                    }
+                }
+        );
         ((CheckBox) findViewById(R.id.windowHideActionBar)).setOnCheckedChangeListener(
                 new CompoundButton.OnCheckedChangeListener() {
                     @Override