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
This commit is contained in:
hughchen
2019-09-25 10:55:15 +08:00
parent ed332c0829
commit 283ae5d1bb

View File

@@ -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;