summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/settings/bluetooth/BluetoothPairingDialog.java')
-rwxr-xr-xsrc/com/android/settings/bluetooth/BluetoothPairingDialog.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
index 1ff99f7..716ce41 100755
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java
@@ -66,6 +66,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
private String mPairingKey;
private EditText mPairingView;
private Button mOkButton;
+ private boolean mIsButtonPressed;
/**
* Dismiss the dialog if the bond state changes to bonded or none,
@@ -95,6 +96,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mIsButtonPressed = false;
+
Intent intent = getIntent();
if (!intent.getAction().equals(BluetoothDevice.ACTION_PAIRING_REQUEST))
{
@@ -364,7 +367,9 @@ public final class BluetoothPairingDialog extends AlertActivity implements
@Override
protected void onDestroy() {
super.onDestroy();
- unregisterReceiver(mReceiver);
+ if (mReceiver != null) {
+ unregisterReceiver(mReceiver);
+ }
}
public void afterTextChanged(Editable s) {
@@ -424,6 +429,11 @@ public final class BluetoothPairingDialog extends AlertActivity implements
}
public void onClick(DialogInterface dialog, int which) {
+ if(mIsButtonPressed)
+ {
+ Log.e(TAG, "button already pressed");
+ return;
+ }
switch (which) {
case BUTTON_POSITIVE:
if (mPairingView != null) {
@@ -431,9 +441,11 @@ public final class BluetoothPairingDialog extends AlertActivity implements
} else {
onPair(null);
}
+ mIsButtonPressed = true;
break;
case BUTTON_NEGATIVE:
+ mIsButtonPressed = true;
default:
onCancel();
break;