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

Commit e72ff6b0 authored by Venkata Ramana Rao K's avatar Venkata Ramana Rao K Committed by Gerrit - the friendly Code Review server
Browse files

Pairing dialog is not cleared from UI after remote reject paring

- This is happening because of remote is sending pairing request
  and immediately sending the disconnection request. Because of
  the framework delay, pairing dialog is getting displayed after
  disconnection request came to DUT from remote.
  due to this BT pairing dialog is not getting cleared.
- This patch will clear the pairing dialog.

Change-Id: I98b9fd545894325190f025b36c9293ed08f44aa9
CRs-Fixed: 1065707
parent 17130bd8
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -38,6 +38,8 @@ import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.TextView;
import android.os.Handler;
import android.os.Message;

import com.android.internal.app.AlertActivity;
import com.android.internal.app.AlertController;
@@ -58,6 +60,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements

    private static final int BLUETOOTH_PIN_MAX_LENGTH = 16;
    private static final int BLUETOOTH_PASSKEY_MAX_LENGTH = 6;
    private static final int PAIRING_POPUP_TIMEOUT = 35000;
    private static final int MESSAGE_DELAYED_DISMISS = 1;

    private LocalBluetoothManager mBluetoothManager;
    private CachedBluetoothDeviceManager mCachedDeviceManager;
@@ -123,6 +127,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
            case BluetoothDevice.PAIRING_VARIANT_PIN_16_DIGITS:
            case BluetoothDevice.PAIRING_VARIANT_PASSKEY:
                createUserEntryDialog();
                popTimedout();
                break;

            case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION:
@@ -134,11 +139,13 @@ public final class BluetoothPairingDialog extends AlertActivity implements
                }
                mPairingKey = String.format(Locale.US, "%06d", passkey);
                createConfirmationDialog();
                popTimedout();
                break;

            case BluetoothDevice.PAIRING_VARIANT_CONSENT:
            case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT:
                createConsentDialog();
                popTimedout();
                break;

            case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PASSKEY:
@@ -155,6 +162,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements
                    mPairingKey = String.format("%04d", pairingKey);
                }
                createDisplayPasskeyOrPinDialog();
                popTimedout();
                break;

            default:
@@ -467,4 +475,25 @@ public final class BluetoothPairingDialog extends AlertActivity implements
            mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER);
        }
    }

    private void popTimedout() {

        Message message = mHandler.obtainMessage(MESSAGE_DELAYED_DISMISS);
        mHandler.sendMessageDelayed(message, PAIRING_POPUP_TIMEOUT);

    }

    private final Handler mHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case MESSAGE_DELAYED_DISMISS:
                    Log.v(TAG, "Delayed pairing pop up handler");
                    dismiss();
                    break;
                default:
                    break;
            }
        }
    };
}