Merge change I7b9328c7 into eclair

* changes:
  Fix issue #2300232: Bugs in resolving conflicting pointers
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index 88ef7e4..eb017bf 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -266,7 +266,16 @@
     : mBufferHeap(buffers)
 {
     NativeBuffer& src(mNativeBuffer);
-    src.img.handle = 0;
+    src.crop.l = 0;
+    src.crop.t = 0;
+    src.crop.r = buffers.w;
+    src.crop.b = buffers.h;
+
+    src.img.w       = buffers.hor_stride ?: buffers.w;
+    src.img.h       = buffers.ver_stride ?: buffers.h;
+    src.img.format  = buffers.format;
+    src.img.base    = (void*)(intptr_t(buffers.heap->base()) + offset);
+    src.img.handle  = 0;
 
     gralloc_module_t const * module = LayerBuffer::getGrallocModule();
     if (module && module->perform) {
@@ -276,19 +285,12 @@
                 offset, buffers.heap->base(),
                 &src.img.handle);
 
-        if (err == NO_ERROR) {
-            src.crop.l = 0;
-            src.crop.t = 0;
-            src.crop.r = buffers.w;
-            src.crop.b = buffers.h;
-
-            src.img.w       = buffers.hor_stride ?: buffers.w;
-            src.img.h       = buffers.ver_stride ?: buffers.h;
-            src.img.format  = buffers.format;
-            src.img.base    = (void*)(intptr_t(buffers.heap->base()) + offset);
-        }
+        LOGE_IF(err, "CREATE_HANDLE_FROM_BUFFER (heapId=%d, size=%d, "
+             "offset=%ld, base=%p) failed (%s)",
+                buffers.heap->heapID(), buffers.heap->getSize(),
+                offset, buffers.heap->base(), strerror(-err));
     }
-}
+ }
 
 LayerBuffer::Buffer::~Buffer()
 {
diff --git a/tests/backup/test_backup.sh b/tests/backup/test_backup.sh
index 10b809d..113a26d 100755
--- a/tests/backup/test_backup.sh
+++ b/tests/backup/test_backup.sh
@@ -18,10 +18,12 @@
 #export DRY_RUN="echo"
 source test_backup_common.sh
 
-# wipe prior backup data for packages
+# figure out what packages are participating in backup
 b_pkgs=$(a shell dumpsys backup | \
-         ruby -ne 'print($1+" ") if $_ =~ /^\s*ApplicationInfo\S+ (.+?)\}/')
+         ruby -e 'p_stanza = STDIN.read.match(/Participants:.*?(?=Ever)/m)[0]
+                  puts p_stanza.scan(/^    (.+?)\s*$/).flatten.join(" ")')
 
+# wipe data for the package participating in backup
 for pkg in $b_pkgs; do
     a shell bmgr wipe "$pkg"
 done
@@ -36,7 +38,7 @@
 set -x
 
 # set the transport
-a shell bmgr transport com.google.android.backup/.BackupTransportService
+#a shell bmgr transport com.google.android.backup/.BackupTransportService
 
 # load up the three files
 a shell \
diff --git a/tests/backup/test_restore.sh b/tests/backup/test_restore.sh
index 46b46e4..48e5c66 100755
--- a/tests/backup/test_restore.sh
+++ b/tests/backup/test_restore.sh
@@ -45,7 +45,7 @@
     fi
 }
 
-# run adb as root so we can poke at com.android.backuptest's data
+# Make sure adb is root so we can poke at com.android.backuptest's data
 adb_root
 
 # delete the old data