am 46aae98b: am f2d643cf: Merge "Fixed a leaked partial wakelock in AbstractThreadedSyncAdapter."

* commit '46aae98b41fe6e6b61aeddff3ad3f41bc4ceace3':
  Fixed a leaked partial wakelock in AbstractThreadedSyncAdapter.
diff --git a/core/java/android/content/AbstractThreadedSyncAdapter.java b/core/java/android/content/AbstractThreadedSyncAdapter.java
index 613450b..809f900 100644
--- a/core/java/android/content/AbstractThreadedSyncAdapter.java
+++ b/core/java/android/content/AbstractThreadedSyncAdapter.java
@@ -161,10 +161,13 @@
                     if (mAutoInitialize
                             && extras != null
                             && extras.getBoolean(ContentResolver.SYNC_EXTRAS_INITIALIZE, false)) {
-                        if (ContentResolver.getIsSyncable(account, authority) < 0) {
-                            ContentResolver.setIsSyncable(account, authority, 1);
+                        try {
+                            if (ContentResolver.getIsSyncable(account, authority) < 0) {
+                                ContentResolver.setIsSyncable(account, authority, 1);
+                            }
+                        } finally {
+                            syncContextClient.onFinished(new SyncResult());
                         }
-                        syncContextClient.onFinished(new SyncResult());
                         return;
                     }
                     SyncThread syncThread = new SyncThread(