Merge "drawTextRSXform is deprecated"
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java
index 177ba00..4f18d45 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/BluetoothEventManager.java
@@ -484,6 +484,10 @@
return;
}
final CachedBluetoothDevice activeDevice = mDeviceManager.findDevice(device);
+ if (activeDevice == null) {
+ Log.w(TAG, "AclStateChangedHandler: activeDevice is null");
+ return;
+ }
final int state;
switch (action) {
case BluetoothDevice.ACTION_ACL_CONNECTED:
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothEventManagerTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothEventManagerTest.java
index 0dcdaed..2c70cbb 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothEventManagerTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/bluetooth/BluetoothEventManagerTest.java
@@ -181,4 +181,17 @@
verify(mBluetoothCallback, never()).onAclConnectionStateChanged(mCachedBluetoothDevice,
BluetoothAdapter.STATE_CONNECTED);
}
+
+ @Test
+ public void dispatchAclConnectionStateChanged_findDeviceReturnNull_shouldNotDispatchCallback() {
+ when(mCachedDeviceManager.findDevice(mBluetoothDevice)).thenReturn(null);
+ mBluetoothEventManager.registerCallback(mBluetoothCallback);
+ mIntent = new Intent(BluetoothDevice.ACTION_ACL_CONNECTED);
+ mIntent.putExtra(BluetoothDevice.EXTRA_DEVICE, mBluetoothDevice);
+
+ mContext.sendBroadcast(mIntent);
+
+ verify(mBluetoothCallback, never()).onAclConnectionStateChanged(mCachedBluetoothDevice,
+ BluetoothAdapter.STATE_CONNECTED);
+ }
}
diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
index 8d6cb09..5a7739c 100644
--- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
+++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java
@@ -390,12 +390,11 @@
};
private void restoreNonVrImeFromSettingsNoCheck() {
- mIsVrImeStarted = false;
// switch back to non-VR InputMethod from settings.
synchronized (mMethodMap) {
- final String lastInputId = mSettings.getSelectedInputMethod();
- setInputMethodLocked(lastInputId,
- mSettings.getSelectedInputMethodSubtypeId(lastInputId));
+ if (!mIsVrImeStarted) return;
+ mIsVrImeStarted = false;
+ updateFromSettingsLocked(false);
}
}