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

Commit d2778f32 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Bluetooth: Ensure only desired intents are being handled" into oc-dev

parents 61117c61 42a25ba8
Loading
Loading
Loading
Loading
+5 −4
Original line number Original line Diff line number Diff line
@@ -71,12 +71,13 @@ public class BluetoothDiscoverableTimeoutReceiver extends BroadcastReceiver {


    @Override
    @Override
    public void onReceive(Context context, Intent intent) {
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction() == null || !intent.getAction().equals(INTENT_DISCOVERABLE_TIMEOUT)) {
            return;
        }
        LocalBluetoothAdapter localBluetoothAdapter = LocalBluetoothAdapter.getInstance();
        LocalBluetoothAdapter localBluetoothAdapter = LocalBluetoothAdapter.getInstance();

        if(localBluetoothAdapter != null  &&
        if(localBluetoothAdapter != null  &&
            localBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
            localBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) {
            Log.d(TAG, "Disable discoverable...");
            Log.d(TAG, "Disable discoverable...");

            localBluetoothAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE);
            localBluetoothAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE);
        } else {
        } else {
            Log.e(TAG, "localBluetoothAdapter is NULL!!");
            Log.e(TAG, "localBluetoothAdapter is NULL!!");