History log of /packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
67766698d6cf7bbc51b52e174dfe1cfdb5cfd492 12-Apr-2017 Jack He <siyuanh@google.com> Merge "OPP: Restrict file based URI access to external storage" into oc-dev
am: 376a8d4bed

Change-Id: I3db3ba9507b459eccd9b97bf8c916b905a895561
fe1c54e3fcbb75af7e49aecbd27ab7327a631c64 13-Mar-2017 Jack He <siyuanh@google.com> OPP: Restrict file based URI access to external storage

* Allow only external storage paths in file based URI in
BluetoothOppSendFileInfo when the file send request comes from an
external source
* Fix a potential NPE when using Uri.getPath()

Bug: 35310991
Test: Make, test various cases of Bluetooth file share
Change-Id: I8ff00d63d3c880667302f8d7ff8eaa0c0b533921
(cherry picked from commit 3edd7f0a8aadf2f44bc62ea5b567c74d39a534c8)
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
1c87133a411302f275440bad23aa04b720dcd753 01-May-2014 Hemant Gupta <hemantg@codeaurora.org> OPP: Fix Resource Leak in OPP (2/2)

[Test Procedure]
1) Select File -> Press share via BT -> Press back key
2) Repeat step 1 in loop (1024 times)

Expected Result
No BT crash observed

Observed Result
-------------------------------------------------------------------------------------------------
issueTag : SYSTEM_TOMBSTONE
PackageName : N/A
PackageVersion : N/A
ExceptionType : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR)
ExceptionMessage : #00 pc 0004ea14 /system/lib/libdvm.so #01 pc 00004a49 /system/lib/libbluetooth_jni.so
Process : com.android.bluetooth
Build : FarEastone/Smart503_03TW/MC2:4.4.2/KVT49L/03TW_0_160:user/release-keys

StackTrace :

issueCount : 3
issueLogPath :
... TEM_TOMBSTONE/SYSTEM_TOMBSTONE@1397693648904.txt – 2014-04-17 08:14:08 (GMT+8)
... TEM_TOMBSTONE/SYSTEM_TOMBSTONE@1397693649571.txt – 2014-04-17 08:14:09 (GMT+8)
... TEM_TOMBSTONE/SYSTEM_TOMBSTONE@1397693650035.txt – 2014-04-17 08:14:10 (GMT+8)

and then we can see:
-------------------------------------------------------------------------------------------------
issueTag : system_app_crash
PackageName : com.android.bluetooth
PackageVersion : 4.4.2-00WW_0_160
ExceptionType : java.lang.RuntimeException
ExceptionMessage : Could not read input channel file descriptors from parcel.
Process : com.android.bluetooth
Flag : 0x88be45
Build : FarEastone/Smart503_03TW/MC2:4.4.2/KVT49L/03TW_0_160:user/release-keys
throwClassName : android.view.InputChannel.nativeReadFromParcel
throwMethodName : Native Method

StackTrace :
java.lang.RuntimeException: Could not read input channel file descriptors from parcel.
at android.view.InputChannel.nativeReadFromParcel(Native Method)
at android.view.InputChannel.readFromParcel(InputChannel.java:148)
at android.view.IWindowSession$Stub$Proxy.addToDisplay(IWindowSession.java:690)
at android.view.ViewRootImpl.setView(ViewRootImpl.java:502)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:259)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2860)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1204)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5055)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:658)
at dalvik.system.NativeStart.main(Native Method)

Root Cause:
Input stream was never closed resulting in leak with each iteration and system crash after 1024 iterations.

Fix:
Handle closing of input stream and Remove hashmap share if no device is selected by user when trying to send
file via BT. Without this, input stream was never closed resulting in leak with each iteration and system crash
after 1024 iterations.

Test: Performed the usecase overnight and see if no crash is observed.

Bug: 35626275
Change-Id: I92aa0d8e81977fde0446f565f1de95e2d91e1e9c
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
a4e626056b2d8dff1b624b5d79664ba27ae2777f 09-Jan-2017 Sravan Kumar V <sravankumar@codeaurora.org> OPP: Check file size before send to prevent crash

Use case :
1. Send large file to dut (Above 4 GB)
Failure:
Crash in com.android.bluetooth.
Process: com.android.bluetooth
java.lang.IllegalArgumentException: Length must be
between 0 and 0xFFFFFFFF
at javax.obex.HeaderSet.setHeader(HeaderSet.java:333)
at com.android.bluetooth.opp.BluetoothOppObexClientSession$ClientThread
.sendFile(BluetoothOppObexClientSession.java:411)
at com.android.bluetooth.opp.BluetoothOppObexClientSession$ClientThread
.doSend(BluetoothOppObexClientSession.java:337)

Root cause :
Largest length in OBEX message header is unsigned 4 bytes, so actual
file length (4 GB) cannot be written into Obex header which leads
to exception in OBEX code.

Fix :
Add length check before push file and skip sendfile if length is above
4GB to prevent crash.

Change-Id: I9066fb7456d85fdc197fe21fed26fb2bb89ff09e
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
fdb62835992e82681d2166dbf5716e26ab57d964 08-Aug-2015 Pavlin Radoslavov <pavlin@google.com> Revert "Bluetooth-OPP: Enable support to send same file multiple times"

This reverts commit 86449ac4bc7a8f4b2afeab4da420ae4f980c850a.

The revert is needed to address an issue that crashes Bluetooth.

Bug: 22836458
Change-Id: I8c8b51544637dd1c2250eb91e86cb2ca1bbc9fe7
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
0f2f4d93c88a9d8fc5a2489cb51831b3caf178e1 29-Aug-2013 Pradeep Panigrahi <pradeepp@codeaurora.org> Display proper file name while cancelling transfer

Use Case:
1) Send files in batch from remote to DUT
2) Cancel the transfer in between from either side.
3) Check name of the files in failed tranfer message.

Failure:
Name shown in the failure message is different than actual file
name in batch

Fix:
Save names of all the selected files to be transferred even
before starting of client thread so that names remain intact
in the outbound information even when the batch is cancelled
from initiator.

Bug: 21896912
Change-Id: I42c98721365c4c8acb746d49ba9ceff5b0737b71
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
86449ac4bc7a8f4b2afeab4da420ae4f980c850a 13-Dec-2013 Hemant Gupta <hemantg@codeaurora.org> Bluetooth-OPP: Enable support to send same file multiple times

Change will add support to send same file multiple times. Otherwise,
if same file is selected to send multiple times after first transfer
succeeds queued instances of the same file got removed and it fails
to be sent.

Change-Id: Ic5b3706644a417cae2491d1df9588a22344f1711
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
ee52ddf33a0ce2cf89cc028136f60ae600c45de5 27-Jul-2012 Jake Hamby <jhamby@google.com> Enable Bluetooth sharing of downloaded files.

Change BT OPP to open the InputStreams of files to share in the
BluetoothOppLauncherActivity (or BluetoothOppHandoverReceiver
for NFC shares), while the process has grantUriPermission() on
the URI's to share.

InputStreams are saved inside the existing BluetoothOppSendFileInfo
objects, which no longer include the mDestination field because
this isn't known at the time the SendFileInfo object is now created
(before the user has chosen the destination BT device). These
objects are stored in a static ConcurrentHashMap in BluetoothOppUtility
and are removed when the file is closed (on success or failure).

If the user tries to share thousands of files in one batch, we may
not be able to open InputStreams for all of the files in the batch.
In this case, the open should fail gracefully.

Bug: 6808783
Change-Id: I3f3f86d2dc1a78a837aeb6a888f90b26434ba499
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
7a4cc5c2f6ec06e8dc6f930680ce9aceff6df359 14-May-2012 Martijn Coenen <maco@google.com> Add BT address and mimeType to handover intents.

Also, allow refreshing whitelisted entries by sending
another whitelist intent.

Change-Id: If85db397e31364939c67b3018413b625a1888ae6
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
8099f5e7bfa7227ba674b5f0076f331e737bafd7 06-Apr-2012 Martijn Coenen <maco@google.com> Additional changes to support Bluetooth Beam.

- Added a whitelist permission, to ensure only system
services (such as NFC) can whitelist MAC addresses.
- Added HANDOVER_STATUS permission, to ensure handover
transfer status can only be received by eligible services
(such as NFC).
- Added new confirmation type HANDOVER_CONFIRMED; this indicates
the transfer was initiated by a handover, and doesn't need to be
confirmed. This type is also reused to send broadcasts
to the NFC service, so the NFC service can show notifications
and deal with the received data.
- Added 15 second timeout to whitelist.
- Modify notication code to not show any notifications for handover
transfers; instead, send broadcasts to indicate handover status.
- Modify "transfer complete" code to sendbroasts to indicate handover
status.
Change-Id: I00c08e09eaf44f0bd4bd837cb6b0c37b802742bc
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
d6eaf19f39e163e16d22e29907edec402b30622e 04-Apr-2012 Nick Pelly <npelly@google.com> First cut at Bluetooth Beam.

Add Bluetooth address white-listing to avoid receive confirmation from
Beam interactions.

Change-Id: I25720c6e902c494cbb9845a30a175edad4225b89
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
e7f887dab2591a46ecf80616e00f33bb5d847935 07-Dec-2010 Jean-Baptiste Queru <jbq@google.com> resolved conflicts for merge of 55936599 to stage-korg-master

Change-Id: I5f04a3ae2f0246853f16b0fdb209e67df95e6ca8
a930b6831d0c70b6c5d34e548e6b1dceaa6529a0 01-Nov-2010 Mohammad Shamsi <m.h.shams@gmail.com> code cleanup.
unused imports, local variabls and static constans removed from
com.android.bluetooth.opp package.

Change-Id: I0fd682a190221e216fac71723c05d3828b9fa42d
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
55470710c2624bde2aa56275d29b60055638c06c 03-Sep-2010 Brad Fitzpatrick <bradfitz@android.com> Replace use of SharedPreference commit() with apply().

Also fix a typo and replace a bunch of redundant
SharedPreference.Editor commits with one at the end.

Change-Id: I75623cb6809a363d05421f80f1560d586ae1ab80
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
0bd5f7b5c36a60687ffe895368fd8df6df38acab 24-Mar-2010 Jaikumar Ganesh <jaikumar@google.com> Fix pbap and opp running bluetooth in phone process problems.

1. Use the right context instead of application context.
2. Make PbapActivity run in the same process as PbapService as they
share state.

Change-Id: Ib50c63c271dd8b30108f22734c47ee8645cd4839
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
c6f1bacf1d4c39d7efd5dc98004d936c18ed51f1 23-Dec-2009 Lixin Yue <L.X.YUE@motorola.com> Move insert share info operation to a thread to avoid Receiver timeout

In OppReceiver, the function mOppManager.startTransfer(remoteDevice), which
is used to insert share records to DB, can be really a time-consuming
operation in case of 300 or more objects sharing case.
For onReceive() function in BroadcastReceiver, there are below specification:
The function is normally called within the main thread of its process, so you should never
perform long-running operations in it (there is a timeout of 10 seconds that the system allows
before considering the receiver to be blocked and a candidate to be killed)

Add handle to concurrent sending case
In Gellary, user can multiple select files (say 50files), and share via bluetooth to device1,
and then right away share via bluetooth to device2, and also can share to device3. In such
extream case, we need ensure all share info are saved to db.

Complete the TODO in OppManager
Store application data to SharedPreferences and restore them when service restart.
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
3a88b20fcd71e42451e402d27374b19eeb2ff0da 08-Oct-2009 Nick Pelly <npelly@google.com> Update application code for BluetoothAdapter.getDefaultAdapter().

Change-Id: I7baafb909b74783da4e51d48f2465e7aacf07eb5
DrNo: eastham
Bug: 2158765
Joke: What goes 99-thump, 99-thump? A centipede with a wooden leg.
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
ce4d93666275df294cb073fe41de5b85932570a8 28-Aug-2009 Nick Pelly <npelly@google.com> Clean up Logging.

Use the pattern if (V) Log.v(...); for logging. The Android style prefers curly braces, but for log lines it is ok to use a one-liner to keep the code manageable.

Remove spaces from some log tags, and rename TAG BluetoothShareProvider to BluetoothOpp.

Rename LOGVV to V, and LOGV to D.

Just before ship we will change Constants.DEBUG and Constants.VERBOSE to false to compile out all the logging code.
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
1ac5507790a87810061a19dadec36eb328a222ea 07-Aug-2009 Tao Liejun <L.J.Tao@motorola.com> OPP update

Rewrite provider permission to allow LiveFolders work
Support file:// uri to share file
Support multiple share from gallery
Fully support sending file queue
Hold incoming connection for a while when OPP is busy instead of reject directly
Move notification update to a thread
Handle many error cases to display correct error messages
Improve server/client timeout
Delete empty file after reject incoming file
Support upper case incoming file extension
Avoid multiple mediascanner connections
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
41ef8d494511c040451f2f887cb31c3100746b61 07-Aug-2009 Nick Pelly <npelly@google.com> Bluetooth: Update Bluetooth.apk to match BT API change.

Split BluetoothDevice into BluetoothDevice and BluetoothAdapter.

BluetoothAdapter: Represents the local BT adapter. Operations on the local
adapter (start a scan, etc).
BluetoothDevice: Represents a remote BT device. Operations on remote devices
(pair, connect, etc).
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
6769b59d715ea98bd72eafcfea9acd2714a887da 15-Jul-2009 Tao Liejun <L.J.Tao@motorola.com> Make opp compile

Modify to make opp application compliable in new git
-change package name
-change manifest
-modify a few comments
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java
09e9cba205af60b3f42e7a4d891a7d1392e1f2a5 11-Jul-2009 Nick Pelly <npelly@google.com> Initial drop of Motorola Bluetooth OPP code.

Minor changes from Moto code:
- Added Motorola BSD license
- Moved com.motorola.bluetoothshare to com.android.bluetooth.opp
- Updated com.motorola.obex to javax.obex
- Moved Android.mk to Android.mk.hide: does not yet compile due to changes in
Obex library.
/packages/apps/Bluetooth/src/com/android/bluetooth/opp/BluetoothOppManager.java