File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed
services/java/com/android/server Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change 7878import java .io .FileDescriptor ;
7979import java .io .IOException ;
8080import java .io .PrintWriter ;
81+ import java .text .Collator ;
8182import java .util .ArrayList ;
8283import java .util .HashMap ;
8384import java .util .List ;
85+ import java .util .Map ;
86+ import java .util .TreeMap ;
8487
8588/**
8689 * This class provides a system service that manages input methods.
@@ -1513,21 +1516,22 @@ void showInputMethodMenu() {
15131516 hideInputMethodMenuLocked ();
15141517
15151518 int N = immis .size ();
1516-
1517- mItems = new CharSequence [N ];
1518- mIms = new InputMethodInfo [N ];
1519-
1520- int j = 0 ;
1519+
1520+ final Map <CharSequence , InputMethodInfo > imMap =
1521+ new TreeMap <CharSequence , InputMethodInfo >(Collator .getInstance ());
1522+
15211523 for (int i = 0 ; i < N ; ++i ) {
15221524 InputMethodInfo property = immis .get (i );
15231525 if (property == null ) {
15241526 continue ;
15251527 }
1526- mItems [j ] = property .loadLabel (pm );
1527- mIms [j ] = property ;
1528- j ++;
1528+ imMap .put (property .loadLabel (pm ), property );
15291529 }
1530-
1530+
1531+ N = imMap .size ();
1532+ mItems = imMap .keySet ().toArray (new CharSequence [N ]);
1533+ mIms = imMap .values ().toArray (new InputMethodInfo [N ]);
1534+
15311535 int checkedItem = 0 ;
15321536 for (int i = 0 ; i < N ; ++i ) {
15331537 if (mIms [i ].getId ().equals (lastInputMethodId )) {
You can’t perform that action at this time.
0 commit comments