State a fixed order for modifiers in the Shorcuts Helper

The current implementation takes the modifiers as stores in a
SparseArray, indexed by their KeyCode so they are showing up in
KeyCode order on the helper. We want to force order them into
something that makes more sense.

Bug: 29545953
Change-Id: Iad9b8a014075afdf9cf911c6393efde2ef9a7640
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
index 3f8d4ed..e781f1b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyboardShortcuts.java
@@ -85,6 +85,12 @@
     private final SparseArray<String> mModifierNames = new SparseArray<>();
     private final SparseArray<Drawable> mSpecialCharacterDrawables = new SparseArray<>();
     private final SparseArray<Drawable> mModifierDrawables = new SparseArray<>();
+    // Ordered list of modifiers that are supported. All values in this array must exist in
+    // mModifierNames.
+    private final int[] mModifierList = new int[] {
+            KeyEvent.META_META_ON, KeyEvent.META_CTRL_ON, KeyEvent.META_ALT_ON,
+            KeyEvent.META_SHIFT_ON, KeyEvent.META_SYM_ON, KeyEvent.META_FUNCTION_ON
+    };
 
     private final Handler mHandler = new Handler(Looper.getMainLooper());
     private final Context mContext;
@@ -724,8 +730,8 @@
         if (modifiers == 0) {
             return shortcutKeys;
         }
-        for(int i = 0; i < mModifierNames.size(); ++i) {
-            final int supportedModifier = mModifierNames.keyAt(i);
+        for(int i = 0; i < mModifierList.length; ++i) {
+            final int supportedModifier = mModifierList[i];
             if ((modifiers & supportedModifier) != 0) {
                 shortcutKeys.add(new StringDrawableContainer(
                         mModifierNames.get(supportedModifier),