Merge changes Ia4825f54,If6f80560 into eclair

* changes:
  Fix a race condition that resulted in the screen coming on without the brightness set to the correct value.
  PowerManagerService: Hold a wakelock while mProximityTask is queued
diff --git a/core/java/android/accounts/GrantCredentialsPermissionActivity.java b/core/java/android/accounts/GrantCredentialsPermissionActivity.java
index e3ed2e9..4282c1b 100644
--- a/core/java/android/accounts/GrantCredentialsPermissionActivity.java
+++ b/core/java/android/accounts/GrantCredentialsPermissionActivity.java
@@ -26,6 +26,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.text.TextUtils;
 import com.android.internal.R;
 
 /**
@@ -59,7 +60,7 @@
 
         TextView messageView = (TextView) getWindow().findViewById(R.id.message);
         String authTokenLabel = getIntent().getExtras().getString(EXTRAS_AUTH_TOKEN_LABEL);
-        if (authTokenLabel.length() == 0) {
+        if (TextUtils.isEmpty(authTokenLabel)) {
             CharSequence grantCredentialsPermissionFormat = getResources().getText(
                     R.string.grant_credentials_permission_message_desc);
             messageView.setText(String.format(grantCredentialsPermissionFormat.toString(),
diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java
index 6ea6460..7855493 100644
--- a/core/java/com/android/internal/widget/SlidingTab.java
+++ b/core/java/com/android/internal/widget/SlidingTab.java
@@ -37,9 +37,9 @@
 
 /**
  * A special widget containing two Sliders and a threshold for each.  Moving either slider beyond
- * the threshold will cause the registered OnTriggerListener.onTrigger() to be called with 
+ * the threshold will cause the registered OnTriggerListener.onTrigger() to be called with
  * whichHandle being {@link OnTriggerListener#LEFT_HANDLE} or {@link OnTriggerListener#RIGHT_HANDLE}
- * Equivalently, selecting a tab will result in a call to 
+ * Equivalently, selecting a tab will result in a call to
  * {@link OnTriggerListener#onGrabbedStateChange(View, int)} with one of these two states. Releasing
  * the tab will result in whichHandle being {@link OnTriggerListener#NO_HANDLE}.
  *
@@ -122,9 +122,9 @@
     }
 
     /**
-     * Simple container class for all things pertinent to a slider.  
+     * Simple container class for all things pertinent to a slider.
      * A slider consists of 3 Views:
-     * 
+     *
      * {@link #tab} is the tab shown on the screen in the default state.
      * {@link #text} is the view revealed as the user slides the tab out.
      * {@link #target} is the target the user must drag the slider past to trigger the slider.
@@ -153,7 +153,7 @@
 
         /**
          * Constructor
-         * 
+         *
          * @param parent the container view of this one
          * @param tabId drawable for the tab
          * @param barId drawable for the bar
@@ -191,18 +191,17 @@
         void setIcon(int iconId) {
             tab.setImageResource(iconId);
         }
-        
+
         void setTabBackgroundResource(int tabId) {
             tab.setBackgroundResource(tabId);
         }
-        
+
         void setBarBackgroundResource(int barId) {
             text.setBackgroundResource(barId);
         }
-        
+
         void setHintText(int resId) {
-            // TODO: Text should be blank if widget is vertical
-            text.setText(resId); 
+            text.setText(resId);
         }
 
         void hide() {
@@ -354,12 +353,12 @@
         mDensity = r.getDisplayMetrics().density;
         if (DBG) log("- Density: " + mDensity);
 
-        mLeftSlider = new Slider(this, 
-                R.drawable.jog_tab_left_generic, 
+        mLeftSlider = new Slider(this,
+                R.drawable.jog_tab_left_generic,
                 R.drawable.jog_tab_bar_left_generic,
                 R.drawable.jog_tab_target_gray);
-        mRightSlider = new Slider(this, 
-                R.drawable.jog_tab_right_generic, 
+        mRightSlider = new Slider(this,
+                R.drawable.jog_tab_right_generic,
                 R.drawable.jog_tab_bar_right_generic,
                 R.drawable.jog_tab_target_gray);
 
@@ -548,11 +547,11 @@
      * @param iconId the resource ID of the icon drawable
      * @param targetId the resource of the target drawable
      * @param barId the resource of the bar drawable (stateful)
-     * @param tabId the resource of the 
+     * @param tabId the resource of the
      */
     public void setLeftTabResources(int iconId, int targetId, int barId, int tabId) {
         mLeftSlider.setIcon(iconId);
-        mLeftSlider.setTarget(targetId); 
+        mLeftSlider.setTarget(targetId);
         mLeftSlider.setBarBackgroundResource(barId);
         mLeftSlider.setTabBackgroundResource(tabId);
         mLeftSlider.updateDrawableStates();
@@ -564,7 +563,9 @@
      * @param resId
      */
     public void setLeftHintText(int resId) {
-        mLeftSlider.setHintText(resId);
+        if (isHorizontal()) {
+            mLeftSlider.setHintText(resId);
+        }
     }
 
     /**
@@ -576,11 +577,11 @@
      * @param iconId the resource ID of the icon drawable
      * @param targetId the resource of the target drawable
      * @param barId the resource of the bar drawable (stateful)
-     * @param tabId the resource of the 
+     * @param tabId the resource of the
      */
     public void setRightTabResources(int iconId, int targetId, int barId, int tabId) {
         mRightSlider.setIcon(iconId);
-        mRightSlider.setTarget(targetId); 
+        mRightSlider.setTarget(targetId);
         mRightSlider.setBarBackgroundResource(barId);
         mRightSlider.setTabBackgroundResource(tabId);
         mRightSlider.updateDrawableStates();
@@ -592,7 +593,9 @@
      * @param resId
      */
     public void setRightHintText(int resId) {
-        mRightSlider.setHintText(resId);
+        if (isHorizontal()) {
+            mRightSlider.setHintText(resId);
+        }
     }
 
     /**
diff --git a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
index 1abfd68..79c003f6 100644
--- a/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
+++ b/libs/surfaceflinger/DisplayHardware/DisplayHardware.cpp
@@ -246,10 +246,12 @@
     LOGI("version   : %s", glGetString(GL_VERSION));
     LOGI("extensions: %s", gl_extensions);
 
-    if (strstr(gl_renderer, "PowerVR SGX 530")) {
+    if (strstr(gl_renderer, "PowerVR SGX 530") ||
+        strstr(gl_renderer, "Adreno")) {
         LOGD("Assuming uncached graphics buffers.");
         mFlags &= ~CACHED_BUFFERS;
     }
+
     if (strstr(gl_extensions, "GL_ARB_texture_non_power_of_two")) {
         mFlags |= NPOT_EXTENSION;
     }