BluetoothOppHandoverReceiver.java revision 8099f5e7bfa7227ba674b5f0076f331e737bafd7
1/* 2 * Copyright (C) 2012 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.bluetooth.opp; 18 19import android.bluetooth.BluetoothDevice; 20import android.content.BroadcastReceiver; 21import android.content.Context; 22import android.content.Intent; 23import android.util.Log; 24 25public class BluetoothOppHandoverReceiver extends BroadcastReceiver { 26 public static final String TAG ="BluetoothOppHandoverReceiver"; 27 private static final boolean D = Constants.DEBUG; 28 private static final boolean V = Constants.VERBOSE; 29 30 @Override 31 public void onReceive(Context context, Intent intent) { 32 String action = intent.getAction(); 33 if (action.equals(Constants.ACTION_WHITELIST_DEVICE)) { 34 BluetoothDevice device = 35 (BluetoothDevice)intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); 36 if (D) Log.d(TAG, "Adding " + device + " to whitelist"); 37 if (device == null) return; 38 BluetoothOppManager.getInstance(context).addToWhitelist(device.getAddress()); 39 } else { 40 if (D) Log.d(TAG, "Unknown action: " + action); 41 } 42 } 43 44} 45