Relax options checking for Host APEX in `build/apex/runtests.sh`.

Don't consider passing both `--host` and any `--flavor` option as an
error; only complain when `--host` is used with a Release or Testing
APEX.

Test: art/build/apex/runtests.sh
Bug: 142938159
Bug: 139277987
Change-Id: Ic69290ed92da3b85ee20a2f91f9662386777e708
diff --git a/build/apex/art_apex_test.py b/build/apex/art_apex_test.py
index 3a5dfee..248fab5 100755
--- a/build/apex/art_apex_test.py
+++ b/build/apex/art_apex_test.py
@@ -1063,9 +1063,6 @@
   if test_args.size and not (test_args.list or test_args.tree):
     logging.error("--size set but neither --list nor --tree set")
     return 1
-  if test_args.host and test_args.flavor:
-    logging.error("Both of --host and --flavor set")
-    return 1
   if test_args.host and test_args.testing:
     logging.error("Both of --host and --testing set")
     return 1
@@ -1085,6 +1082,34 @@
     logging.error("Need debugfs.")
     return 1
 
+  # Handle legacy flavor flags.
+  if test_args.debug:
+    logging.warning('Using deprecated option --debug')
+    test_args.flavor = FLAVOR_DEBUG
+  if test_args.testing:
+    logging.warning('Using deprecated option --testing')
+    test_args.flavor = FLAVOR_TESTING
+
+  # Handle new flavor flag.
+  if test_args.flavor == FLAVOR_AUTO:
+    logging.warning('--flavor=auto, trying to autodetect. This may be incorrect!')
+    for flavor in [ FLAVOR_RELEASE, FLAVOR_DEBUG, FLAVOR_TESTING ]:
+      flavor_pattern = '*.%s*' % flavor
+      if fnmatch.fnmatch(test_args.apex, flavor_pattern):
+        test_args.flavor = flavor
+        break
+    if test_args.flavor == FLAVOR_AUTO:
+      logging.error('  Could not detect APEX flavor, neither \'%s\', \'%s\' nor \'%s\' in \'%s\'',
+                  FLAVOR_RELEASE, FLAVOR_DEBUG, FLAVOR_TESTING, test_args.apex)
+      return 1
+
+  if test_args.host and test_args.flavor == FLAVOR_RELEASE:
+    logging.error("Using option --host with Release APEX")
+    return 1
+  if test_args.host and test_args.flavor == FLAVOR_TESTING:
+    logging.error("Using option --host with Testing APEX")
+    return 1
+
   try:
     if test_args.host:
       apex_provider = HostApexProvider(test_args.apex, test_args.tmpdir)
@@ -1104,25 +1129,6 @@
     List(apex_provider, test_args.size).print_list()
     return 0
 
-  # Handle legacy flavor flags.
-  if test_args.debug:
-    logging.warning('Using deprecated option --debug')
-    test_args.flavor = FLAVOR_DEBUG
-  if test_args.testing:
-    logging.warning('Using deprecated option --testing')
-    test_args.flavor = FLAVOR_TESTING
-  if test_args.flavor == FLAVOR_AUTO:
-    logging.warning('--flavor=auto, trying to autodetect. This may be incorrect!')
-    for flavor in [ FLAVOR_RELEASE, FLAVOR_DEBUG, FLAVOR_TESTING ]:
-      flavor_pattern = '*.%s*' % flavor
-      if fnmatch.fnmatch(test_args.apex, flavor_pattern):
-        test_args.flavor = flavor
-        break
-    if test_args.flavor == FLAVOR_AUTO:
-      logging.error('  Could not detect APEX flavor, neither \'%s\', \'%s\' nor \'%s\' in \'%s\'',
-                  FLAVOR_RELEASE, FLAVOR_DEBUG, FLAVOR_TESTING, test_args.apex)
-      return 1
-
   checkers = []
   if test_args.bitness == BITNESS_AUTO:
     logging.warning('--bitness=auto, trying to autodetect. This may be incorrect!')