Minor changes to validateAction().

- Make error message more accurate.
- Change action validation to be inline instead of relying on for loop.

Bug: 7122054
Change-Id: I4d9e3e2a18659bbe5ccc0e355d1e7d97f5d38e0f
diff --git a/src/com/android/contacts/editor/ContactEditorFragment.java b/src/com/android/contacts/editor/ContactEditorFragment.java
index e29e488..028c01f 100644
--- a/src/com/android/contacts/editor/ContactEditorFragment.java
+++ b/src/com/android/contacts/editor/ContactEditorFragment.java
@@ -118,9 +118,6 @@
     private static final String KEY_IS_USER_PROFILE = "isUserProfile";
     private static final String KEY_UPDATED_PHOTOS = "updatedPhotos";
 
-    private static final String[] VALID_ACTIONS = {Intent.ACTION_EDIT, Intent.ACTION_INSERT,
-            ContactEditorActivity.ACTION_SAVE_COMPLETED};
-
     public static final String SAVE_MODE_EXTRA_KEY = "saveMode";
 
 
@@ -405,13 +402,13 @@
      * @throws IllegalArgumentException when the action is invalid.
      */
     private void validateAction(String action) {
-        for (String validAction : VALID_ACTIONS) {
-            if (validAction.equals(action)) {
-                return;
-            }
+        if (Intent.ACTION_EDIT.equals(action) || Intent.ACTION_INSERT.equals(action) ||
+                ContactEditorActivity.ACTION_SAVE_COMPLETED.equals(action)) {
+            return;
         }
         throw new IllegalArgumentException("Unknown Action String " + mAction +
-                ". Only support " + Intent.ACTION_EDIT + " or " + Intent.ACTION_INSERT);
+                ". Only support " + Intent.ACTION_EDIT + " or " + Intent.ACTION_INSERT + " or " +
+                ContactEditorActivity.ACTION_SAVE_COMPLETED);
     }
 
     @Override