Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ac79e28 authored by Sravan voleti's avatar Sravan voleti Committed by android-build-merger
Browse files

Merge "OPP: Fix ANR during retry failed transfer" am: 4e3ae054 am: df2ec75e

am: 88a9af7f

Change-Id: If460a879f833aaecebaf5fdfbb005655a05dd5c6
parents 084ad29b 88a9af7f
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -375,24 +375,13 @@ public class BluetoothOppTransferActivity extends AlertActivity
                            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,23 @@ public class BluetoothOppTransferActivity extends AlertActivity
                    .setText(getString(R.string.upload_fail_cancel));
        }
    }

   /*
    * Retry the failed transfer in background thread
    */
   private void retryFailedTrasfer() {
        new Thread() {
            @Override
            public void 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();
    }
}