am 106278c4: (-s ours) Merge change 21432 into eclair

Merge commit '106278c40271fec941a86e5eac66ae5c8477a56a'

* commit '106278c40271fec941a86e5eac66ae5c8477a56a':
  do not merge: cherrypicked 3710f390968e683a0ad3adf0b517dfcade3564ce from master branch
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index 02a137d..993b7cb 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -1428,7 +1428,8 @@
                 throw new IllegalStateException("The content of the adapter has changed but "
                         + "ListView did not receive a notification. Make sure the content of "
                         + "your adapter is not modified from a background thread, but only "
-                        + "from the UI thread.");
+                        + "from the UI thread. [in ListView(" + getId() + ", " + getClass() 
+                        + ") with Adapter(" + mAdapter.getClass() + ")]");
             }
 
             setSelectedPositionInt(mNextSelectedPosition);
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 447e9fa..1249289 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -2054,7 +2054,15 @@
         if (event.values[0] == 0.0) {
             goToSleep(milliseconds);
         } else {
-            userActivity(milliseconds, false);
+            // proximity sensor negative events user activity.
+            // temporarily set mUserActivityAllowed to true so this will work
+            // even when the keyguard is on.
+            synchronized (mLocks) {
+                boolean savedActivityAllowed = mUserActivityAllowed;
+                mUserActivityAllowed = true;
+                userActivity(milliseconds, false);
+                mUserActivityAllowed = savedActivityAllowed;
+            }
         }
     }
 
diff --git a/tests/backup/backup_stress_test.sh b/tests/backup/backup_stress_test.sh
new file mode 100755
index 0000000..8155507
--- /dev/null
+++ b/tests/backup/backup_stress_test.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+# Copyright (C) 2009 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.
+
+iterations=150
+failures=0
+i=0
+LOGDIR="$HOME/backup_tests"
+LOGFILE="$LOGDIR/backup_stress.`date +%s`.log"
+export BUGREPORT_DIR="$LOGDIR/bugreports"
+
+# make sure that we have a place to put logs and bugreports
+mkdir -p $LOGDIR $BUGREPORT_DIR
+
+echo "logfile is $LOGFILE"
+
+(while (sleep 10); do
+    failed=0
+    
+    echo
+    echo "Iteration $i at `date`"
+    echo
+
+    ./test_backup.sh "$@" 2>&1
+
+    sleep 10
+    echo "Restore at `date`"
+    echo
+
+    ./test_restore.sh "$@" 2>&1 || failed=1
+    
+    if [ "$failed" -ne 0 ]; then
+        failures=$(($failures+1))
+        # Long and verbose so it sticks out
+        echo "FAILED iteration $i of $iterations; $failures failures so far"
+        echo "FAILED iteration $i of $iterations; $failures failures so far" > /dev/stderr
+    else
+        printf "Iteration %d:\tPASS; remaining: %d\n" $i $(($iterations - $i - 1))
+        printf "Iteration %d:\tPASS; remaining: %d\n" $i $(($iterations - $i - 1)) > /dev/stderr
+    fi
+
+    echo "End $i at `date`"
+    
+    i=$(($i+1))
+    if [ $i -eq $iterations ]; then
+        echo "DONE: $iterations iterations with $failures failures."
+        echo "DONE: $iterations iterations with $failures failures." > /dev/stderr
+        [ "$failures" -eq 0 ] && exit 0
+        exit 1
+    fi
+done) > "$LOGFILE"
+
diff --git a/tests/backup/test_restore.sh b/tests/backup/test_restore.sh
index 4506c16..46b46e4 100755
--- a/tests/backup/test_restore.sh
+++ b/tests/backup/test_restore.sh
@@ -18,7 +18,7 @@
 #export DRY_RUN="echo"
 source test_backup_common.sh
 
-BUGREPORT_DIR="$HOME/backup/bugreports"
+[ -z "$BUGREPORT_DIR" ] && BUGREPORT_DIR="$HOME/backup/bugreports"
 
 function check_file
 {
@@ -107,3 +107,5 @@
 echo "Last 3 timestamps in 3.txt:"
 a shell cat /data/data/com.android.backuptest/files/3.txt | tail -n 3
 
+exit $need_bug
+