am 09e50cdb: Merge "Reorder lock acquision vs try."

* commit '09e50cdbc62938b178f4c9a66b3cec8a466daaa8':
  Reorder lock acquision vs try.
diff --git a/core/java/android/database/sqlite/SQLiteCursor.java b/core/java/android/database/sqlite/SQLiteCursor.java
index d8dcaf7..c592134 100644
--- a/core/java/android/database/sqlite/SQLiteCursor.java
+++ b/core/java/android/database/sqlite/SQLiteCursor.java
@@ -132,11 +132,11 @@
             // the cursor's state doesn't change
             while (true) {
                 mLock.lock();
-                if (mCursorState != mThreadState) {
-                    mLock.unlock();
-                    break;
-                }
                 try {
+                    if (mCursorState != mThreadState) {
+                        break;
+                    }
+
                     int count = mQuery.fillWindow(cw, mMaxRead, mCount);
                     // return -1 means not finished
                     if (count != 0) {
@@ -218,9 +218,8 @@
         mColumnNameMap = null;
         mQuery = query;
 
+        db.lock();
         try {
-            db.lock();
-
             // Setup the list of columns
             int columnCount = mQuery.columnCountLocked();
             mColumns = new String[columnCount];