private void addSystemImes(Set<String> excludePackages){
  final Context context=getActivity();
  if (context == null)   return;
  InputMethodManager imm=(InputMethodManager)context.getSystemService(Context.INPUT_METHOD_SERVICE);
  List<InputMethodInfo> imis=imm.getInputMethodList();
  for (  InputMethodInfo imi : imis) {
    try {
      if (imi.isDefault(context) && isSystemPackage(imi.getPackageName())) {
        excludePackages.add(imi.getPackageName());
      }
    }
 catch (    Resources.NotFoundException rnfe) {
    }
  }
}

private void addSystemImes ( Set < String > excludePackages ) { final Context context = getActivity ( ) ; if ( context == null ) return ; InputMethodManager imm = ( InputMethodManager ) context . getSystemService ( Context . INPUT_METHOD_SERVICE ) ; List < InputMethodInfo > imis = imm . getInputMethodList ( ) ; for ( InputMethodInfo imi : imis ) { try { if ( imi . isDefault ( context ) && isSystemPackage ( imi . getPackageName ( ) ) ) { excludePackages . add ( imi . getPackageName ( ) ) ; } } catch ( Resources . NotFoundException rnfe ) { } } }
find all pre - installed input methods that are marked as default and add them to an exclusion list so that they aren ' t presented to the user for toggling . don ' t add non - default ones , as they may include other stuff that we don ' t need to auto - include .
