Ensure an already-running AVD's language/locale settings are correct

Currently, when requesting that Appium launch an AVD with a specified language and/or locale  (desired capabilities: 'avd' plus one or more of 'language', 'locale'), if the AVD is already running then the language/locale settings are ignored.

This patch refactors the logic that applies the language/locale settings such that the settings are applied in all cases. Further, it only applies the settings if they are non-null AND they differ from the device's current settings (thus potentially eliminating some pointless reboots).

Full disclosure: I do not have prior Node or JavaScript experience. This patch works for me and passes the existing unit tests, but should probably be checked thoroughly.