Skip to content

Add null check before using `RemoteKeyboardService.instance.visible`

Summary

Add a null check before using RemoteKeyboardService.instance.visible as it might be null when RemoteKeyboardService.create() was never called before (by OS)

Test Plan

Before:

RemoteKeyboardPlugin did not work probably when starting the App having the default Keyboard Input Method selected. When the RemoteKeyboardPlugin object was created an NullPointerException was thrown.

After:

Adding a null check fixes this bug in an easy but effective way. When the input method was changed and the OS RemoteKeyboardService.create() was called by OS, everything will work as excepted.

Todo

Maybe there should be something like

else
  notifyKeyboardState(false);

but I'm not completely sure what the excepted keyboardState should be (what the default value is).

Merge request reports

Loading