Fix bug in processing escaped quotation marks to be passed to subprocess

This is the same fix as in ag/1749155
This change converts literal \" that exists in values of
tf-command-line to ", so that they can be processed by tokenizer
correctly as passed down to sub process as a single argv in
the case where a whitespace is needed in the value of the
original TF command line params.

Bug: 35936461
Test: unittest and local test
tradefed.sh run host -n --class com.android.tradefed.util.StringEscapeUtilsTest
tradefed.sh run host -n --class \
  com.android.tradefed.testtype.VersionedTfLauncherTest

test-tag is set to be an escaped string. If parsed incorrectly, it will fail
TF with Invalid arguments error in subprocess.
tradefed.sh run  google/template/lab-base-versioned \
  --config-name google/template/lab-base --tf-command-line \
  "--template:map test=tf/fake --run \"test.class=P\" \
  --test-tag \\\"FakeTest --badargs\\\" \
  --branch git_master --build-flavor angler-userdebug \
  --build-os linux --build-id 3764429" --branch git_master \
   --build-flavor test_suites_x86_64 --build-os fastbuild3d_linux \
  --build-id 3764429 --log-level-display VERBOSE \
  --test-tag FakeTest

Change-Id: I656c894416566b2b113700e45a1606fdda0d33cb
4 files changed