packages/apps/Settings
Revisão | fa14d8ff4741499f30fe4a16b4a9627750dede86 (tree) |
---|---|
Hora | 2011-09-03 09:15:33 |
Autor | Jaikumar Ganesh <jaikumar@goog...> |
Commiter | The Android Automerger |
DO NOT MERGE Fix crash when device is null in Connection Access Cancel.
Bug: 5203970
Change-Id: Ic0604174c0ac9b40685e883f37e1a54070ee0463
@@ -36,6 +36,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { | ||
36 | 36 | |
37 | 37 | private static final String TAG = "BluetoothPermissionRequest"; |
38 | 38 | private static final boolean DEBUG = false; |
39 | + private BluetoothDevice mDevice; | |
39 | 40 | |
40 | 41 | public static final int NOTIFICATION_ID = android.R.drawable.stat_sys_data_bluetooth; |
41 | 42 |
@@ -48,15 +49,14 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { | ||
48 | 49 | if (action.equals(BluetoothDevice.ACTION_CONNECTION_ACCESS_REQUEST)) { |
49 | 50 | LocalBluetoothManager localManager = LocalBluetoothManager.getInstance(context); |
50 | 51 | // convert broadcast intent into activity intent (same action string) |
51 | - BluetoothDevice device = | |
52 | - intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); | |
52 | + mDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); | |
53 | 53 | |
54 | 54 | Intent connectionAccessIntent = new Intent(action); |
55 | 55 | connectionAccessIntent.setClass(context, BluetoothPermissionActivity.class); |
56 | 56 | connectionAccessIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
57 | - connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, device); | |
57 | + connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice); | |
58 | 58 | |
59 | - String deviceAddress = device != null ? device.getAddress() : null; | |
59 | + String deviceAddress = mDevice != null ? mDevice.getAddress() : null; | |
60 | 60 | |
61 | 61 | PowerManager powerManager = |
62 | 62 | (PowerManager) context.getSystemService(Context.POWER_SERVICE); |
@@ -71,12 +71,13 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { | ||
71 | 71 | // "Clear All Notifications" button |
72 | 72 | |
73 | 73 | Intent deleteIntent = new Intent(BluetoothDevice.ACTION_CONNECTION_ACCESS_REPLY); |
74 | + deleteIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice); | |
74 | 75 | deleteIntent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT, |
75 | 76 | BluetoothDevice.CONNECTION_ACCESS_NO); |
76 | 77 | |
77 | 78 | Notification notification = new Notification(android.R.drawable.stat_sys_data_bluetooth, |
78 | 79 | context.getString(R.string.bluetooth_connection_permission_request), System.currentTimeMillis()); |
79 | - String deviceName = device != null ? device.getName() : null; | |
80 | + String deviceName = mDevice != null ? mDevice.getName() : null; | |
80 | 81 | notification.setLatestEventInfo(context, |
81 | 82 | context.getString(R.string.bluetooth_connection_permission_request), |
82 | 83 | context.getString(R.string.bluetooth_connection_notif_message, deviceName), |