Merge "Support for running multiple commands in build_android_target.sh."
diff --git a/build/sandbox/build_android_target.sh b/build/sandbox/build_android_target.sh
index fd716cc..266bb71 100755
--- a/build/sandbox/build_android_target.sh
+++ b/build/sandbox/build_android_target.sh
@@ -40,6 +40,16 @@
 
 set -e
 
+BUILD_COMMAND_ARRAY=($BUILD_COMMAND)
+for i in ${BUILD_COMMAND_ARRAY[@]};
+do
+  if [[ $i =~ ^[A-Z_][A-Z0-9_]*= ]];
+  then
+    echo "build_android_target.sh: export $i";
+    export $i;
+  fi;
+done;
+
 echo "build_android_target.sh: source build/envsetup.sh"
 source build/envsetup.sh
 echo "build_android_target.sh: lunch $ANDROID_TARGET"
diff --git a/gki/repack_gki.py b/gki/repack_gki.py
index 38e50fd..3c12c56 100644
--- a/gki/repack_gki.py
+++ b/gki/repack_gki.py
@@ -84,6 +84,7 @@
     copy_kernel_file(kernel_dir, 'System.map')
     copy_kernel_file(kernel_dir, 'abi.xml')
     copy_kernel_file(kernel_dir, 'abi_symbollist')
+    copy_kernel_file(kernel_dir, 'vmlinux')
     copy_kernel_file(kernel_dir, 'Image',
                      'kernel-{}'.format(args.kernel_version))
     copy_kernel_file(kernel_dir, 'Image.lz4',
diff --git a/gki/repack_gki_lib.py b/gki/repack_gki_lib.py
index 6df90d1..289a82c 100644
--- a/gki/repack_gki_lib.py
+++ b/gki/repack_gki_lib.py
@@ -13,7 +13,7 @@
       client=client,
       build_id=build_id,
       target=target,
-      pattern=r'(.*-img-.*\.zip|.*-target_files-.*\.zip|boot-debug-{version}.*\.img|boot-test-harness-{version}.*\.img|otatools.zip)'
+      pattern=r'(gsi_.*-img-.*\.zip|gsi_.*-target_files-.*\.zip|boot-debug-{version}.*\.img|boot-test-harness-{version}.*\.img|otatools.zip)'
       .format(version=kernel_version),
       out_dir=out_dir)
 
@@ -29,7 +29,7 @@
       client=client,
       build_id=build_id,
       target=kernel_target,
-      pattern=r'(Image|Image.lz4|System\.map|abi.xml|abi_symbollist)',
+      pattern=r'(Image|Image.lz4|System\.map|abi.xml|abi_symbollist|vmlinux)',
       out_dir=kernel_dir)
   fetcher_lib.fetch_artifacts(
       client=client,
diff --git a/split/Android.bp b/split/Android.bp
index 331354b..f35167f 100644
--- a/split/Android.bp
+++ b/split/Android.bp
@@ -87,9 +87,6 @@
         "xml_diff.py",
         "xml_diff_test.py",
     ],
-    libs: [
-        "py-mock",
-    ],
     test_config: "test.xml",
     test_suites: ["general-tests"],
 }
diff --git a/split/manifest_split_test.py b/split/manifest_split_test.py
index 546d3c1..73976cc 100644
--- a/split/manifest_split_test.py
+++ b/split/manifest_split_test.py
@@ -14,12 +14,12 @@
 """Test manifest split."""
 
 import json
-import mock
 import os
 import re
 import subprocess
 import tempfile
 import unittest
+import unittest.mock
 import xml.etree.ElementTree as ET
 
 import manifest_split
@@ -167,7 +167,7 @@
                                   'Unknown module path for module target1'):
         manifest_split.ModuleInfo(module_info_file.name, repo_projects)
 
-  @mock.patch.object(subprocess, 'check_output', autospec=True)
+  @unittest.mock.patch.object(subprocess, 'check_output', autospec=True)
   def test_get_ninja_inputs(self, mock_check_output):
     mock_check_output.return_value = b"""
     path/to/input1
@@ -179,7 +179,7 @@
     inputs = manifest_split.get_ninja_inputs('unused', 'unused', ['droid'])
     self.assertEqual(inputs, {'path/to/input1', 'path/to/input2'})
 
-  @mock.patch.object(subprocess, 'check_output', autospec=True)
+  @unittest.mock.patch.object(subprocess, 'check_output', autospec=True)
   def test_get_ninja_inputs_includes_test_mapping(self, mock_check_output):
     mock_check_output.return_value = b"""
     path/to/input1
@@ -192,7 +192,7 @@
     self.assertEqual(
         inputs, {'path/to/input1', 'path/to/input2', 'path/to/TEST_MAPPING'})
 
-  @mock.patch.object(subprocess, 'check_output', autospec=True)
+  @unittest.mock.patch.object(subprocess, 'check_output', autospec=True)
   def test_get_kati_makefiles(self, mock_check_output):
     with tempfile.TemporaryDirectory() as temp_dir:
       os.chdir(temp_dir)
@@ -291,7 +291,7 @@
         ET.tostring(projects[0]).strip().decode(),
         '<project name="platform/project1" path="system/project1" />')
 
-  @mock.patch.object(subprocess, 'check_output', autospec=True)
+  @unittest.mock.patch.object(subprocess, 'check_output', autospec=True)
   def test_create_split_manifest(self, mock_check_output):
     with tempfile.NamedTemporaryFile('w+t') as repo_list_file, \
       tempfile.NamedTemporaryFile('w+t') as manifest_file, \
@@ -444,9 +444,9 @@
         self.assertEqual(debug_data['vendor/project1']['kati_makefiles'][0],
                          product_makefile)
 
-  @mock.patch.object(manifest_split, 'get_ninja_inputs', autospec=True)
-  @mock.patch.object(manifest_split, 'get_kati_makefiles', autospec=True)
-  @mock.patch.object(manifest_split.ModuleInfo, '__init__', autospec=True)
+  @unittest.mock.patch.object(manifest_split, 'get_ninja_inputs', autospec=True)
+  @unittest.mock.patch.object(manifest_split, 'get_kati_makefiles', autospec=True)
+  @unittest.mock.patch.object(manifest_split.ModuleInfo, '__init__', autospec=True)
   def test_create_split_manifest_skip_kati_module_info(self, mock_init,
                                                        mock_get_kati_makefiles,
                                                        mock_get_ninja_inputs):
@@ -483,7 +483,7 @@
     mock_get_kati_makefiles.assert_not_called()
     mock_init.assert_not_called()
 
-  @mock.patch.object(subprocess, 'check_output', autospec=True)
+  @unittest.mock.patch.object(subprocess, 'check_output', autospec=True)
   def test_create_split_manifest_installed_prebuilt(self, mock_check_output):
 
     # The purpose of this test is to verify that create_split_manifests treats