Enable TARGET_BUILD_UNBUNDLED in master-art (reland).

This is the way to disable assumptions in the build system that a full
system image is to be built.

Soong internally checks for the absence of frameworks/base to detect a
reduced master-art tree and disable some dependencies. That check is at
odds with TARGET_BUILD_UNBUNDLED=true, so for now let's enable
TARGET_BUILD_UNBUNDLED only on the same condition.

This relands https://r.android.com/1337182 with changes in two
testrunner scripts that were missed.

Test: art/tools/buildbot-build.sh --host
  on AOSP master and master-art
Test: art/tools/buildbot-build.sh --target
  on AOSP master and master-art
Test: m installclean && art/build/apex/runtests.sh
  on AOSP master and master-art
Test: rm -rf out && \
      art/test/testrunner/run_build_test_target.py art-linux-bionic-x64
  on AOSP master and master-art
Test: art/test/testrunner/run_build_test_target.py art-test
  on AOSP master and master-art
Test: art/test/testrunner/testrunner.py --target --64 --optimizing && \
      art/tools/run-gtests.sh
  in test chroot on device
  on AOSP master and master-art
Test: art/tools/golem/build-target.sh \
      --machine-type=android-armv8 --golem=art-jit
  on AOSP master and master-art
Bug: 159109002
Bug: 157549171
Change-Id: Ie98af1098ea1132d3db7ed0a8bf47b54e0848e57
diff --git a/test/testrunner/run_build_test_target.py b/test/testrunner/run_build_test_target.py
index 19f03c3..b9e0253 100755
--- a/test/testrunner/run_build_test_target.py
+++ b/test/testrunner/run_build_test_target.py
@@ -60,6 +60,10 @@
 n_threads = options.n_threads
 custom_env = target.get('env', {})
 custom_env['SOONG_ALLOW_MISSING_DEPENDENCIES'] = 'true'
+# Switch the build system to unbundled mode in the reduced manifest branch.
+# TODO(b/159109002): Clean this up.
+if not os.path.isdir(env.ANDROID_BUILD_TOP + '/frameworks/base'):
+  custom_env['TARGET_BUILD_UNBUNDLED'] = 'true'
 print(custom_env)
 os.environ.update(custom_env)