Merge "Guard against null input device in StylusDeviceUpdater" into udc-dev am: e78b1f377e
am: e686a77ec9
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/22894945 Change-Id: Ia3ead3945813be4aca3e91e83f853fa35138c800 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -100,6 +100,8 @@ public class StylusDeviceUpdater implements InputManager.InputDeviceListener,
|
||||
@Override
|
||||
public void onInputDeviceAdded(int deviceId) {
|
||||
InputDevice inputDevice = mInputManager.getInputDevice(deviceId);
|
||||
if (inputDevice == null) return;
|
||||
|
||||
if (inputDevice.supportsSource(InputDevice.SOURCE_STYLUS)
|
||||
&& !inputDevice.isExternal()) {
|
||||
try {
|
||||
@@ -121,7 +123,10 @@ public class StylusDeviceUpdater implements InputManager.InputDeviceListener,
|
||||
|
||||
@Override
|
||||
public void onInputDeviceChanged(int deviceId) {
|
||||
if (mInputManager.getInputDevice(deviceId).supportsSource(InputDevice.SOURCE_STYLUS)) {
|
||||
InputDevice inputDevice = mInputManager.getInputDevice(deviceId);
|
||||
if (inputDevice == null) return;
|
||||
|
||||
if (inputDevice.supportsSource(InputDevice.SOURCE_STYLUS)) {
|
||||
forceUpdate();
|
||||
}
|
||||
}
|
||||
@@ -189,6 +194,8 @@ public class StylusDeviceUpdater implements InputManager.InputDeviceListener,
|
||||
boolean hasConnectedBluetoothStylusDevice() {
|
||||
for (int deviceId : mInputManager.getInputDeviceIds()) {
|
||||
InputDevice device = mInputManager.getInputDevice(deviceId);
|
||||
if (device == null) continue;
|
||||
|
||||
if (device.supportsSource(InputDevice.SOURCE_STYLUS)
|
||||
&& mInputManager.getInputDeviceBluetoothAddress(deviceId) != null) {
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user