Merge "Fix OpenGL processing when activity is not active." into ics-mr1
diff --git a/res/layout-sw600dp/priority_indicators.xml b/res/layout-sw600dp/priority_indicators.xml
deleted file mode 100644
index 77067b0..0000000
--- a/res/layout-sw600dp/priority_indicators.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
-
-     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.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="horizontal"
-        android:layout_alignParentLeft="true"
-        android:layout_alignParentTop="true"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:padding="8dp">
-    <ImageView android:id="@+id/onscreen_flash_indicator"
-            style="@style/OnScreenIndicator"
-            android:visibility="visible"/>
-    <ImageView android:id="@+id/onscreen_white_balance_indicator"
-            style="@style/OnScreenIndicator"/>
-    <TextView android:id="@+id/onscreen_exposure_indicator"
-            style="@style/OnScreenIndicator"
-            android:gravity="center_vertical"
-            android:textSize="15dp"
-            android:textColor="@android:color/white"/>
-    <ImageView android:id="@+id/onscreen_scene_indicator"
-            style="@style/OnScreenIndicator"
-            android:src="@drawable/ic_indicators_scn"/>
-    <ImageView android:id="@+id/onscreen_gps_indicator"
-            style="@style/OnScreenIndicator"/>
-    <ImageView android:id="@+id/onscreen_focus_indicator"
-            style="@style/OnScreenIndicator"/>
-</LinearLayout>
diff --git a/res/layout/priority_indicators.xml b/res/layout/priority_indicators.xml
index a8318e0..ef4f36c 100644
--- a/res/layout/priority_indicators.xml
+++ b/res/layout/priority_indicators.xml
@@ -13,30 +13,40 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_alignParentRight="true"
-        android:layout_alignParentTop="true"
-        android:layout_height="wrap_content"
-        android:layout_width="wrap_content"
-        android:padding="8dp">
-    <ImageView android:id="@+id/onscreen_flash_indicator"
-            style="@style/OnScreenIndicator"
-            android:visibility="visible"/>
-    <ImageView android:id="@+id/onscreen_white_balance_indicator"
-            style="@style/OnScreenIndicator"/>
-    <TextView android:id="@+id/onscreen_exposure_indicator"
-            style="@style/OnScreenIndicator"
-            android:layout_marginTop="6dp"
-            android:layout_marginBottom="6dp"
-            android:gravity="center_vertical"
-            android:textSize="15dp"
-            android:textColor="@android:color/white"/>
-    <ImageView android:id="@+id/onscreen_scene_indicator"
-            style="@style/OnScreenIndicator"
-            android:src="@drawable/ic_indicators_scn"/>
-    <ImageView android:id="@+id/onscreen_gps_indicator"
-            style="@style/OnScreenIndicator"/>
-    <ImageView android:id="@+id/onscreen_focus_indicator"
-            style="@style/OnScreenIndicator"/>
-</LinearLayout>
+<com.android.camera.ui.RotateLayout xmlns:android="http://schemas.android.com/apk/res/android"
+        android:id="@+id/on_screen_indicators"
+        android:layout_height="match_parent"
+        android:layout_width="match_parent"
+        style="@style/OnScreenIndicators">
+    <RelativeLayout
+            android:layout_height="match_parent"
+            android:layout_width="match_parent">
+        <LinearLayout
+                android:orientation="horizontal"
+                android:layout_height="@dimen/onscreen_indicators_height"
+                android:layout_width="wrap_content"
+                android:layout_alignParentTop="true"
+                android:layout_alignParentLeft="true"
+                android:gravity="center_vertical">
+            <ImageView android:id="@+id/onscreen_flash_indicator"
+                    style="@style/OnScreenIndicator"
+                    android:visibility="visible"/>
+            <ImageView android:id="@+id/onscreen_white_balance_indicator"
+                    style="@style/OnScreenIndicator"/>
+            <TextView android:id="@+id/onscreen_exposure_indicator"
+                    style="@style/OnScreenIndicator"
+                    android:paddingLeft="3dp"
+                    android:paddingRight="3dp"
+                    android:gravity="center_vertical"
+                    android:textSize="@dimen/onscreen_exposure_indicator_text_size"
+                    android:textColor="@android:color/white"/>
+            <ImageView android:id="@+id/onscreen_scene_indicator"
+                    style="@style/OnScreenIndicator"
+                    android:src="@drawable/ic_indicators_scn"/>
+            <ImageView android:id="@+id/onscreen_gps_indicator"
+                    style="@style/OnScreenIndicator"/>
+            <ImageView android:id="@+id/onscreen_focus_indicator"
+                    style="@style/OnScreenIndicator"/>
+        </LinearLayout>
+    </RelativeLayout>
+</com.android.camera.ui.RotateLayout>
\ No newline at end of file
diff --git a/res/values-sw600dp/dimens.xml b/res/values-sw600dp/dimens.xml
index 3044e7d..eadd1eb 100644
--- a/res/values-sw600dp/dimens.xml
+++ b/res/values-sw600dp/dimens.xml
@@ -53,4 +53,6 @@
     <dimen name="effect_setting_clear_text_size">23dp</dimen>
     <dimen name="effect_setting_clear_text_min_height">44dp</dimen>
     <dimen name="effect_setting_type_text_left_padding">26dp</dimen>
+    <dimen name="onscreen_indicators_height">36dp</dimen>
+    <dimen name="onscreen_exposure_indicator_text_size">18dp</dimen>
 </resources>
diff --git a/res/values-sw600dp/styles.xml b/res/values-sw600dp/styles.xml
index 0f29321..5ece4a3 100644
--- a/res/values-sw600dp/styles.xml
+++ b/res/values-sw600dp/styles.xml
@@ -43,13 +43,8 @@
         <item name="android:textSize">12sp</item>
         <item name="android:textStyle">bold</item>
     </style>
-    <style name="OnScreenIndicator">
-        <item name="android:layout_height">28dp</item>
-        <item name="android:layout_width">wrap_content</item>
-        <item name="android:layout_gravity">center_vertical</item>
-        <item name="android:focusable">false</item>
-        <item name="android:visibility">gone</item>
-        <item name="android:layout_marginRight">8dp</item>
+    <style name="OnScreenIndicators">
+        <item name="android:layout_margin">12dp</item>
     </style>
     <style name="ReviewThumbnail">
         <item name="android:layout_width">86dp</item>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 7d12a18..97372a2 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -51,4 +51,6 @@
     <dimen name="effect_setting_clear_text_size">20dp</dimen>
     <dimen name="effect_setting_clear_text_min_height">45dp</dimen>
     <dimen name="effect_setting_type_text_left_padding">16dp</dimen>
+    <dimen name="onscreen_indicators_height">28dp</dimen>
+    <dimen name="onscreen_exposure_indicator_text_size">15dp</dimen>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 204a650..68e450a 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -139,14 +139,18 @@
         <item name="android:background">@android:color/transparent</item>
     </style>
     <style name="OnScreenIndicator">
-        <item name="android:layout_height">28dp</item>
+        <item name="android:layout_height">wrap_content</item>
         <item name="android:layout_width">wrap_content</item>
-        <item name="android:layout_gravity">center_horizontal</item>
         <item name="android:focusable">false</item>
         <item name="android:visibility">gone</item>
-        <item name="android:rotation">90</item>
         <item name="android:padding">1dp</item>
     </style>
+    <style name="OnScreenIndicators">
+        <item name="android:layout_marginTop">8dp</item>
+        <item name="android:layout_marginBottom">@dimen/indicator_bar_width</item>
+        <item name="android:layout_marginLeft">8dp</item>
+        <item name="android:layout_marginRight">8dp</item>
+    </style>
     <style name="ViewfinderLableLayout">
         <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">match_parent</item>
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index f0c1f30..6bded2c 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -175,6 +175,8 @@
     private ImageView mSceneIndicator;
     private ImageView mWhiteBalanceIndicator;
     private ImageView mFocusIndicator;
+    // A view group that contains all the small indicators.
+    private Rotatable mOnScreenIndicators;
 
     // We use a thread in ImageSaver to do the work of saving images and
     // generating thumbnails. This reduces the shot-to-shot time.
@@ -647,10 +649,12 @@
         }
         if (Parameters.FLASH_MODE_AUTO.equals(value)) {
             mFlashIndicator.setImageResource(R.drawable.ic_indicators_landscape_flash_auto);
+            mFlashIndicator.setVisibility(View.VISIBLE);
         } else if (Parameters.FLASH_MODE_ON.equals(value)) {
             mFlashIndicator.setImageResource(R.drawable.ic_indicators_landscape_flash_on);
+            mFlashIndicator.setVisibility(View.VISIBLE);
         } else if (Parameters.FLASH_MODE_OFF.equals(value)) {
-            mFlashIndicator.setImageResource(R.drawable.ic_indicators_landscape_flash_off);
+            mFlashIndicator.setVisibility(View.GONE);
         }
     }
 
@@ -1178,6 +1182,7 @@
         }
 
         mZoomControl = (ZoomControl) findViewById(R.id.zoom_control);
+        mOnScreenIndicators = (Rotatable) findViewById(R.id.on_screen_indicators);
         mLocationManager = new LocationManager(this, this);
 
         mBackCameraId = CameraHolder.instance().getBackCameraId();
@@ -1306,7 +1311,7 @@
     private void setOrientationIndicator(int orientation) {
         Rotatable[] indicators = {mThumbnailView, mModePicker, mSharePopup,
                 mIndicatorControlContainer, mZoomControl, mFocusAreaIndicator, mFaceView,
-                mReviewCancelButton, mReviewDoneButton, mRotateDialog};
+                mReviewCancelButton, mReviewDoneButton, mRotateDialog, mOnScreenIndicators};
         for (Rotatable indicator : indicators) {
             if (indicator != null) indicator.setOrientation(orientation);
         }