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

Commit 9179d70b authored by Sravan Kumar V's avatar Sravan Kumar V Committed by Linux Build Service Account
Browse files

OPP: Check URI of sending files before entry cleanup.

Use Case:
1. Select a picture then share it via Bluetooth.
2. When the 'Bluetooth device chooser' page display,
   press home button to home page.
3. Turn off BT-> turn on BT->turn off BT.
4. Tap 'Bluetooth device chooser' from recent list,
   then press back/home/recent button.

Failure:
"Unfortunately, Bluetooth share has stopped" error comes.

Fix:
Checking the URI of sending files before removing the file entry
from Hashmap. Otherwise, during BT ON/OFF scenario there is a
possibility of URI becoming NULL that will lead to BT app crash

CRs-Fixed: 721360
Change-Id: Ic7e8966d38e30948228e14a740cd3051b345da31
parent 8de609c8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -290,7 +290,7 @@ public class BluetoothOppManager {
                if (V) Log.v(TAG, "cleanUpSendingFileInfo: " +
                    "closeSendFileInfo for uri = " + uri);
                BluetoothOppUtility.closeSendFileInfo(uri);
            } else {
            } else if (mUrisOfSendingFiles != null) {
                for (int i = 0, count = mUrisOfSendingFiles.size(); i < count; i++) {
                    uri = mUrisOfSendingFiles.get(i);
                    if (V) Log.v(TAG, "cleanUpSendingFileInfo: " +
+3 −3
Original line number Diff line number Diff line
@@ -560,15 +560,15 @@ public class BluetoothOppObexClientSession implements BluetoothOppObexSession {
                        Log.i(TAG, "Remote reject file type " + fileInfo.mMimetype);
                        status = BluetoothShare.STATUS_NOT_ACCEPTABLE;
                    } else if (!mInterrupted && position == fileInfo.mLength) {
                        if(V) {
                        if (D) {
                            if (fileInfo.mLength > MIN_FILE_LEN_FOR_TPUT_MEASUREMENT) {
                                long endTime = System.currentTimeMillis();
                                Log.i(TAG, "SendFile finished send out file " + fileInfo.mFileName
                                Log.d(TAG, "SendFile finished send out file " + fileInfo.mFileName
                                    + " length " + fileInfo.mLength + " Bytes. Approx. throughput "
                                    +" is " + BluetoothShare.throughputInKbps(fileInfo.mLength,
                                    +(endTime - beginTime))+ " Kbps");
                            } else {
                                Log.i(TAG, "SendFile finished sending file " + fileInfo.mFileName
                                Log.d(TAG, "SendFile finished sending file " + fileInfo.mFileName
                                    + " length " + fileInfo.mLength + " Bytes. File size is too "
                                    + " small to measure throughput");
                            }
+3 −3
Original line number Diff line number Diff line
@@ -533,7 +533,7 @@ public class BluetoothPbapService extends Service implements IObexConnectionHand
            sRemoteDeviceName = getString(R.string.defaultname);
        }
        int permission = mRemoteDevice.getPhonebookAccessPermission();
        if (VERBOSE) Log.v(TAG, "getPhonebookAccessPermission() = " + permission);
        if (DEBUG) Log.d(TAG, "getPhonebookAccessPermission() = " + permission);

        if (permission == BluetoothDevice.ACCESS_ALLOWED) {
            try {
@@ -547,8 +547,8 @@ public class BluetoothPbapService extends Service implements IObexConnectionHand
                        + ex.toString());
            }
        } else if (permission == BluetoothDevice.ACCESS_REJECTED) {
            if (VERBOSE) {
                Log.v(TAG, "incoming connection rejected from: " + sRemoteDeviceName
            if (DEBUG) {
                Log.d(TAG, "incoming connection rejected from: " + sRemoteDeviceName
                        + " automatically as already rejected device");
            }
            return false;