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.
5 files changed
tree: ad28d015f318fe18f55e1b725f01fdf0a074c458
  1. android/