Factor out runtime broadcast receivers in IMMS

This is a follow up CL to my previous CL, which made
ACTION_CLOSE_SYSTEM_DIALOGS handler multi-user-aware.

This CL does not change any logic, but just factor out the code by
extracting out logic into a dedicated inner class.

This is a mechanical refactoring. There should be no behavior change.

 [1]: Id71e6f8122be05e27545fa9d6b95a0b6156d202c
      4225c7d77587ac4f1066fba179e85ae7a4e6b727

Bug: 127810562
Test: Manually verified as follows.
   1. Build aosp_blueline-userdebug and flash it.
   2. adb shell pm create-user test_user
   3. adb shell am switch-user 10
   4. adb shell wm dismiss-keyguard
   5. atest android.view.inputmethod.cts.InputMethodManagerTest#testShowInputMethodPicker
Test: Manually verified as follows.
   1. Build aosp_blueline-userdebug and flash it.
   2. adb shell pm create-user test_user
   3. adb shell am switch-user 10
   4. adb shell wm dismiss-keyguard
   5. make -j SoftKeyboard
   6. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
   7. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
   8. Tap the search field of the launcher.
   9. Make sure AOSP Keyboard is shown.
  10. Tap the IME switcher icon on the navigation bar.
  11. Make sure IME switcher dialog is shown.
  12. adb shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --user 0
  13. Make sure that the IME switcher dialog is not dismissed.
  14. adb shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --user 10
  15. Make sure that the IME switcher dialog is dismissed.
  16. Tap the IME switcher icon on the navigation bar again.
  17. Make sure IME switcher dialog is shown.
  18. adb shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --user all
  19. Make sure that the IME switcher dialog is dismissed.
  20. Tap the IME switcher icon on the navigation bar again.
  21. Make sure IME switcher dialog is shown.
  22. adb shell am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --user current
  23. Make sure that the IME switcher dialog is dismissed.
Change-Id: Iba57f62b826703d37afc676f8659e65b428b3915
1 file changed