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

Commit ee124ba3 authored by ilbeom.kim's avatar ilbeom.kim Committed by Pavlin Radoslavov
Browse files

Fix Bluetooth crash when open the opp transfer history on the lock screen

BluetoothOppTransferHistory was using the deprecated managedQuery
to get the cursor. The managedQuery was deprecated in API level 11.
Changed managedQuery to contentResolver.query() to resolve the issue.

Test: The following procedure:
1. Enable pattern lock on DUT (receiver phone)
2. Send an image file via Bluetooth from another phone
3. Accept the file transfer on DUT
4. Wait until file transfer is completed
5. Open the received file history from the lock screen (double-tap)

Bug: 63747089
Change-Id: I6def857579ec96c10f3d22260ccba30f9ef4a57e
parent d517b558
Loading
Loading
Loading
Loading
+15 −5
Original line number Original line Diff line number Diff line
@@ -39,6 +39,7 @@ import android.app.AlertDialog;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothAdapter;
import android.content.DialogInterface;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.Intent;
import android.content.ContentResolver;
import android.database.Cursor;
import android.database.Cursor;
import android.net.Uri;
import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
@@ -118,11 +119,12 @@ public class BluetoothOppTransferHistory extends Activity implements


        final String sortOrder = BluetoothShare.TIMESTAMP + " DESC";
        final String sortOrder = BluetoothShare.TIMESTAMP + " DESC";


        mTransferCursor = managedQuery(BluetoothShare.CONTENT_URI, new String[] {
        mTransferCursor = getContentResolver().query(BluetoothShare.CONTENT_URI,
                "_id", BluetoothShare.FILENAME_HINT, BluetoothShare.STATUS,
                new String[] {"_id", BluetoothShare.FILENAME_HINT, BluetoothShare.STATUS,
                        BluetoothShare.TOTAL_BYTES, BluetoothShare._DATA, BluetoothShare.TIMESTAMP,
                        BluetoothShare.TOTAL_BYTES, BluetoothShare._DATA, BluetoothShare.TIMESTAMP,
                BluetoothShare.VISIBILITY, BluetoothShare.DESTINATION, BluetoothShare.DIRECTION
                        BluetoothShare.VISIBILITY, BluetoothShare.DESTINATION,
        }, selection, sortOrder);
                        BluetoothShare.DIRECTION},
                selection, null, sortOrder);


        // only attach everything to the listbox if we can access
        // only attach everything to the listbox if we can access
        // the transfer database. Otherwise, just show it empty
        // the transfer database. Otherwise, just show it empty
@@ -192,6 +194,14 @@ public class BluetoothOppTransferHistory extends Activity implements
        return false;
        return false;
    }
    }


    @Override
    protected void onDestroy() {
        if (mTransferCursor != null) {
            mTransferCursor.close();
        }
        super.onDestroy();
    }

    @Override
    @Override
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
        if (mTransferCursor != null) {
        if (mTransferCursor != null) {