Improve Cube Map and FrameBufferObject samples.

Fix tabs and trailing whitespace.

Expand comment to explain how we search for GL extensions.

Rename and document the DEBUG_RENDER_OFFSCREEN_ONSCREEN variable.
Also make it final static because its value never changes.
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 887fd32..ec60e15 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -4,9 +4,9 @@
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
-  
+
           http://www.apache.org/licenses/LICENSE-2.0
-  
+
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,7 +34,7 @@
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-feature android:name="android.hardware.camera" />
     <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
-    
+
     <application android:name="ApiDemosApplication"
             android:label="@string/activity_sample_code"
             android:icon="@drawable/app_sample_code" >
@@ -42,7 +42,7 @@
         <!-- This is how we can request a library but still allow the app
              to be installed if it doesn't exist. -->
         <uses-library android:name="com.example.will.never.exist" android:required="false" />
-        
+
         <activity android:name="ApiDemos">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -191,11 +191,11 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".app.ReorderTwo" />
         <activity android:name=".app.ReorderThree" />
         <activity android:name=".app.ReorderFour" />
-        
+
         <activity android:name=".app.SetWallpaperActivity"
                   android:label="@string/activity_setwallpaper">
             <intent-filter>
@@ -275,7 +275,7 @@
         </activity>
 
         <service android:name=".app.ForegroundService" />
-        
+
         <activity android:name=".app.ForegroundService$Controller"
                 android:label="@string/activity_foreground_service_controller"
                 android:launchMode="singleTop">
@@ -402,11 +402,11 @@
             <!-- whenever the user invokes search while in this Activity. -->
             <meta-data android:name="android.app.default_searchable"
                        android:value=".app.SearchQueryResults" />
-            
+
             <!-- This is not the typical way to define android.app.default_searchable, -->
             <!-- and we show it here only because we wish to confine the search demo to this -->
             <!-- section of the ApiDemos application. -->
-            
+
             <!-- For typical applications, it's simpler to define android.app.default_searchable -->
             <!-- just once, at the application level, where it serves as a default for all of -->
             <!-- the Activities in your package. -->
@@ -421,24 +421,24 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
-            
+
             <!-- This intent-filter identifies this activity as "searchable" -->
-            
+
             <intent-filter>
                 <action android:name="android.intent.action.SEARCH" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-            
+
             <!-- This metadata entry provides further configuration details for searches -->
             <!-- that are handled by this activity. -->
-            
+
             <meta-data android:name="android.app.searchable"
                        android:resource="@xml/searchable" />
         </activity>
 
         <!-- This provider declaration informs the Search Manager that you have a provider of -->
         <!-- Search suggestions, and provides information about how to access it. -->
-        
+
         <provider android:name=".app.SearchSuggestionSampleProvider"
                   android:authorities="com.example.android.apis.SuggestionProvider" />
 
@@ -446,12 +446,12 @@
 
         <!-- This section of sample code shows how your application can add shortcuts to -->
         <!-- the launcher (home screen).  Shortcuts have a three step life cycle. -->
-        
+
         <!-- 1.  Your application offers to provide shortcuts to the launcher.  When -->
         <!--     the user installs a shortcut, an activity within your application -->
         <!--     generates the actual shortcut and returns it to the launcher, where it -->
         <!--     is shown to the user as an icon. -->
-        
+
         <!-- 2.  Any time the user clicks on an installed shortcut, an intent is sent. -->
         <!--     Typically this would then be handled as necessary by an activity within -->
         <!--     your application. -->
@@ -1427,7 +1427,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.CompressedTextureActivity"
                 android:label="Graphics/OpenGL ES/Compressed Texture"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1437,7 +1437,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-                
+
         <activity android:name=".graphics.CubeMapActivity"
                 android:label="Graphics/OpenGL ES/Cube Map"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1447,8 +1447,8 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
-                        
+
+
         <activity android:name=".graphics.FrameBufferObjectActivity"
                 android:label="Graphics/OpenGL ES/Frame Buffer Object"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1458,7 +1458,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.GLSurfaceViewActivity"
                 android:label="Graphics/OpenGL ES/GLSurfaceView"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1478,7 +1478,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.MatrixPaletteActivity"
                 android:label="Graphics/OpenGL ES/Matrix Palette Skinning"
                 android:configChanges="orientation|keyboardHidden">
@@ -1487,7 +1487,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.TranslucentGLSurfaceViewActivity"
                 android:label="Graphics/OpenGL ES/Translucent GLSurfaceView"
                 android:theme="@style/Theme.Translucent"
@@ -1497,7 +1497,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.TriangleActivity"
                 android:label="Graphics/OpenGL ES/Textured Triangle"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1507,7 +1507,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.spritetext.SpriteTextActivity"
                 android:label="Graphics/OpenGL ES/Sprite Text"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1517,7 +1517,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.TouchRotateActivity"
                 android:label="Graphics/OpenGL ES/Touch Rotate"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1527,7 +1527,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.PolyToPoly" android:label="Graphics/PolyToPoly">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -1761,7 +1761,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.PurgeableBitmap" android:label="Graphics/PurgeableBitmap/NonPurgeable">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -1855,7 +1855,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".text.LogTextBox1" android:label="Text/LogTextBox">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/CubeMapActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeMapActivity.java
index 03b336e..5e3e0fd 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/CubeMapActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeMapActivity.java
@@ -208,8 +208,10 @@
             String extensions = " " + gl.glGetString(GL10.GL_EXTENSIONS) + " ";
             // The extensions string is padded with spaces between extensions, but not
             // necessarily at the beginning or end. For simplicity, add spaces at the
-            // beginning and end of the extensions string to make it easy to find an
-            // extension.
+            // beginning and end of the extensions string and the extension string.
+            // This means we can avoid special-case checks for the first or last
+            // extension, as well as avoid special-case checks when an extension name
+            // is the same as the first part of another extension name.
             return extensions.indexOf(" " + extension + " ") >= 0;
         }
     }
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java
index 0c7bf64..e3d4a28 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java
@@ -48,13 +48,20 @@
         private Triangle mTriangle;
         private Cube mCube;
         private float mAngle;
-        private boolean mDebugOffscreenRenderer = false;
+        /**
+         * Setting this to true will change the behavior  of this sample. It
+         * will suppress the normally onscreen rendering, and it will cause the
+         * rendering that would normally be done to the offscreen FBO
+         * be rendered onscreen instead. This can be helpful in debugging the
+         * rendering algorithm.
+         */
+        private static final boolean DEBUG_RENDER_OFFSCREEN_ONSCREEN = false;
 
         public void onDrawFrame(GL10 gl) {
             checkGLError(gl);
             if (mContextSupportsFrameBufferObject) {
                 GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl;
-                if (mDebugOffscreenRenderer) {
+                if (DEBUG_RENDER_OFFSCREEN_ONSCREEN) {
                     drawOffscreenImage(gl, mSurfaceWidth, mSurfaceHeight);
                 } else {
                     gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, mFramebuffer);
@@ -231,8 +238,10 @@
             String extensions = " " + gl.glGetString(GL10.GL_EXTENSIONS) + " ";
             // The extensions string is padded with spaces between extensions, but not
             // necessarily at the beginning or end. For simplicity, add spaces at the
-            // beginning and end of the extensions string to make it easy to find an
-            // extension.
+            // beginning and end of the extensions string and the extension string.
+            // This means we can avoid special-case checks for the first or last
+            // extension, as well as avoid special-case checks when an extension name
+            // is the same as the first part of another extension name.
             return extensions.indexOf(" " + extension + " ") >= 0;
         }
     }