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

Commit 746d13f3 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Annotations for Bluetooth broadcast intents." into sc-dev

parents ae8cb8db db0d7dc1
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.bluetooth.btservice;

import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.BLUETOOTH_SCAN;

import android.bluetooth.BluetoothA2dp;
import android.bluetooth.BluetoothA2dpSink;
@@ -887,7 +888,7 @@ class AdapterProperties {
                        intent = new Intent(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED);
                        intent.putExtra(BluetoothAdapter.EXTRA_SCAN_MODE, mScanMode);
                        intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
                        mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
                        mService.sendBroadcast(intent, BLUETOOTH_SCAN);
                        debugLog("Scan Mode:" + mScanMode);
                        break;
                    case AbstractionLayer.BT_PROPERTY_UUIDS:
@@ -1034,12 +1035,12 @@ class AdapterProperties {
                mService.clearDiscoveringPackages();
                mDiscoveryEndMs = System.currentTimeMillis();
                intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
                mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
                mService.sendBroadcast(intent, BLUETOOTH_SCAN);
            } else if (state == AbstractionLayer.BT_DISCOVERY_STARTED) {
                mDiscovering = true;
                mDiscoveryEndMs = System.currentTimeMillis() + DEFAULT_DISCOVERY_TIMEOUT_MS;
                intent = new Intent(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
                mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
                mService.sendBroadcast(intent, BLUETOOTH_SCAN);
            }
        }
    }
+5 −6
Original line number Diff line number Diff line
@@ -631,14 +631,13 @@ final class RemoteDevices {

                intent.setPackage(pkg.getPackageName());

                String[] perms;
                if (pkg.getPermission() == null) {
                    perms = new String[] { BLUETOOTH_SCAN };
                if (pkg.getPermission() != null) {
                    sAdapterService.sendBroadcastMultiplePermissions(intent,
                            new String[] { BLUETOOTH_SCAN, pkg.getPermission() });
                } else {
                    perms = new String[] { BLUETOOTH_SCAN, pkg.getPermission() };
                    sAdapterService.sendBroadcastMultiplePermissions(intent,
                            new String[] { BLUETOOTH_SCAN });
                }

                sAdapterService.sendBroadcastMultiplePermissions(intent, perms);
            }
        }
    }
+2 −2
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ public class BluetoothMapService extends ProfileService {
                        intent.putExtra(BluetoothDevice.EXTRA_DEVICE, sRemoteDevice);
                        intent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE,
                                BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS);
                        sendBroadcast(intent);
                        sendBroadcast(intent, BLUETOOTH_CONNECT);
                        cancelUserTimeoutAlarm();
                        mIsWaitingAuthorization = false;
                        stopObexServerSessions(-1);
@@ -1021,7 +1021,7 @@ public class BluetoothMapService extends ProfileService {
        // Pending messages are no longer valid. To speed up things, simply delete them.
        if (mRemoveTimeoutMsg) {
            Intent timeoutIntent = new Intent(USER_CONFIRM_TIMEOUT_ACTION);
            sendBroadcast(timeoutIntent, BLUETOOTH_CONNECT);
            sendBroadcast(timeoutIntent);
            mIsWaitingAuthorization = false;
            cancelUserTimeoutAlarm();
        }
+16 −11
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@
package com.android.bluetooth.mapclient;

import static android.Manifest.permission.BLUETOOTH_CONNECT;
import static android.Manifest.permission.RECEIVE_SMS;

import android.app.Activity;
import android.app.PendingIntent;
@@ -735,28 +736,32 @@ class MceStateMachine extends StateMachine {
                Log.e(TAG, "Set message status failed");
                result = BluetoothMapClient.RESULT_FAILURE;
            }
            Intent intent;
            RequestSetMessageStatus.StatusIndicator status = request.getStatusIndicator();
            switch (status) {
                case READ:
                    intent = new Intent(BluetoothMapClient.ACTION_MESSAGE_READ_STATUS_CHANGED);
                case READ: {
                    Intent intent = new Intent(
                            BluetoothMapClient.ACTION_MESSAGE_READ_STATUS_CHANGED);
                    intent.putExtra(BluetoothMapClient.EXTRA_MESSAGE_READ_STATUS,
                            request.getValue() == RequestSetMessageStatus.STATUS_YES ? true : false);
                    intent.putExtra(BluetoothMapClient.EXTRA_MESSAGE_HANDLE, request.getHandle());
                    intent.putExtra(BluetoothMapClient.EXTRA_RESULT_CODE, result);
                    mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
                    break;

                case DELETED:
                    intent = new Intent(BluetoothMapClient.ACTION_MESSAGE_DELETED_STATUS_CHANGED);
                }
                case DELETED: {
                    Intent intent = new Intent(
                            BluetoothMapClient.ACTION_MESSAGE_DELETED_STATUS_CHANGED);
                    intent.putExtra(BluetoothMapClient.EXTRA_MESSAGE_DELETED_STATUS,
                            request.getValue() == RequestSetMessageStatus.STATUS_YES ? true : false);
                    intent.putExtra(BluetoothMapClient.EXTRA_MESSAGE_HANDLE, request.getHandle());
                    intent.putExtra(BluetoothMapClient.EXTRA_RESULT_CODE, result);
                    mService.sendBroadcast(intent, BLUETOOTH_CONNECT);
                    break;

                }
                default:
                    Log.e(TAG, "Unknown status indicator " + status);
                    return;
            }
            intent.putExtra(BluetoothMapClient.EXTRA_MESSAGE_HANDLE, request.getHandle());
            intent.putExtra(BluetoothMapClient.EXTRA_RESULT_CODE, result);
            mService.sendBroadcast(intent);
        }

        /**
@@ -846,7 +851,7 @@ class MceStateMachine extends StateMachine {
                    if (defaultMessagingPackage != null) {
                        intent.setPackage(defaultMessagingPackage);
                    }
                    mService.sendBroadcast(intent, android.Manifest.permission.RECEIVE_SMS);
                    mService.sendBroadcast(intent, RECEIVE_SMS);
                    break;
                case EMAIL:
                default:
+1 −2
Original line number Diff line number Diff line
@@ -194,8 +194,7 @@ public class BluetoothOppLauncherActivity extends Activity {
                Log.v(TAG, "Get ACTION_OPEN intent: Uri = " + uri);
            }

            Intent intent1 = new Intent();
            intent1.setAction(action);
            Intent intent1 = new Intent(Constants.ACTION_OPEN);
            intent1.setClassName(Constants.THIS_PACKAGE_NAME, BluetoothOppReceiver.class.getName());
            intent1.setDataAndNormalize(uri);
            this.sendBroadcast(intent1);
Loading