Fix for bug #34905789

A call to showInputMethodPickerFromClient should be allowed only if the
caller is:
  * The system service, as system services should have the privilege to
    show any dialogs
  * The current IME client, as it was already enabled by the user
  * The app on the foreground, as the user cannot distinguish the source
    of the request (i.e., foreground vs background app) and might be
    mislead by a background app to change settings
  * A process with the android.Manifest.permission.WRITE_SECURE_SETTINGS
    permission, as it already has the permission to change settings

Fixes: 34905789
Test: manual
Change-Id: I4f0fc21268200c64d12b31ca54416acfbf62f37b
1 file changed