Merge changes from topic "am-56f7bb82-8ae0-413e-9302-2736db26492c" into q-keystone-qcom-dev

* changes:
  [automerger skipped] OPP: Fix ANR during retry failed transfer skipped: ce1122f97c
  OPP: Fix ANR during retry failed transfer
diff --git a/src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java b/src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java
index fc45d3f..e4d98e8 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppTransferActivity.java
@@ -375,24 +375,13 @@
                             mTransInfo.mID);
                 } else if (mWhichDialog == DIALOG_SEND_COMPLETE_FAIL) {
                     // "try again"
-
                     // make current transfer "hidden"
                     BluetoothOppUtility.updateVisibilityToHidden(this, mUri);
 
                     // clear correspondent notification item
                     ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(
                             mTransInfo.mID);
-
-                    // retry the failed transfer
-                    Uri uri = BluetoothOppUtility.originalUri(Uri.parse(mTransInfo.mFileUri));
-                    BluetoothOppSendFileInfo sendFileInfo =
-                            BluetoothOppSendFileInfo.generateFileInfo(BluetoothOppTransferActivity
-                            .this, uri, mTransInfo.mFileType, false);
-                    uri = BluetoothOppUtility.generateUri(uri, sendFileInfo);
-                    BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo);
-                    mTransInfo.mFileUri = uri.toString();
-                    BluetoothOppUtility.retryTransfer(this, mTransInfo);
-
+                    retryFailedTrasfer();
                     BluetoothDevice remoteDevice = mAdapter.getRemoteDevice(mTransInfo.mDestAddr);
 
                     // Display toast message
@@ -502,4 +491,22 @@
                     .setText(getString(R.string.upload_fail_cancel));
         }
     }
+
+ // Retry the failed transfer in background thread
+   private void retryFailedTrasfer() {
+        new Thread() {
+            @Override
+            public void run() {
+                super.run();
+                Uri uri = BluetoothOppUtility.originalUri(Uri.parse(mTransInfo.mFileUri));
+                BluetoothOppSendFileInfo sendFileInfo =
+                        BluetoothOppSendFileInfo.generateFileInfo(BluetoothOppTransferActivity
+                        .this, uri, mTransInfo.mFileType, false);
+                uri = BluetoothOppUtility.generateUri(uri, sendFileInfo);
+                BluetoothOppUtility.putSendFileInfo(uri, sendFileInfo);
+                mTransInfo.mFileUri = uri.toString();
+                BluetoothOppUtility.retryTransfer(BluetoothOppTransferActivity.this, mTransInfo);
+            }
+        }.start();
+    }
 }