packages/apps/Settings
Revisión | 05902a0634109fb2c20eeb10bd1b7a8e9b82eda5 (tree) |
---|---|
Tiempo | 2018-08-11 05:29:10 |
Autor | Hansong Zhang <hsz@goog...> |
Commiter | android-build-team Robot |
DO NOT MERGE Give PBAP permission only after user confirms
Bug: 72872376
Test: manual
Change-Id: I9617e3c10bf19e22f9a8f172332a83bbbebaf4a4
(cherry picked from commit e36ca3e96d8c014d39f6ffa377f5e5fc69e1f4c5)
@@ -57,6 +57,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, | ||
57 | 57 | private int mPasskey; |
58 | 58 | private String mDeviceName; |
59 | 59 | private LocalBluetoothProfile mPbapClientProfile; |
60 | + private boolean mPbapAllowed; | |
60 | 61 | |
61 | 62 | /** |
62 | 63 | * Creates an instance of a BluetoothPairingController. |
@@ -87,15 +88,20 @@ public class BluetoothPairingController implements OnCheckedChangeListener, | ||
87 | 88 | @Override |
88 | 89 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
89 | 90 | if (isChecked) { |
90 | - mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); | |
91 | + mPbapAllowed = true; | |
91 | 92 | } else { |
92 | - mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); | |
93 | + mPbapAllowed = false; | |
93 | 94 | } |
94 | 95 | } |
95 | 96 | |
96 | 97 | @Override |
97 | 98 | public void onDialogPositiveClick(BluetoothPairingDialogFragment dialog) { |
98 | 99 | if (getDialogType() == USER_ENTRY_DIALOG) { |
100 | + if (mPbapAllowed) { | |
101 | + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); | |
102 | + } else { | |
103 | + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); | |
104 | + } | |
99 | 105 | onPair(mUserInput); |
100 | 106 | } else { |
101 | 107 | onPair(null); |
@@ -104,6 +110,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, | ||
104 | 110 | |
105 | 111 | @Override |
106 | 112 | public void onDialogNegativeClick(BluetoothPairingDialogFragment dialog) { |
113 | + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); | |
107 | 114 | onCancel(); |
108 | 115 | } |
109 | 116 |