diff options
author | Hiroki Yamamoto <hiroki.yamamoto@sonymobile.com> | 2017-06-12 12:24:26 +0900 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2017-07-25 17:24:26 -0700 |
commit | c8600f9a00f291fdb5e1981f1648f6a7fe4bc66e (patch) | |
tree | ec4d81e1152e57f6e79ad2a34f84dee23dfce978 | |
parent | 4baefd141b5222f009ecc872ce25e3eafdbf682e (diff) | |
download | android_packages_apps_Nfc-c8600f9a00f291fdb5e1981f1648f6a7fe4bc66e.tar.gz android_packages_apps_Nfc-c8600f9a00f291fdb5e1981f1648f6a7fe4bc66e.tar.bz2 android_packages_apps_Nfc-c8600f9a00f291fdb5e1981f1648f6a7fe4bc66e.zip |
Show Bluetooth device name on pairing confirmation dialog
Bluetooth device name cannot get from BluetoothDevice instance
unless it has paired once. So it should be got from NDEF.
Test: Pair with Bluetooth speaker by NFC touch
Bug: 62519652
Change-Id: Ic4b5efc8fbdd6c43f57efd565c8d64d832d6d5f4
(cherry picked from commit 7d13ce2c08093c237a196687eb9f5e2266450ec8)
-rw-r--r-- | src/com/android/nfc/handover/BluetoothPeripheralHandover.java | 1 | ||||
-rw-r--r-- | src/com/android/nfc/handover/ConfirmConnectActivity.java | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/nfc/handover/BluetoothPeripheralHandover.java b/src/com/android/nfc/handover/BluetoothPeripheralHandover.java index f47c7269..84618edb 100644 --- a/src/com/android/nfc/handover/BluetoothPeripheralHandover.java +++ b/src/com/android/nfc/handover/BluetoothPeripheralHandover.java @@ -545,6 +545,7 @@ public class BluetoothPeripheralHandover implements BluetoothProfile.ServiceList Intent dialogIntent = new Intent(mContext, ConfirmConnectActivity.class); dialogIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); dialogIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mDevice); + dialogIntent.putExtra(BluetoothDevice.EXTRA_NAME, mName); mContext.startActivity(dialogIntent); } diff --git a/src/com/android/nfc/handover/ConfirmConnectActivity.java b/src/com/android/nfc/handover/ConfirmConnectActivity.java index e76ab50b..75310e17 100644 --- a/src/com/android/nfc/handover/ConfirmConnectActivity.java +++ b/src/com/android/nfc/handover/ConfirmConnectActivity.java @@ -41,8 +41,8 @@ public class ConfirmConnectActivity extends Activity { mDevice = launchIntent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); if (mDevice == null) finish(); Resources res = getResources(); - String deviceName = mDevice.getName() != null ? mDevice.getName() : ""; - String confirmString = String.format(res.getString(R.string.confirm_pairing), deviceName); + String confirmString = String.format(res.getString(R.string.confirm_pairing), + launchIntent.getStringExtra(BluetoothDevice.EXTRA_NAME)); builder.setMessage(confirmString) .setCancelable(false) .setPositiveButton(res.getString(R.string.pair_yes), |