Merge change I16925b91 into eclair

* changes:
  Finish fixing issue #2228381: android.view.InflateException...
diff --git a/core/res/res/layout/keyguard_screen_tab_unlock.xml b/core/res/res/layout/keyguard_screen_tab_unlock.xml
index fdb9ad5..26b77bb 100644
--- a/core/res/res/layout/keyguard_screen_tab_unlock.xml
+++ b/core/res/res/layout/keyguard_screen_tab_unlock.xml
@@ -21,130 +21,125 @@
   state of the device, as well as instructions on how to get past it
   depending on the state of the device.  It is the same for landscape
   and portrait.-->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tabunlock="http://schemas.android.com/apk/res/com.android.tabunlock"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
+    android:background="#70000000"
+    android:gravity="center_horizontal"
     android:id="@+id/root">
+    
+    <TextView
+        android:id="@+id/carrier"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentRight="true"
+        android:layout_marginTop="10dip"
+        android:layout_marginRight="8dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        />
 
-    <RelativeLayout
+    <!-- time and date -->
+    <com.android.internal.widget.DigitalClock android:id="@+id/time"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/carrier"
+        android:layout_marginBottom="10dip"
+        android:layout_marginTop="52dip"
+        android:layout_marginLeft="20dip"
+        >
+
+        <TextView android:id="@+id/timeDisplay"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:gravity="bottom"
+            android:textSize="72sp"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:shadowColor="#C0000000"
+            android:shadowDx="0"
+            android:shadowDy="0"
+            android:shadowRadius="3.0"
+            />
+
+
+        <TextView android:id="@+id/am_pm"
+            android:layout_width="wrap_content"
+            android:layout_height="fill_parent"
+            android:gravity="bottom"
+            android:textSize="22sp"
+            android:singleLine="true"
+            android:layout_marginLeft="8dip"
+            android:layout_marginBottom="-6dip"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:shadowColor="#C0000000"
+            android:shadowDx="0"
+            android:shadowDy="0"
+            android:shadowRadius="3.0"
+            />
+
+    </com.android.internal.widget.DigitalClock>
+
+    <TextView
+        android:id="@+id/date"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/time"
+        android:layout_marginLeft="24dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        />
+
+    <TextView
+        android:id="@+id/status1"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/date"
+        android:layout_marginTop="4dip"
+        android:layout_marginLeft="24dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:drawablePadding="4dip"
+        />
+
+    <TextView
+        android:id="@+id/status2"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/status1"
+        android:layout_marginTop="4dip"
+        android:layout_marginLeft="24dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:drawablePadding="4dip"
+        />
+
+    <TextView
+        android:id="@+id/screenLocked"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/status2"
+        android:layout_marginLeft="24dip"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:layout_marginTop="12dip"
+        />
+
+    <com.android.internal.widget.SlidingTab
+        android:id="@+id/tab_selector"
+        android:orientation="horizontal"
         android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
-        android:background="#70000000"
-        android:gravity="center_horizontal">
-    
-        <TextView
-            android:id="@+id/carrier"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_alignParentTop="true"
-            android:layout_alignParentRight="true"
-            android:layout_marginTop="16dip"
-            android:layout_marginRight="16dip"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            />
-    
-        <!-- time and date -->
-        <com.android.internal.widget.DigitalClock android:id="@+id/time"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/carrier"
-            android:layout_marginBottom="8dip"
-            android:layout_marginTop="60dip"
-            android:layout_marginLeft="24dip"
-            >
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:layout_marginBottom="80dip" 
+        />
 
-            <TextView android:id="@+id/timeDisplay"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:gravity="bottom"
-                android:textSize="72sp"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:shadowColor="#C0000000"
-                android:shadowDx="0"
-                android:shadowDy="0"
-                android:shadowRadius="3.0"
-                />
+    <!-- emergency call button shown when sim is missing or PUKd -->
+    <Button
+        android:id="@+id/emergencyCallButton"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_below="@id/screenLocked"
+        android:layout_marginTop="24dip"
+        android:drawableLeft="@drawable/ic_emergency"
+        android:drawablePadding="8dip"
+       />
 
+</RelativeLayout>
 
-            <TextView android:id="@+id/am_pm"
-                android:layout_width="wrap_content"
-                android:layout_height="fill_parent"
-                android:gravity="bottom"
-                android:textSize="22sp"
-                android:singleLine="true"
-                android:layout_marginLeft="8dip"
-                android:layout_marginBottom="-6dip"
-                android:textAppearance="?android:attr/textAppearanceMedium"
-                android:shadowColor="#C0000000"
-                android:shadowDx="0"
-                android:shadowDy="0"
-                android:shadowRadius="3.0"
-                />
-
-        </com.android.internal.widget.DigitalClock>
-    
-        <TextView
-            android:id="@+id/date"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/time"
-            android:layout_marginLeft="24dip"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            />
-    
-        <TextView
-            android:id="@+id/status1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/date"
-            android:layout_marginTop="6dip"
-            android:layout_marginLeft="24dip"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:drawablePadding="4dip"
-            />
-
-        <TextView
-            android:id="@+id/status2"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/status1"
-            android:layout_marginTop="6dip"
-            android:layout_marginLeft="24dip"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:drawablePadding="4dip"
-            />
-    
-        <TextView
-            android:id="@+id/screenLocked"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/status2"
-            android:layout_marginLeft="24dip"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_marginTop="12dip"
-            />
-    
-        <com.android.internal.widget.SlidingTab
-            android:id="@+id/tab_selector"
-            android:orientation="horizontal"
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:layout_alignParentBottom="true"
-            android:layout_marginBottom="80dip" 
-            />
-    
-        <!-- emergency call button shown when sim is missing or PUKd -->
-        <Button
-            android:id="@+id/emergencyCallButton"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@id/screenLocked"
-            android:layout_marginTop="24dip"
-            android:drawableLeft="@drawable/ic_emergency"
-            android:drawablePadding="8dip"
-           />
-    
-    </RelativeLayout>
-
-</FrameLayout>
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index b71d10c..ff8d29f 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -88,7 +88,7 @@
     return false;
 }
 
-void Allocation::uploadToTexture(uint32_t lodOffset)
+void Allocation::uploadToTexture(Context *rsc, uint32_t lodOffset)
 {
     //rsAssert(!mTextureId);
     rsAssert(lodOffset < mType->getLODCount());
@@ -102,6 +102,15 @@
 
     if (!mTextureID) {
         glGenTextures(1, &mTextureID);
+
+        if (!mTextureID) {
+            // This should not happen, however, its likely the cause of the
+            // white sqare bug.
+            // Force a crash to 1: restart the app, 2: make sure we get a bugreport.
+            LOGE("Upload to texture failed to gen mTextureID");
+            rsc->dumpDebug();
+            ((char *)0)[0] = 0;
+        }
     }
     glBindTexture(GL_TEXTURE_2D, mTextureID);
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
@@ -238,7 +247,7 @@
 void rsi_AllocationUploadToTexture(Context *rsc, RsAllocation va, uint32_t baseMipLevel)
 {
     Allocation *alloc = static_cast<Allocation *>(va);
-    alloc->uploadToTexture(baseMipLevel);
+    alloc->uploadToTexture(rsc, baseMipLevel);
 }
 
 void rsi_AllocationUploadToBufferObject(Context *rsc, RsAllocation va)
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index 514b1c2..f54284a 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -46,7 +46,7 @@
     void * getPtr() const {return mPtr;}
     const Type * getType() const {return mType.get();}
 
-    void uploadToTexture(uint32_t lodOffset = 0);
+    void uploadToTexture(Context *rsc, uint32_t lodOffset = 0);
     uint32_t getTextureID() const {return mTextureID;}
 
     void uploadToBufferObject();
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 08ed725..52074ca 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -726,6 +726,24 @@
     mIO.mToClient.shutdown();
 }
 
+void Context::dumpDebug() const
+{
+    LOGE("RS Context debug %p", this);
+    LOGE("RS Context debug");
+
+    LOGE(" EGL ver %i %i", mEGL.mMajorVersion, mEGL.mMinorVersion);
+    LOGE(" EGL context %p  surface %p,  w=%i h=%i  Display=%p", mEGL.mContext,
+         mEGL.mSurface, mEGL.mWidth, mEGL.mHeight, mEGL.mDisplay);
+    LOGE(" GL vendor: %s", mGL.mVendor);
+    LOGE(" GL renderer: %s", mGL.mRenderer);
+    LOGE(" GL Version: %s", mGL.mVersion);
+    LOGE(" GL Extensions: %s", mGL.mExtensions);
+    LOGE(" GL int Versions %i %i", mGL.mMajorVersion, mGL.mMinorVersion);
+    LOGE(" RS width %i, height %i", mWidth, mHeight);
+    LOGE(" RS running %i, exit %i, useDepth %i, paused %i", mRunning, mExit, mUseDepth, mPaused);
+    LOGE(" RS pThreadID %li, nativeThreadID %i", mThreadId, mNativeThreadId);
+
+}
 
 ///////////////////////////////////////////////////////////////////////////////////////////
 //
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index fb878eb..4e0f653 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -162,6 +162,8 @@
         bool mLogObjects;
     } props;
 
+    void dumpDebug() const;
+
     mutable const ObjectBase * mObjHead;
 
 protected:
diff --git a/libs/surfaceflinger/Android.mk b/libs/surfaceflinger/Android.mk
index b3fed58..eb51c22 100644
--- a/libs/surfaceflinger/Android.mk
+++ b/libs/surfaceflinger/Android.mk
@@ -22,6 +22,9 @@
 ifeq ($(TARGET_BOARD_PLATFORM), msm7k)
 	LOCAL_CFLAGS += -DDIM_WITH_TEXTURE
 endif
+ifeq ($(TARGET_BOARD_PLATFORM), qsd8k)
+	LOCAL_CFLAGS += -DDIM_WITH_TEXTURE
+endif
 
 # need "-lrt" on Linux simulator to pick up clock_gettime
 ifeq ($(TARGET_SIMULATOR),true)
diff --git a/tests/ImfTest/tests/AndroidManifest.xml b/tests/ImfTest/tests/AndroidManifest.xml
index 122d202..c02fa0b 100755
--- a/tests/ImfTest/tests/AndroidManifest.xml
+++ b/tests/ImfTest/tests/AndroidManifest.xml
@@ -18,6 +18,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.imftest.tests">
 
+    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
+
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
diff --git a/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java b/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java
index 61dc611..1957640 100755
--- a/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java
+++ b/tests/ImfTest/tests/src/com/android/imftest/samples/ImfBaseTestCase.java
@@ -17,6 +17,8 @@
 package com.android.imftest.samples;
 
 import android.app.Activity;
+import android.app.KeyguardManager;
+import android.content.Context;
 import android.os.SystemClock;
 import android.test.InstrumentationTestCase;
 import android.view.KeyEvent;
@@ -58,6 +60,11 @@
         mTargetActivity = launchActivity(TARGET_PACKAGE_NAME, mTargetActivityClass, null);
         mExpectAutoPop = mTargetActivity.getResources().getBoolean(R.bool.def_expect_ime_autopop);
         mImm = InputMethodManager.getInstance(mTargetActivity);
+
+        KeyguardManager keyguardManager =
+            (KeyguardManager) getInstrumentation().getContext().getSystemService(
+                    Context.KEYGUARD_SERVICE);
+        keyguardManager.newKeyguardLock("imftest").disableKeyguard();
     }
     
     // Utility test methods