Be consistent with android log tags between target/host.

Test: test.py
Change-Id: I0f8a1a896fda5552fb85ad5e615eeee88a0a5ec0
diff --git a/test/etc/run-test-jar b/test/etc/run-test-jar
index b8427f4..bcb15cd 100755
--- a/test/etc/run-test-jar
+++ b/test/etc/run-test-jar
@@ -812,6 +812,25 @@
 fi
 RUN_TEST_ASAN_OPTIONS="${RUN_TEST_ASAN_OPTIONS}detect_leaks=0"
 
+# For running, we must turn off logging when dex2oat or patchoat are missing. Otherwise we use
+# the same defaults as for prebuilt: everything when --dev, otherwise errors and above only.
+if [ "$EXTERNAL_LOG_TAGS" = "n" ]; then
+  if [ "$DEV_MODE" = "y" ]; then
+      export ANDROID_LOG_TAGS='*:d'
+  elif [ "$USE_DEX2OAT_AND_PATCHOAT" = "n" ]; then
+      # All tests would log the error of failing dex2oat/patchoat. Be silent here and only
+      # log fatal events.
+      export ANDROID_LOG_TAGS='*:s'
+  elif [ "$HAVE_IMAGE" = "n" ]; then
+      # All tests would log the error of missing image. Be silent here and only log fatal
+      # events.
+      export ANDROID_LOG_TAGS='*:s'
+  else
+      # We are interested in LOG(ERROR) output.
+      export ANDROID_LOG_TAGS='*:e'
+  fi
+fi
+
 if [ "$HOST" = "n" ]; then
     adb root > /dev/null
     adb wait-for-device
@@ -862,6 +881,7 @@
              export ANDROID_ADDITIONAL_PUBLIC_LIBRARIES=$PUBLIC_LIBS && \
              export DEX_LOCATION=$DEX_LOCATION && \
              export ANDROID_ROOT=$ANDROID_ROOT && \
+             export ANDROID_LOG_TAGS=$ANDROID_LOG_TAGS && \
              rm -rf ${DEX_LOCATION}/dalvik-cache/ && \
              mkdir -p ${mkdir_locations} && \
              export LD_LIBRARY_PATH=$LD_LIBRARY_PATH && \
@@ -899,16 +919,6 @@
     # Host run.
     export ANDROID_PRINTF_LOG=brief
 
-    # By default, and for prebuild dex2oat, we are interested in errors being logged. In dev mode
-    # we want debug messages.
-    if [ "$EXTERNAL_LOG_TAGS" = "n" ]; then
-      if [ "$DEV_MODE" = "y" ]; then
-          export ANDROID_LOG_TAGS='*:d'
-      else
-          export ANDROID_LOG_TAGS='*:e'
-      fi
-    fi
-
     export ANDROID_DATA="$DEX_LOCATION"
     export ANDROID_ROOT="${ANDROID_ROOT}"
     export LD_LIBRARY_PATH="${ANDROID_ROOT}/${LIBRARY_DIRECTORY}:${ANDROID_ROOT}/${TEST_DIRECTORY}"
@@ -969,25 +979,6 @@
     $strip_cmdline || { echo "Strip failed." >&2 ; exit 3; }
     $sync_cmdline || { echo "Sync failed." >&2 ; exit 4; }
 
-    # For running, we must turn off logging when dex2oat or patchoat are missing. Otherwise we use
-    # the same defaults as for prebuilt: everything when --dev, otherwise errors and above only.
-    if [ "$EXTERNAL_LOG_TAGS" = "n" ]; then
-      if [ "$DEV_MODE" = "y" ]; then
-          export ANDROID_LOG_TAGS='*:d'
-      elif [ "$USE_DEX2OAT_AND_PATCHOAT" = "n" ]; then
-          # All tests would log the error of failing dex2oat/patchoat. Be silent here and only
-          # log fatal events.
-          export ANDROID_LOG_TAGS='*:s'
-      elif [ "$HAVE_IMAGE" = "n" ]; then
-          # All tests would log the error of missing image. Be silent here and only log fatal
-          # events.
-          export ANDROID_LOG_TAGS='*:s'
-      else
-          # We are interested in LOG(ERROR) output.
-          export ANDROID_LOG_TAGS='*:e'
-      fi
-    fi
-
     if [ "$DRY_RUN" = "y" ]; then
       exit 0
     fi