Merge "Only cancel bonding if pair button is not pressed" into tm-dev
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
index 14b4a7a..650267a 100644
--- a/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingDialogFragment.java
@@ -55,6 +55,7 @@
     private BluetoothPairingController mPairingController;
     private BluetoothPairingDialog mPairingDialogActivity;
     private EditText mPairingView;
+    private boolean mPositiveClicked = false;
     /**
      * The interface we expect a listener to implement. Typically this should be done by
      * the controller.
@@ -85,7 +86,9 @@
     @Override
     public void onDestroy() {
         super.onDestroy();
-        mPairingController.onCancel();
+        if (!mPositiveClicked) {
+            mPairingController.onCancel();
+        }
     }
 
     @Override
@@ -110,6 +113,7 @@
     @Override
     public void onClick(DialogInterface dialog, int which) {
         if (which == DialogInterface.BUTTON_POSITIVE) {
+            mPositiveClicked = true;
             mPairingController.onDialogPositiveClick(this);
         } else if (which == DialogInterface.BUTTON_NEGATIVE) {
             mPairingController.onDialogNegativeClick(this);