packages/apps/Settings
Revision | 65d27a55aba3bf1b134c2d81d6e9a605c2d2206d (tree) |
---|---|
Time | 2018-12-21 18:18:58 |
Author | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
Merge tag 'android-8.1.0_r53' into oreo-x86
Android 8.1.0 release 53
@@ -23,12 +23,16 @@ import android.text.Editable; | ||
23 | 23 | import android.util.Log; |
24 | 24 | import android.widget.CompoundButton; |
25 | 25 | import android.widget.CompoundButton.OnCheckedChangeListener; |
26 | + | |
26 | 27 | import com.android.settings.R; |
27 | 28 | import com.android.settings.bluetooth.BluetoothPairingDialogFragment.BluetoothPairingDialogListener; |
28 | 29 | import com.android.settingslib.bluetooth.LocalBluetoothManager; |
29 | 30 | import com.android.settingslib.bluetooth.LocalBluetoothProfile; |
31 | + | |
30 | 32 | import java.util.Locale; |
31 | 33 | |
34 | +import android.support.annotation.VisibleForTesting; | |
35 | + | |
32 | 36 | /** |
33 | 37 | * A controller used by {@link BluetoothPairingDialog} to manage connection state while we try to |
34 | 38 | * pair with a bluetooth device. It includes methods that allow the |
@@ -50,8 +54,10 @@ public class BluetoothPairingController implements OnCheckedChangeListener, | ||
50 | 54 | |
51 | 55 | // Bluetooth dependencies for the connection we are trying to establish |
52 | 56 | private LocalBluetoothManager mBluetoothManager; |
53 | - private BluetoothDevice mDevice; | |
54 | - private int mType; | |
57 | + @VisibleForTesting | |
58 | + BluetoothDevice mDevice; | |
59 | + @VisibleForTesting | |
60 | + int mType; | |
55 | 61 | private String mUserInput; |
56 | 62 | private String mPasskeyFormatted; |
57 | 63 | private int mPasskey; |
@@ -82,7 +88,6 @@ public class BluetoothPairingController implements OnCheckedChangeListener, | ||
82 | 88 | mDeviceName = mBluetoothManager.getCachedDeviceManager().getName(mDevice); |
83 | 89 | mPbapClientProfile = mBluetoothManager.getProfileManager().getPbapClientProfile(); |
84 | 90 | mPasskeyFormatted = formatKey(mPasskey); |
85 | - | |
86 | 91 | } |
87 | 92 | |
88 | 93 | @Override |
@@ -96,12 +101,13 @@ public class BluetoothPairingController implements OnCheckedChangeListener, | ||
96 | 101 | |
97 | 102 | @Override |
98 | 103 | public void onDialogPositiveClick(BluetoothPairingDialogFragment dialog) { |
104 | + if (mPbapAllowed) { | |
105 | + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); | |
106 | + } else { | |
107 | + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); | |
108 | + } | |
109 | + | |
99 | 110 | if (getDialogType() == USER_ENTRY_DIALOG) { |
100 | - if (mPbapAllowed) { | |
101 | - mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); | |
102 | - } else { | |
103 | - mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_REJECTED); | |
104 | - } | |
105 | 111 | onPair(mUserInput); |
106 | 112 | } else { |
107 | 113 | onPair(null); |