Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f0c721f authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Introduce IInputMethodManagerGlobal

In reality methods defined in IInputMethodManager are no more or less
than a set of global methods, because you can write the following
logic anywhere.

  var service = IInputMethodManager.Stub.asInterface(
          ServiceManager.getService(Context.INPUT_METHOD_SERVICE));
  if (service != null) {
      try {
          service.doSomething();
      } catch (RemoteException e) {
          e.rethrowFromSystemServer();
      }
  }

With above observation, this CL introduces IInputMethodManagerGlobal
as a collection of static methods that invoke methods defined in
IInputMethodManager so that other framework classes do not need to
write the same piece of code.

  public final class IInputMethodManagerGlobal {

      public static void doSomething() {
          final var service = getService();
          if (service != null) {
              try {
                  service.doSomething();
              } catch (RemoteException e) {
                  e.rethrowFromSystemServer();
              }
          }
      }

      ......

  }

This CL then simplifies ImeTracing to demonstrate how
IInputMethodManagerGlobal can be used.

Basically this is a mechanical refactoring.  There should be no
observable behavior change.

Bug: 234882948
Test: presubmit
Change-Id: I5412eb1d44e3d515ca955f00a2e777b659a15b14
parent e16dbabf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment