Stop lying about hardware keyboard presence.

Here is a brief history of "Use Physical Keyboard", or "Show input
method", or SHOW_IME_WITH_HARD_KEYBOARD.

In Honeycomb, we introduced a mechanism which allows users to temporary
disconnect the physical keyboard connection from a UI [1].  That state
was temporary and non-persistent, but it was implemented to have
system-wide effect.  Whenever the user turned on that temporarily
disconnected state, not only IMEs but also other processes would be
notified that Configuration#keyboard was changed to KEYBOARD_NOKEYS.
The UI to do that was available only in tablet UI at that point and
nothing changed in phones.

In JellyBean, we decided to port that UI to phone, and the "Use Physical
Keyboard" toggle switch found its new home on the IME switcher
dialog [2].

In Lollipop, we revised the wording for the toggle switch on the IME
switcher dialog.  Now it's labeled as "Show input method" [3].

In Lollipop, we also decided to make the settings of "Show input method"
to be persistent as @hide entry in the secure settings [4].

  [1] 2992ea782fa61780d8e0de7a36a2a84622f8694b
      I136087ca4f726d0068d5983d7d3686787ba60c55
  [2] cb598b11ea2c012bd15e7e7f44a3006f752c0b81
      (Ica768083f95c33dc1e494a28ba7d8b6eb989b0ef)
  [3] be11f3a5cea67c68a08c8da9ce85b3418501060a
      (I9c8a7eb98b5277f1d09cc19fa7402e9b4cf51d92)
  [4] b64e56aad3ffb267aec44308f57641a4c91caa83
      (I2237ded850a0d4ab43ca441d0b7df13e0958e630)

Now, we have hard time making everyone happy.  Having an easy way to
bring software keyboard back is probably still a valid use case, but
after several wording changes it is no longer obvious why
onConfigurationChanged() event is sent to all the processes as a
consequence of tapping that toggle.

In order to address above confusions, this CL removes the concept of
"temporarily disconnected physical keyboard" but tries to implement
"Show input method" functionality in InputMethodManagerService and
InputMethodService to keep the affordance that has been offered in the
IME switcher dialog.  As long as the IME overrides
InputMethodService#onEvaluateInputViewShown() as follows, the behavior
of "Show input method" toggle remains the same except for processes
including IMEs no longer receive onConfigurationChanged() event with
faked Configuration#keyboard value.

  @Override
  public boolean onEvaluateInputViewShown() {
      // If the default implementation returns true, recommend honoring
      // it.
      if (super.onEvaluateInputViewShown()) {
          return true;
      }

      // Implement the logic that is specific to your IME here.
      return myOnEvaluateInputViewShown();
  }

Bug: 22517687
Change-Id: Id4d332e3909590c68345e10e1f2e18650efb2eb7
2 files changed