• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

Revisão66b6591d4c14400a18573a11880db16bb26ab80a (tree)
Hora2015-10-21 02:23:40
AutorMichael Wright <michaelwr@goog...>
CommiterAndroid (Google) Code Review

Mensagem de Log

Merge "Always show pairing dialog for device-specific keyboard." into mnc-dr-dev

Mudança Sumário

Diff

--- a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java
@@ -65,8 +65,10 @@ public final class BluetoothPairingRequest extends BroadcastReceiver {
6565 PowerManager powerManager =
6666 (PowerManager)context.getSystemService(Context.POWER_SERVICE);
6767 String deviceAddress = device != null ? device.getAddress() : null;
68- if (powerManager.isScreenOn() &&
69- LocalBluetoothPreferences.shouldShowDialogInForeground(context, deviceAddress)) {
68+ String deviceName = device != null ? device.getName() : null;
69+ boolean shouldShowDialog= LocalBluetoothPreferences.shouldShowDialogInForeground(
70+ context, deviceAddress, deviceName);
71+ if (powerManager.isInteractive() && shouldShowDialog) {
7072 // Since the screen is on and the BT-related activity is in the foreground,
7173 // just open the dialog
7274 context.startActivity(pairingIntent);
--- a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
+++ b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java
@@ -107,6 +107,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
107107 connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_CLASS_NAME, mReturnClass);
108108
109109 String deviceAddress = mDevice != null ? mDevice.getAddress() : null;
110+ String deviceName = mDevice != null ? mDevice.getName() : null;
110111 String title = null;
111112 String message = null;
112113 PowerManager powerManager =
@@ -114,7 +115,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
114115
115116 if (powerManager.isScreenOn()
116117 && LocalBluetoothPreferences.shouldShowDialogInForeground(
117- context, deviceAddress)) {
118+ context, deviceAddress, deviceName)) {
118119 context.startActivity(connectionAccessIntent);
119120 } else {
120121 // Acquire wakelock so that LCD comes up since screen is off
@@ -134,27 +135,27 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver {
134135 deleteIntent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT,
135136 BluetoothDevice.CONNECTION_ACCESS_NO);
136137 deleteIntent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType);
137- String deviceName = mDevice != null ? mDevice.getAliasName() : null;
138+ String deviceAlias = mDevice != null ? mDevice.getAliasName() : null;
138139 switch (mRequestType) {
139140 case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS:
140141 title = context.getString(R.string.bluetooth_phonebook_request);
141142 message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text,
142- deviceName, deviceName);
143+ deviceAlias, deviceAlias);
143144 break;
144145 case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS:
145146 title = context.getString(R.string.bluetooth_map_request);
146147 message = context.getString(R.string.bluetooth_map_acceptance_dialog_text,
147- deviceName, deviceName);
148+ deviceAlias, deviceAlias);
148149 break;
149150 case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS:
150151 title = context.getString(R.string.bluetooth_sap_request);
151152 message = context.getString(R.string.bluetooth_sap_acceptance_dialog_text,
152- deviceName, deviceName);
153+ deviceAlias, deviceAlias);
153154 break;
154155 default:
155156 title = context.getString(R.string.bluetooth_connection_permission_request);
156157 message = context.getString(R.string.bluetooth_connection_dialog_text,
157- deviceName, deviceName);
158+ deviceAlias, deviceAlias);
158159 break;
159160 }
160161 Notification notification = new Notification.Builder(context)
--- a/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java
+++ b/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java
@@ -20,6 +20,7 @@ import android.app.QueuedWork;
2020 import android.content.Context;
2121 import android.content.SharedPreferences;
2222 import android.content.res.Configuration;
23+import android.text.TextUtils;
2324 import android.util.Log;
2425
2526 import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
@@ -62,10 +63,10 @@ final class LocalBluetoothPreferences {
6263 }
6364
6465 static boolean shouldShowDialogInForeground(Context context,
65- String deviceAddress) {
66+ String deviceAddress, String deviceName) {
6667 LocalBluetoothManager manager = Utils.getLocalBtManager(context);
6768 if (manager == null) {
68- if(DEBUG) Log.v(TAG, "manager == null - do not show dialog.");
69+ if (DEBUG) Log.v(TAG, "manager == null - do not show dialog.");
6970 return false;
7071 }
7172
@@ -115,6 +116,18 @@ final class LocalBluetoothPreferences {
115116 }
116117 }
117118 }
119+
120+
121+ if (!TextUtils.isEmpty(deviceName)) {
122+ // If the device is a custom BT keyboard specifically for this device
123+ String packagedKeyboardName = context.getString(
124+ com.android.internal.R.string.config_packagedKeyboardName);
125+ if (deviceName.equals(packagedKeyboardName)) {
126+ if (DEBUG) Log.v(TAG, "showing dialog for packaged keyboard");
127+ return true;
128+ }
129+ }
130+
118131 if (DEBUG) Log.v(TAG, "Found no reason to show the dialog - do not show dialog.");
119132 return false;
120133 }