From 283ae5d1bbf57facc21f2f63b6aab064500105ff Mon Sep 17 00:00:00 2001 From: hughchen Date: Wed, 25 Sep 2019 10:55:15 +0800 Subject: [PATCH] Error handler for start dialog from adb command This CL added null check for the case that dialog is started from adb command. Bug: 129783237 Test: manually Change-Id: I47d47cb5ddfe3487e2d616d1cf2ed08bd11d215d --- .../android/settings/bluetooth/BluetoothPairingDialog.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java index 060c17491a1..927b1b63af5 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java @@ -65,6 +65,11 @@ public class BluetoothPairingDialog extends FragmentActivity { protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); + if (intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) == null) { + // Error handler for the case that dialog is started from adb command. + finish(); + return; + } mBluetoothPairingController = new BluetoothPairingController(intent, this); // build the dialog fragment boolean fragmentFound = true;