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

Commit 1cf3da1c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Bluetooth: Remove the PBAP pop up in various scenarios"

parents 23e52ff3 31cd6082
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@
            <intent-filter>
                <action android:name="android.bluetooth.adapter.action.STATE_CHANGED"/>
                <action android:name="android.bluetooth.device.action.CONNECTION_ACCESS_REPLY" />
                <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </receiver>
+22 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2008-2009, Motorola, Inc.
 *
 * All rights reserved.
@@ -229,7 +230,7 @@ public class BluetoothPbapService extends Service {
    // process the intent from receiver
    private void parseIntent(final Intent intent) {
        String action = intent.getStringExtra("action");
        if (VERBOSE) Log.v(TAG, "action: " + action);
        if (DEBUG) Log.d(TAG, "action: " + action);

        int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
        if (VERBOSE) Log.v(TAG, "state: " + state);
@@ -249,6 +250,24 @@ public class BluetoothPbapService extends Service {
            } else {
                removeTimeoutMsg = false;
            }
        } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED) &&
                   isWaitingAuthorization) {
            BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);

            if (mRemoteDevice == null || device == null) {
                Log.e(TAG, "Unexpected error!");
                return;
            }

            if (DEBUG) Log.d(TAG,"ACL disconnected for "+ device);

            if (mRemoteDevice.equals(device)) {
                Intent cancelIntent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL);
                cancelIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device);
                sendBroadcast(cancelIntent);
                isWaitingAuthorization = false;
                stopObexServerSession();
            }
        } else if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY)) {
            if (!isWaitingAuthorization) {
                // this reply is not for us
@@ -615,7 +634,7 @@ public class BluetoothPbapService extends Service {
    private final Handler mSessionStatusHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (VERBOSE) Log.v(TAG, "Handler(): got msg=" + msg.what);
            if (DEBUG) Log.d(TAG, "Handler(): got msg=" + msg.what);

            switch (msg.what) {
                case START_LISTENER:
@@ -627,7 +646,7 @@ public class BluetoothPbapService extends Service {
                    break;
                case USER_TIMEOUT:
                    Intent intent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_CANCEL);
                    intent.setClassName(ACCESS_AUTHORITY_PACKAGE, ACCESS_AUTHORITY_CLASS);
                    intent.putExtra(BluetoothDevice.EXTRA_DEVICE, mRemoteDevice);
                    sendBroadcast(intent);
                    isWaitingAuthorization = false;
                    stopObexServerSession();