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

Commit 208cef99 authored by Szymon Pusz's avatar Szymon Pusz
Browse files

Bluetooth: fix StaleDataException when pairing with other device

This fixes a crash when pairing for example with car audio that reads sms/mms
FATAL EXCEPTION: BluetoothMnsObexClient
Process: com.android.bluetooth, PID: 1944
android.database.StaleDataException: Attempted to access a cursor after it has been closed.
	at android.database.BulkCursorToCursorAdaptor.throwIfCursorIsClosed(BulkCursorToCursorAdaptor.java:64)
	at android.database.BulkCursorToCursorAdaptor.getCount(BulkCursorToCursorAdaptor.java:70)
	at android.database.AbstractCursor.moveToPosition(AbstractCursor.java:197)
	at android.database.AbstractCursor.moveToNext(AbstractCursor.java:245)
	at android.database.CursorWrapper.moveToNext(CursorWrapper.java:166)
	at com.android.bluetooth.map.BluetoothMapContentObserver.initMsgList(BluetoothMapContentObserver.java:405)
	at com.android.bluetooth.map.BluetoothMapContentObserver.registerObserver(BluetoothMapContentObserver.java:334)
	at com.android.bluetooth.map.BluetoothMnsObexClient.handleRegistration(BluetoothMnsObexClient.java:238)
	at com.android.bluetooth.map.BluetoothMnsObexClient$MnsObexClientHandler.handleMessage(BluetoothMnsObexClient.java:107)
	at android.os.Handler.dispatchMessage(Handler.java:102)
	at android.os.Looper.loop(Looper.java:135)
	at android.os.HandlerThread.run(HandlerThread.java:61)

Change-Id: Idea00c396c2512480befbf262571c8d8242e4af7
parent 58a28f74
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -396,8 +396,8 @@ public class BluetoothMapContentObserver {
                mMsgListSms = msgListSms;
            }



        c = mResolver.query(Mms.CONTENT_URI,
            MMS_PROJECTION, null, null, null);

        HashMap<Long, Msg> msgListMms = new HashMap<Long, Msg>();