diff options
author | Sravan Kumar V <sravankumar@codeaurora.org> | 2016-06-13 16:03:03 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2016-08-24 08:17:25 -0600 |
commit | e1e83dc2af04c694914503d3c9d7eeb47ae57252 (patch) | |
tree | bde231308565a65ade07bf3b207829d867375968 /src/com/android/bluetooth/opp/BluetoothOppTransfer.java | |
parent | b650ddf262f3a531774a4d7fa656c7e360a79704 (diff) | |
download | android_packages_apps_Bluetooth-e1e83dc2af04c694914503d3c9d7eeb47ae57252.tar.gz android_packages_apps_Bluetooth-e1e83dc2af04c694914503d3c9d7eeb47ae57252.tar.bz2 android_packages_apps_Bluetooth-e1e83dc2af04c694914503d3c9d7eeb47ae57252.zip |
OPP: Fix NPE issue while turn off BT
Use Case:
1. Pair remote with DUT.
2. From gallery send a file to remote
3. Turn off BT
4. Check the file transfer should fail
Failure:
BT crash seen when we turn off BT during file transfer.
Root Cause:
In Some conditions Bt Socket instance is remains null
because of turn off BT.
Fix:
Before closing connection check BT Socket instance
Value to avoid NPE.
Change-Id: Idcd90c31a179247055a155678d11d8e76ec90aca
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppTransfer.java')
-rw-r--r-- | src/com/android/bluetooth/opp/BluetoothOppTransfer.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppTransfer.java b/src/com/android/bluetooth/opp/BluetoothOppTransfer.java index 293cbfe5e..dd2e354f4 100644 --- a/src/com/android/bluetooth/opp/BluetoothOppTransfer.java +++ b/src/com/android/bluetooth/opp/BluetoothOppTransfer.java @@ -658,6 +658,7 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch private void connectRfcommSocket() { + if (V) Log.v(TAG, "connectRfcommSocket"); try { btSocket = device.createInsecureRfcommSocketToServiceRecord(BluetoothUuid.ObexObjectPush.getUuid()); } catch (IOException e1) { @@ -823,8 +824,11 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch } private void markConnectionFailed(BluetoothSocket s) { + if (V) Log.v(TAG, "markConnectionFailed " + s); try { - s.close(); + if (s != null) { + s.close(); + } } catch (IOException e) { if (V) Log.e(TAG, "Error when close socket"); } |