From ac6c49d2b04c994e857a128d04ebeadb5fd32166 Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Mon, 2 Apr 2018 10:42:26 -0700 Subject: [PATCH] DO NOT MERGE Fix unexpected behavior in Bluetooth pairing * Set default PBAP permission to false * Remove all newline and tab characters in Bluetooth device name Bug: 72872376 Bug: 73173182 Test: manual Change-Id: I85f5f11c5803c3031bf9a56273c30c3ef305f63d --- .../android/settings/bluetooth/BluetoothPairingDialog.java | 6 ++++-- .../settings/bluetooth/BluetoothPermissionActivity.java | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java index 1ff99f787a3..a71ad24c929 100755 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java @@ -30,6 +30,7 @@ import android.text.InputFilter; import android.text.InputType; import android.text.TextWatcher; import android.text.InputFilter.LengthFilter; +import android.util.EventLog; import android.util.Log; import android.view.View; import android.widget.Button; @@ -197,8 +198,9 @@ public final class BluetoothPairingDialog extends AlertActivity implements } else { if (mDevice.getBluetoothClass().getDeviceClass() == BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE) { - contactSharing.setChecked(true); - mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); + contactSharing.setChecked(false); + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); + EventLog.writeEvent(0x534e4554, "73173182", -1, ""); } else { contactSharing.setChecked(false); mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java index 22675556c2a..0a7c7dfe9e9 100644 --- a/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java +++ b/src/com/android/settings/bluetooth/BluetoothPermissionActivity.java @@ -24,6 +24,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; import android.preference.Preference; +import android.util.EventLog; import android.util.Log; import android.view.View; import android.widget.TextView; @@ -154,7 +155,11 @@ public class BluetoothPermissionActivity extends AlertActivity implements String mRemoteName = mDevice != null ? mDevice.getAliasName() : null; if (mRemoteName == null) mRemoteName = getString(R.string.unknown); - return mRemoteName; + String nameNoNewline = mRemoteName.replaceAll("[\\t\\n\\r]+", " "); + if (!mRemoteName.equals(nameNoNewline)) { + EventLog.writeEvent(0x534e4554, "72872376", -1, ""); + } + return nameNoNewline; } // TODO(edjee): createConnectionDialogView, createPhonebookDialogView and createMapDialogView