diff options
author | Steve Kondik <steve@cyngn.com> | 2015-12-07 18:49:15 -0800 |
---|---|---|
committer | Steve Kondik <steve@cyngn.com> | 2015-12-07 18:49:15 -0800 |
commit | 64e314b61e865919fc8c94165e42dfc5fb7b92f4 (patch) | |
tree | abdadcbf11c325bdf7f79a1ba051043a82909211 /src/com/android/settings/bluetooth | |
parent | 89ae71c089067d2cd6a3e7304f4126abb57ab9be (diff) | |
parent | 46742e0cf933abfcf65be9009cd9262863280c34 (diff) | |
download | packages_apps_Settings-64e314b61e865919fc8c94165e42dfc5fb7b92f4.zip packages_apps_Settings-64e314b61e865919fc8c94165e42dfc5fb7b92f4.tar.gz packages_apps_Settings-64e314b61e865919fc8c94165e42dfc5fb7b92f4.tar.bz2 |
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/packages/apps/Settings into HEAD
Android 6.0.1 release 3
Change-Id: If54bacef03fc826fd02ca48db5ef3a25c8fc7127
Diffstat (limited to 'src/com/android/settings/bluetooth')
3 files changed, 26 insertions, 10 deletions
diff --git a/src/com/android/settings/bluetooth/BluetoothPairingRequest.java b/src/com/android/settings/bluetooth/BluetoothPairingRequest.java index 71d6364..3b2a81e 100644 --- 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 { PowerManager powerManager = (PowerManager)context.getSystemService(Context.POWER_SERVICE); String deviceAddress = device != null ? device.getAddress() : null; - if (powerManager.isScreenOn() && - LocalBluetoothPreferences.shouldShowDialogInForeground(context, deviceAddress)) { + String deviceName = device != null ? device.getName() : null; + boolean shouldShowDialog= LocalBluetoothPreferences.shouldShowDialogInForeground( + context, deviceAddress, deviceName); + if (powerManager.isInteractive() && shouldShowDialog) { // Since the screen is on and the BT-related activity is in the foreground, // just open the dialog context.startActivity(pairingIntent); diff --git a/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java b/src/com/android/settings/bluetooth/BluetoothPermissionRequest.java index 074e0bd..fc6b876 100644 --- 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 { connectionAccessIntent.putExtra(BluetoothDevice.EXTRA_CLASS_NAME, mReturnClass); String deviceAddress = mDevice != null ? mDevice.getAddress() : null; + String deviceName = mDevice != null ? mDevice.getName() : null; String title = null; String message = null; PowerManager powerManager = @@ -114,7 +115,7 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { if (powerManager.isScreenOn() && LocalBluetoothPreferences.shouldShowDialogInForeground( - context, deviceAddress)) { + context, deviceAddress, deviceName)) { context.startActivity(connectionAccessIntent); } else { // Acquire wakelock so that LCD comes up since screen is off @@ -134,27 +135,27 @@ public final class BluetoothPermissionRequest extends BroadcastReceiver { deleteIntent.putExtra(BluetoothDevice.EXTRA_CONNECTION_ACCESS_RESULT, BluetoothDevice.CONNECTION_ACCESS_NO); deleteIntent.putExtra(BluetoothDevice.EXTRA_ACCESS_REQUEST_TYPE, mRequestType); - String deviceName = mDevice != null ? mDevice.getAliasName() : null; + String deviceAlias = mDevice != null ? mDevice.getAliasName() : null; switch (mRequestType) { case BluetoothDevice.REQUEST_TYPE_PHONEBOOK_ACCESS: title = context.getString(R.string.bluetooth_phonebook_request); message = context.getString(R.string.bluetooth_pb_acceptance_dialog_text, - deviceName, deviceName); + deviceAlias, deviceAlias); break; case BluetoothDevice.REQUEST_TYPE_MESSAGE_ACCESS: title = context.getString(R.string.bluetooth_map_request); message = context.getString(R.string.bluetooth_map_acceptance_dialog_text, - deviceName, deviceName); + deviceAlias, deviceAlias); break; case BluetoothDevice.REQUEST_TYPE_SIM_ACCESS: title = context.getString(R.string.bluetooth_sap_request); message = context.getString(R.string.bluetooth_sap_acceptance_dialog_text, - deviceName, deviceName); + deviceAlias, deviceAlias); break; default: title = context.getString(R.string.bluetooth_connection_permission_request); message = context.getString(R.string.bluetooth_connection_dialog_text, - deviceName, deviceName); + deviceAlias, deviceAlias); break; } Notification notification = new Notification.Builder(context) diff --git a/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java b/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java index 9f2553f..401b13c 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothPreferences.java @@ -20,6 +20,7 @@ import android.app.QueuedWork; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Configuration; +import android.text.TextUtils; import android.util.Log; import com.android.settingslib.bluetooth.LocalBluetoothAdapter; @@ -62,10 +63,10 @@ final class LocalBluetoothPreferences { } static boolean shouldShowDialogInForeground(Context context, - String deviceAddress) { + String deviceAddress, String deviceName) { LocalBluetoothManager manager = Utils.getLocalBtManager(context); if (manager == null) { - if(DEBUG) Log.v(TAG, "manager == null - do not show dialog."); + if (DEBUG) Log.v(TAG, "manager == null - do not show dialog."); return false; } @@ -115,6 +116,18 @@ final class LocalBluetoothPreferences { } } } + + + if (!TextUtils.isEmpty(deviceName)) { + // If the device is a custom BT keyboard specifically for this device + String packagedKeyboardName = context.getString( + com.android.internal.R.string.config_packagedKeyboardName); + if (deviceName.equals(packagedKeyboardName)) { + if (DEBUG) Log.v(TAG, "showing dialog for packaged keyboard"); + return true; + } + } + if (DEBUG) Log.v(TAG, "Found no reason to show the dialog - do not show dialog."); return false; } |