summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-29 22:43:02 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-29 22:43:02 +0000
commitb5e76847106cfb4ce5ccdc12ff513e96e733eebc (patch)
treee244718b906c98e60bd5851606bbcd672364297b
parent8ebd6c84714e7e1fcc31110384e181d1dbf22b9a (diff)
parente49af1c773e512c65d1356887b33e1991053b923 (diff)
downloaddevelopment-b5e76847106cfb4ce5ccdc12ff513e96e733eebc.tar.gz
Snap for 8518779 from e49af1c773e512c65d1356887b33e1991053b923 to ndk-r25-releasendk-r25-beta4
Change-Id: I9d3d3b90fb2f05723ba12c4730fbe54c9b5dfdfa
-rw-r--r--build/sdk-android-arm64-v8a.atree24
-rw-r--r--build/sdk-android-armeabi-v7a.atree27
-rw-r--r--build/sdk-android-armeabi.atree24
-rw-r--r--build/sdk-android-x86.atree24
-rw-r--r--build/sdk-android-x86_64.atree24
-rw-r--r--build/sdk.atree16
-rw-r--r--build/tools/sdk_repo.mk3
-rwxr-xr-xgsi/build_with_kernel/repack_kernels_common.sh16
-rw-r--r--python-packages/OWNERS1
-rwxr-xr-xscripts/acov-llvm.py2
-rwxr-xr-xscripts/gdbclient.py20
-rwxr-xr-xscripts/update_crate_tests.py24
-rwxr-xr-xtools/winscope/adb_proxy/winscope_proxy.py441
-rw-r--r--vendor_snapshot/update.py28
-rw-r--r--vndk/tools/header-checker/android/envsetup.sh4
15 files changed, 150 insertions, 528 deletions
diff --git a/build/sdk-android-arm64-v8a.atree b/build/sdk-android-arm64-v8a.atree
deleted file mode 100644
index feaca42f6..000000000
--- a/build/sdk-android-arm64-v8a.atree
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-kernel/prebuilts/5.10/arm64/kernel-5.10-gz system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-ranchu
-device/generic/goldfish/data/etc/encryptionkey.img system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/encryptionkey.img
-
-# version files for the SDK updater, from development.git
-${HOST_OUT}/development/sys-img-${TARGET_CPU_ABI}/images_arm64-v8a_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties
-
-# feature control config file
-device/generic/goldfish/data/etc/advancedFeatures.ini.arm system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/advancedFeatures.ini
diff --git a/build/sdk-android-armeabi-v7a.atree b/build/sdk-android-armeabi-v7a.atree
deleted file mode 100644
index 2e20dcd9e..000000000
--- a/build/sdk-android-armeabi-v7a.atree
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# Copy the ARMv7 specific kernel image to .../kernel-qemu
-prebuilts/qemu-kernel/arm64/4.4/kernel-qemu2 system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-ranchu-64
-
-# version files for the SDK updater, from development.git
-${HOST_OUT}/development/sys-img-${TARGET_CPU_ABI}/images_armeabi-v7a_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties
-
-# custom hardware.ini for 32 bit images
-development/sys-img/images_armeabi-v7a_hardware.ini system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/hardware.ini
-
-# feature control config file
-device/generic/goldfish/data/etc/advancedFeatures.ini.arm system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/advancedFeatures.ini
diff --git a/build/sdk-android-armeabi.atree b/build/sdk-android-armeabi.atree
deleted file mode 100644
index 8ea6e7e6b..000000000
--- a/build/sdk-android-armeabi.atree
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-prebuilts/qemu-kernel/${TARGET_ARCH}/kernel-qemu system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-qemu
-prebuilts/qemu-kernel/arm64/4.4/kernel-qemu2 system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-ranchu-64
-
-# version files for the SDK updater, from development.git
-${HOST_OUT}/development/sys-img-${TARGET_CPU_ABI}/images_armeabi_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties
-
-# feature control config file
-device/generic/goldfish/data/etc/advancedFeatures.ini.arm system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/advancedFeatures.ini
diff --git a/build/sdk-android-x86.atree b/build/sdk-android-x86.atree
deleted file mode 100644
index 02b82fec1..000000000
--- a/build/sdk-android-x86.atree
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-kernel/prebuilts/5.10/x86_64/kernel-5.10 system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-ranchu-64
-device/generic/goldfish/data/etc/encryptionkey.img system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/encryptionkey.img
-
-# version files for the SDK updater, from development.git
-${HOST_OUT}/development/sys-img-${TARGET_CPU_ABI}/images_${TARGET_ARCH}_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties
-
-# feature control config file
-device/generic/goldfish/data/etc/advancedFeatures.ini system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/advancedFeatures.ini
diff --git a/build/sdk-android-x86_64.atree b/build/sdk-android-x86_64.atree
deleted file mode 100644
index 7672c0079..000000000
--- a/build/sdk-android-x86_64.atree
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-kernel/prebuilts/5.10/x86_64/kernel-5.10 system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/kernel-ranchu
-device/generic/goldfish/data/etc/encryptionkey.img system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/encryptionkey.img
-
-# version files for the SDK updater, from development.git
-${HOST_OUT}/development/sys-img-${TARGET_CPU_ABI}/images_${TARGET_ARCH}_source.properties system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/source.properties
-
-# feature control config file
-device/generic/goldfish/data/etc/advancedFeatures.ini system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/advancedFeatures.ini
diff --git a/build/sdk.atree b/build/sdk.atree
index cc160f22b..b23b76751 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -113,22 +113,6 @@ development/sdk/sdk_files_NOTICE.txt platforms/${PLATFORM_NAME}/skins/NOTIC
##############################################################################
-# System image Component
-##############################################################################
-
-# System images + Kernel
-system-qemu.img system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/system.img
-vendor-qemu.img system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/vendor.img
-ramdisk-qemu.img system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/ramdisk.img
-device/generic/goldfish/data/etc/userdata.img system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/userdata.img
-data/misc system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/data/misc
-system/build.prop system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/build.prop
-VerifiedBootParams.textproto system-images/${PLATFORM_NAME}/${TARGET_CPU_ABI}/VerifiedBootParams.textproto
-
-# Note: the kernel image is handled by sdk-android-<abi>.atree now.
-
-
-##############################################################################
# Docs Component
##############################################################################
diff --git a/build/tools/sdk_repo.mk b/build/tools/sdk_repo.mk
index 6cd3b3daa..c40dc085b 100644
--- a/build/tools/sdk_repo.mk
+++ b/build/tools/sdk_repo.mk
@@ -127,9 +127,6 @@ endef
ifneq ($(filter sdk,$(MAKECMDGOALS)),)
-# Similarly capture all sys-img.xml that are now split out of repository.xml
-$(eval $(call mk-sdk-repo-pkg-3,SDK_SYSIMG_XML_ARGS,$(HOST_OS),$(MAIN_SDK_ZIP),system-images,system-images/*))
-
SDK_SYSIMG_DEPS += \
$(call sdk-repo-pkg-zip,$(HOST_OS),$(MAIN_SDK_ZIP),system-images) \
diff --git a/gsi/build_with_kernel/repack_kernels_common.sh b/gsi/build_with_kernel/repack_kernels_common.sh
index fe750aca1..401553854 100755
--- a/gsi/build_with_kernel/repack_kernels_common.sh
+++ b/gsi/build_with_kernel/repack_kernels_common.sh
@@ -78,12 +78,16 @@ function prepare_kernel_image()
mkdir -p "${dist_root}"
# Prepare prebuilt-info.txt
- BID=$(cat "${prebuilts_root}/BUILD_INFO" | sed -n 's/^.*"bid":\s*"\(.*\)".*$/\1/p')
- cat > "${dist_root}/prebuilt-info.txt" <<EOF
-{
- "kernel-build-id": ${BID}
-}
-EOF
+# BID=$(cat "${prebuilts_root}/BUILD_INFO" | sed -n 's/^.*"bid":\s*"\(.*\)".*$/\1/p')
+# cat > "${dist_root}/prebuilt-info.txt" <<EOF
+#{
+# "kernel-build-id": ${BID}
+#}
+#EOF
+ printf "generate ${dist_root}/prebuilt-info.txt with kernel\n"
+ cksum "${out_root}/kernel-${kernel_version}${postfix}"
+ strings "${out_root}/kernel-${kernel_version}${postfix}" |grep -E "Linux version [0-9]\." | sed -e 's/Linux version.*-ab//'| cut -f1 -d ' ' > "${dist_root}/prebuilt-info.txt"
+
}
#
diff --git a/python-packages/OWNERS b/python-packages/OWNERS
index fa1c5c8c8..14a30711c 100644
--- a/python-packages/OWNERS
+++ b/python-packages/OWNERS
@@ -1,4 +1,3 @@
danalbert@google.com
enh@google.com
-jmgao@google.com
rprichard@google.com
diff --git a/scripts/acov-llvm.py b/scripts/acov-llvm.py
index 941abb54d..a6f35e34a 100755
--- a/scripts/acov-llvm.py
+++ b/scripts/acov-llvm.py
@@ -33,7 +33,7 @@
# $ acov-llvm.py flush
#
# 4. Pull coverage from device and generate coverage report
-# $ acov-llvm.py report -s <one-or-more-source-paths-in-$ANDROID_BUILD_TOP \
+# $ acov-llvm.py report -s <one-or-more-source-paths-in-$ANDROID_BUILD_TOP> \
# -b <one-or-more-binaries-in-$OUT> \
# E.g.:
# acov-llvm.py report \
diff --git a/scripts/gdbclient.py b/scripts/gdbclient.py
index 539e6d0d5..83c948afd 100755
--- a/scripts/gdbclient.py
+++ b/scripts/gdbclient.py
@@ -242,7 +242,7 @@ def handle_switches(args, sysroot):
return (binary_file, pid, run_cmd)
-def generate_vscode_lldb_script(root, sysroot, binary_name, port, solib_search_path):
+def generate_vscode_lldb_script(root, sysroot, binary_name, host, port, solib_search_path):
# TODO It would be nice if we didn't need to copy this or run the
# lldbclient.py program manually. Doing this would probably require
# writing a vscode extension or modifying an existing one.
@@ -258,11 +258,11 @@ def generate_vscode_lldb_script(root, sysroot, binary_name, port, solib_search_p
"initCommands": ['settings append target.exec-search-paths {}'.format(' '.join(solib_search_path))],
"targetCreateCommands": ["target create {}".format(binary_name),
"target modules search-paths add / {}/".format(sysroot)],
- "processCreateCommands": ["gdb-remote {}".format(port)]
+ "processCreateCommands": ["gdb-remote {}:{}".format(host, port)]
}
return json.dumps(res, indent=4)
-def generate_lldb_script(root, sysroot, binary_name, port, solib_search_path):
+def generate_lldb_script(root, sysroot, binary_name, host, port, solib_search_path):
commands = []
commands.append(
'settings append target.exec-search-paths {}'.format(' '.join(solib_search_path)))
@@ -272,11 +272,11 @@ def generate_lldb_script(root, sysroot, binary_name, port, solib_search_path):
commands.append("settings append target.source-map '/b/f/w' '{}'".format(root))
commands.append("settings append target.source-map '' '{}'".format(root))
commands.append('target modules search-paths add / {}/'.format(sysroot))
- commands.append('gdb-remote {}'.format(port))
+ commands.append('gdb-remote {}:{}'.format(host, port))
return '\n'.join(commands)
-def generate_setup_script(debugger_path, sysroot, linker_search_dir, binary_file, is64bit, port, debugger, connect_timeout=5):
+def generate_setup_script(debugger_path, sysroot, linker_search_dir, binary_file, is64bit, host, port, debugger, connect_timeout=5):
# Generate a setup script.
root = os.environ["ANDROID_BUILD_TOP"]
symbols_dir = os.path.join(sysroot, "system", "lib64" if is64bit else "lib")
@@ -292,10 +292,10 @@ def generate_setup_script(debugger_path, sysroot, linker_search_dir, binary_file
if debugger == "vscode-lldb":
return generate_vscode_lldb_script(
- root, sysroot, binary_file.name, port, solib_search_path)
+ root, sysroot, binary_file.name, host, port, solib_search_path)
elif debugger == 'lldb':
return generate_lldb_script(
- root, sysroot, binary_file.name, port, solib_search_path)
+ root, sysroot, binary_file.name, host, port, solib_search_path)
else:
raise Exception("Unknown debugger type " + debugger)
@@ -314,6 +314,11 @@ def do_main():
if device is None:
sys.exit("ERROR: Failed to find device.")
+ if ":" in device.serial:
+ host = device.serial.split(":")[0]
+ else:
+ host = "localhost"
+
root = os.environ["ANDROID_BUILD_TOP"]
sysroot = os.path.join(os.environ["ANDROID_PRODUCT_OUT"], "symbols")
@@ -379,6 +384,7 @@ def do_main():
linker_search_dir=linker_search_dir,
binary_file=binary_file,
is64bit=is64bit,
+ host=host,
port=args.port,
debugger=debugger)
diff --git a/scripts/update_crate_tests.py b/scripts/update_crate_tests.py
index 8a45dd389..1795de22d 100755
--- a/scripts/update_crate_tests.py
+++ b/scripts/update_crate_tests.py
@@ -25,6 +25,15 @@ argument is provided, it assumes the crate is the current directory.
$ update_crate_tests.py $ANDROID_BUILD_TOP/external/rust/crates/libc
This script is automatically called by external_updater.
+
+A test_mapping_config.json file can be defined in the project directory to
+configure the generated TEST_MAPPING file, for example:
+
+ {
+ // Run tests in postsubmit instead of presubmit.
+ "postsubmit_tests":["foo"]
+ }
+
"""
import argparse
@@ -49,7 +58,8 @@ TEST_OPTIONS = {
# "presubmit-rust" runs arm64 device tests on physical devices.
TEST_GROUPS = [
"presubmit",
- "presubmit-rust"
+ "presubmit-rust",
+ "postsubmit",
]
# Excluded tests. These tests will be ignored by this script.
@@ -269,16 +279,27 @@ class TestMapping(object):
def tests_dirs_to_mapping(self, tests, dirs):
"""Translate the test list into a dictionary."""
test_mapping = {"imports": []}
+ config = None
+ if os.path.isfile(os.path.join(self.package.dir, "test_mapping_config.json")):
+ with open(os.path.join(self.package.dir, "test_mapping_config.json"), 'r') as fd:
+ config = json.load(fd)
+
for test_group in TEST_GROUPS:
test_mapping[test_group] = []
for test in tests:
if test in TEST_EXCLUDE:
continue
+ if config and 'postsubmit_tests' in config:
+ if test in config['postsubmit_tests'] and 'postsubmit' not in test_group:
+ continue
+ if test not in config['postsubmit_tests'] and 'postsubmit' in test_group:
+ continue
if test in TEST_OPTIONS:
test_mapping[test_group].append({"name": test, "options": TEST_OPTIONS[test]})
else:
test_mapping[test_group].append({"name": test})
test_mapping[test_group] = sorted(test_mapping[test_group], key=lambda t: t["name"])
+
for dir in dirs:
test_mapping["imports"].append({"path": dir})
test_mapping["imports"] = sorted(test_mapping["imports"], key=lambda t: t["path"])
@@ -331,6 +352,7 @@ def main():
subprocess.check_output(['repo', 'start',
'tmp_auto_test_mapping', '.'])
subprocess.check_output(['git', 'add', 'TEST_MAPPING'])
+ subprocess.check_output(['git', 'add', 'test_mapping_config.json'])
subprocess.check_output(['git', 'commit', '-m',
'Update TEST_MAPPING\n\nTest: None'])
if args.push_change and (changed or untracked):
diff --git a/tools/winscope/adb_proxy/winscope_proxy.py b/tools/winscope/adb_proxy/winscope_proxy.py
index 344c3cc5b..85089c55b 100755
--- a/tools/winscope/adb_proxy/winscope_proxy.py
+++ b/tools/winscope/adb_proxy/winscope_proxy.py
@@ -42,12 +42,12 @@ import base64
# CONFIG #
-LOG_LEVEL = logging.WARNING
+LOG_LEVEL = logging.DEBUG
PORT = 5544
# Keep in sync with WINSCOPE_PROXY_VERSION in Winscope DataAdb.vue
-VERSION = '0.8'
+VERSION = '0.5'
WINSCOPE_VERSION_HEADER = "Winscope-Proxy-Version"
WINSCOPE_TOKEN_HEADER = "Winscope-Token"
@@ -55,14 +55,6 @@ WINSCOPE_TOKEN_HEADER = "Winscope-Token"
# Location to save the proxy security token
WINSCOPE_TOKEN_LOCATION = os.path.expanduser('~/.config/winscope/.token')
-# Winscope traces extensions
-WINSCOPE_EXT = ".winscope"
-WINSCOPE_EXT_LEGACY = ".pb"
-WINSCOPE_EXTS = [WINSCOPE_EXT, WINSCOPE_EXT_LEGACY]
-
-# Winscope traces directory
-WINSCOPE_DIR = "/data/misc/wmtrace/"
-
# Max interval between the client keep-alive requests in seconds
KEEP_ALIVE_INTERVAL_S = 5
@@ -71,203 +63,50 @@ logging.basicConfig(stream=sys.stderr, level=LOG_LEVEL,
log = logging.getLogger("ADBProxy")
-class File:
- def __init__(self, file, filetype) -> None:
- self.file = file
- self.type = filetype
-
- def get_filepaths(self, device_id):
- return [self.file]
-
- def get_filetype(self):
- return self.type
-
-
-class FileMatcher:
- def __init__(self, path, matcher, filetype) -> None:
- self.path = path
- self.matcher = matcher
- self.type = filetype
-
- def get_filepaths(self, device_id):
- matchingFiles = call_adb(
- f"shell su root find {self.path} -name {self.matcher}", device_id)
-
- log.debug("Found file %s", matchingFiles.split('\n')[:-1])
- return matchingFiles.split('\n')[:-1]
-
- def get_filetype(self):
- return self.type
-
-
-class WinscopeFileMatcher(FileMatcher):
- def __init__(self, path, matcher, filetype) -> None:
- self.path = path
- self.internal_matchers = list(map(lambda ext: FileMatcher(path, f'{matcher}{ext}', filetype),
- WINSCOPE_EXTS))
- self.type = filetype
-
- def get_filepaths(self, device_id):
- for matcher in self.internal_matchers:
- files = matcher.get_filepaths(device_id)
- if len(files) > 0:
- return files
- log.debug("No files found")
- return []
-
-
class TraceTarget:
"""Defines a single parameter to trace.
Attributes:
- file_matchers: the matchers used to identify the paths on the device the trace results are saved to.
+ file: the path on the device the trace results are saved to.
trace_start: command to start the trace from adb shell, must not block.
trace_stop: command to stop the trace, should block until the trace is stopped.
"""
- def __init__(self, files, trace_start: str, trace_stop: str) -> None:
- if type(files) is not list:
- files = [files]
- self.files = files
+ def __init__(self, file: str, trace_start: str, trace_stop: str) -> None:
+ self.file = file
self.trace_start = trace_start
self.trace_stop = trace_stop
-# Order of files matters as they will be expected in that order and decoded in that order
TRACE_TARGETS = {
"window_trace": TraceTarget(
- WinscopeFileMatcher(WINSCOPE_DIR, "wm_trace", "window_trace"),
+ "/data/misc/wmtrace/wm_trace.pb",
'su root cmd window tracing start\necho "WM trace started."',
'su root cmd window tracing stop >/dev/null 2>&1'
),
- "accessibility_trace": TraceTarget(
- WinscopeFileMatcher("/data/misc/a11ytrace", "a11y_trace", "accessibility_trace"),
- 'su root cmd accessibility start-trace\necho "Accessibility trace started."',
- 'su root cmd accessibility stop-trace >/dev/null 2>&1'
- ),
"layers_trace": TraceTarget(
- WinscopeFileMatcher(WINSCOPE_DIR, "layers_trace", "layers_trace"),
+ "/data/misc/wmtrace/layers_trace.pb",
'su root service call SurfaceFlinger 1025 i32 1\necho "SF trace started."',
'su root service call SurfaceFlinger 1025 i32 0 >/dev/null 2>&1'
),
"screen_recording": TraceTarget(
- File(f'/data/local/tmp/screen.mp4', "screen_recording"),
- f'screenrecord --bit-rate 8M /data/local/tmp/screen.mp4 >/dev/null 2>&1 &\necho "ScreenRecorder started."',
+ "/data/local/tmp/screen.winscope.mp4",
+ 'screenrecord --bit-rate 8M /data/local/tmp/screen.winscope.mp4 >/dev/null 2>&1 &\necho "ScreenRecorder started."',
'pkill -l SIGINT screenrecord >/dev/null 2>&1'
),
"transaction": TraceTarget(
- [
- WinscopeFileMatcher(WINSCOPE_DIR, "transaction_trace", "transactions"),
- FileMatcher(WINSCOPE_DIR, f'transaction_merges_*', "transaction_merges"),
- ],
+ "/data/misc/wmtrace/transaction_trace.pb",
'su root service call SurfaceFlinger 1020 i32 1\necho "SF transactions recording started."',
'su root service call SurfaceFlinger 1020 i32 0 >/dev/null 2>&1'
),
"proto_log": TraceTarget(
- WinscopeFileMatcher(WINSCOPE_DIR, "wm_log", "proto_log"),
+ "/data/misc/wmtrace/wm_log.pb",
'su root cmd window logging start\necho "WM logging started."',
'su root cmd window logging stop >/dev/null 2>&1'
),
- "ime_trace_clients": TraceTarget(
- WinscopeFileMatcher(WINSCOPE_DIR, "ime_trace_clients", "ime_trace_clients"),
- 'su root ime tracing start\necho "Clients IME trace started."',
- 'su root ime tracing stop >/dev/null 2>&1'
- ),
- "ime_trace_service": TraceTarget(
- WinscopeFileMatcher(WINSCOPE_DIR, "ime_trace_service", "ime_trace_service"),
- 'su root ime tracing start\necho "Service IME trace started."',
- 'su root ime tracing stop >/dev/null 2>&1'
- ),
- "ime_trace_managerservice": TraceTarget(
- WinscopeFileMatcher(WINSCOPE_DIR, "ime_trace_managerservice", "ime_trace_managerservice"),
- 'su root ime tracing start\necho "ManagerService IME trace started."',
- 'su root ime tracing stop >/dev/null 2>&1'
- ),
}
-class SurfaceFlingerTraceConfig:
- """Handles optional configuration for surfaceflinger traces.
- """
-
- def __init__(self) -> None:
- # default config flags CRITICAL | INPUT | SYNC
- self.flags = 1 << 0 | 1 << 1 | 1 << 6
-
- def add(self, config: str) -> None:
- self.flags |= CONFIG_FLAG[config]
-
- def is_valid(self, config: str) -> bool:
- return config in CONFIG_FLAG
-
- def command(self) -> str:
- return f'su root service call SurfaceFlinger 1033 i32 {self.flags}'
-
-class SurfaceFlingerTraceSelectedConfig:
- """Handles optional selected configuration for surfaceflinger traces.
- """
-
- def __init__(self) -> None:
- # defaults set for all configs
- self.selectedConfigs = {
- "sfbuffersize": "16000"
- }
-
- def add(self, configType, configValue) -> None:
- self.selectedConfigs[configType] = configValue
-
- def is_valid(self, configType) -> bool:
- return configType in CONFIG_SF_SELECTION
-
- def setBufferSize(self) -> str:
- return f'su root service call SurfaceFlinger 1029 i32 {self.selectedConfigs["sfbuffersize"]}'
-
-class WindowManagerTraceSelectedConfig:
- """Handles optional selected configuration for windowmanager traces.
- """
-
- def __init__(self) -> None:
- # defaults set for all configs
- self.selectedConfigs = {
- "wmbuffersize": "16000",
- "tracinglevel": "all",
- "tracingtype": "frame",
- }
-
- def add(self, configType, configValue) -> None:
- self.selectedConfigs[configType] = configValue
-
- def is_valid(self, configType) -> bool:
- return configType in CONFIG_WM_SELECTION
-
- def setBufferSize(self) -> str:
- return f'su root cmd window tracing size {self.selectedConfigs["wmbuffersize"]}'
-
- def setTracingLevel(self) -> str:
- return f'su root cmd window tracing level {self.selectedConfigs["tracinglevel"]}'
-
- def setTracingType(self) -> str:
- return f'su root cmd window tracing {self.selectedConfigs["tracingtype"]}'
-
-
-CONFIG_FLAG = {
- "composition": 1 << 2,
- "metadata": 1 << 3,
- "hwc": 1 << 4
-}
-
-#Keep up to date with options in DataAdb.vue
-CONFIG_SF_SELECTION = [
- "sfbuffersize",
-]
-
-#Keep up to date with options in DataAdb.vue
-CONFIG_WM_SELECTION = [
- "wmbuffersize",
- "tracingtype",
- "tracinglevel",
-]
-
class DumpTarget:
"""Defines a single parameter to trace.
@@ -276,21 +115,19 @@ class DumpTarget:
dump_command: command to dump state to file.
"""
- def __init__(self, files, dump_command: str) -> None:
- if type(files) is not list:
- files = [files]
- self.files = files
+ def __init__(self, file: str, dump_command: str) -> None:
+ self.file = file
self.dump_command = dump_command
DUMP_TARGETS = {
"window_dump": DumpTarget(
- File(f'/data/local/tmp/wm_dump{WINSCOPE_EXT}', "window_dump"),
- f'su root dumpsys window --proto > /data/local/tmp/wm_dump{WINSCOPE_EXT}'
+ "/data/local/tmp/wm_dump.pb",
+ 'su root dumpsys window --proto > /data/local/tmp/wm_dump.pb'
),
"layers_dump": DumpTarget(
- File(f'/data/local/tmp/sf_dump{WINSCOPE_EXT}', "layers_dump"),
- f'su root dumpsys SurfaceFlinger --proto > /data/local/tmp/sf_dump{WINSCOPE_EXT}'
+ "/data/local/tmp/sf_dump.pb",
+ 'su root dumpsys SurfaceFlinger --proto > /data/local/tmp/sf_dump.pb'
)
}
@@ -303,21 +140,18 @@ def get_token() -> str:
try:
with open(WINSCOPE_TOKEN_LOCATION, 'r') as token_file:
token = token_file.readline()
- log.debug("Loaded token {} from {}".format(
- token, WINSCOPE_TOKEN_LOCATION))
+ log.debug("Loaded token {} from {}".format(token, WINSCOPE_TOKEN_LOCATION))
return token
except IOError:
token = secrets.token_hex(32)
os.makedirs(os.path.dirname(WINSCOPE_TOKEN_LOCATION), exist_ok=True)
try:
with open(WINSCOPE_TOKEN_LOCATION, 'w') as token_file:
- log.debug("Created and saved token {} to {}".format(
- token, WINSCOPE_TOKEN_LOCATION))
+ log.debug("Created and saved token {} to {}".format(token, WINSCOPE_TOKEN_LOCATION))
token_file.write(token)
os.chmod(WINSCOPE_TOKEN_LOCATION, 0o600)
except IOError:
- log.error("Unable to save persistent token {} to {}".format(
- token, WINSCOPE_TOKEN_LOCATION))
+ log.error("Unable to save persistent token {} to {}".format(token, WINSCOPE_TOKEN_LOCATION))
return token
@@ -334,10 +168,8 @@ def add_standard_headers(server):
server.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
server.send_header('Access-Control-Allow-Origin', '*')
server.send_header('Access-Control-Allow-Methods', 'POST, GET, OPTIONS')
- server.send_header('Access-Control-Allow-Headers',
- WINSCOPE_TOKEN_HEADER + ', Content-Type, Content-Length')
- server.send_header('Access-Control-Expose-Headers',
- 'Winscope-Proxy-Version')
+ server.send_header('Access-Control-Allow-Headers', WINSCOPE_TOKEN_HEADER + ', Content-Type, Content-Length')
+ server.send_header('Access-Control-Expose-Headers', 'Winscope-Proxy-Version')
server.send_header(WINSCOPE_VERSION_HEADER, VERSION)
server.end_headers()
@@ -361,7 +193,7 @@ class BadRequest(Exception):
class RequestRouter:
- """Handles HTTP request authentication and routing"""
+ """Handles HTTP request authenticationn and routing"""
def __init__(self, handler):
self.request = handler
@@ -377,8 +209,7 @@ class RequestRouter:
def __internal_error(self, error: str):
log.error("Internal error: " + error)
- self.request.respond(HTTPStatus.INTERNAL_SERVER_ERROR,
- error.encode("utf-8"), 'text/txt')
+ self.request.respond(HTTPStatus.INTERNAL_SERVER_ERROR, error.encode("utf-8"), 'text/txt')
def __bad_token(self):
log.info("Bad token")
@@ -411,15 +242,11 @@ def call_adb(params: str, device: str = None, stdin: bytes = None):
log.debug("Call: " + ' '.join(command))
return subprocess.check_output(command, stderr=subprocess.STDOUT, input=stdin).decode('utf-8')
except OSError as ex:
- log.debug('Error executing adb command: {}\n{}'.format(
- ' '.join(command), repr(ex)))
- raise AdbError('Error executing adb command: {}\n{}'.format(
- ' '.join(command), repr(ex)))
+ log.debug('Error executing adb command: {}\n{}'.format(' '.join(command), repr(ex)))
+ raise AdbError('Error executing adb command: {}\n{}'.format(' '.join(command), repr(ex)))
except subprocess.CalledProcessError as ex:
- log.debug('Error executing adb command: {}\n{}'.format(
- ' '.join(command), ex.output.decode("utf-8")))
- raise AdbError('Error executing adb command: adb {}\n{}'.format(
- params, ex.output.decode("utf-8")))
+ log.debug('Error executing adb command: {}\n{}'.format(' '.join(command), ex.output.decode("utf-8")))
+ raise AdbError('Error executing adb command: adb {}\n{}'.format(params, ex.output.decode("utf-8")))
def call_adb_outfile(params: str, outfile, device: str = None, stdin: bytes = None):
@@ -434,10 +261,8 @@ def call_adb_outfile(params: str, outfile, device: str = None, stdin: bytes = No
raise AdbError('Error executing adb command: adb {}\n'.format(params) + err.decode(
'utf-8') + '\n' + outfile.read().decode('utf-8'))
except OSError as ex:
- log.debug('Error executing adb command: adb {}\n{}'.format(
- params, repr(ex)))
- raise AdbError(
- 'Error executing adb command: adb {}\n{}'.format(params, repr(ex)))
+ log.debug('Error executing adb command: adb {}\n{}'.format(params, repr(ex)))
+ raise AdbError('Error executing adb command: adb {}\n{}'.format(params, repr(ex)))
class ListDevicesEndpoint(RequestEndpoint):
@@ -465,54 +290,34 @@ class DeviceRequestEndpoint(RequestEndpoint):
def process_with_device(self, server, path, device_id):
pass
- def get_request(self, server) -> str:
- try:
- length = int(server.headers["Content-Length"])
- except KeyError as err:
- raise BadRequest("Missing Content-Length header\n" + str(err))
- except ValueError as err:
- raise BadRequest("Content length unreadable\n" + str(err))
- return json.loads(server.rfile.read(length).decode("utf-8"))
-
-class FetchFilesEndpoint(DeviceRequestEndpoint):
+class FetchFileEndpoint(DeviceRequestEndpoint):
def process_with_device(self, server, path, device_id):
if len(path) != 1:
raise BadRequest("File not specified")
if path[0] in TRACE_TARGETS:
- files = TRACE_TARGETS[path[0]].files
+ file_path = TRACE_TARGETS[path[0]].file
elif path[0] in DUMP_TARGETS:
- files = DUMP_TARGETS[path[0]].files
+ file_path = DUMP_TARGETS[path[0]].file
else:
raise BadRequest("Unknown file specified")
- file_buffers = dict()
-
- for f in files:
- file_type = f.get_filetype()
- file_paths = f.get_filepaths(device_id)
-
- for file_path in file_paths:
- with NamedTemporaryFile() as tmp:
- log.debug(
- f"Fetching file {file_path} from device to {tmp.name}")
- call_adb_outfile('exec-out su root cat ' +
- file_path, tmp, device_id)
- log.debug(f"Deleting file {file_path} from device")
- call_adb('shell su root rm ' + file_path, device_id)
- log.debug(f"Uploading file {tmp.name}")
- if file_type not in file_buffers:
- file_buffers[file_type] = []
- buf = base64.encodebytes(tmp.read()).decode("utf-8")
- file_buffers[file_type].append(buf)
-
- if (len(file_buffers) == 0):
- log.error("Proxy didn't find any file to fetch")
-
- # server.send_header('X-Content-Type-Options', 'nosniff')
- # add_standard_headers(server)
- j = json.dumps(file_buffers)
- server.respond(HTTPStatus.OK, j.encode("utf-8"), "text/json")
+ with NamedTemporaryFile() as tmp:
+ log.debug("Fetching file {} from device to {}".format(file_path, tmp.name))
+ call_adb_outfile('exec-out su root cat ' + file_path, tmp, device_id)
+ log.debug("Deleting file {} from device".format(file_path))
+ call_adb('shell su root rm ' + file_path, device_id)
+ server.send_response(HTTPStatus.OK)
+ server.send_header('X-Content-Type-Options', 'nosniff')
+ server.send_header('Content-type', 'application/octet-stream')
+ add_standard_headers(server)
+ log.debug("Uploading file {}".format(tmp.name))
+ while True:
+ buf = tmp.read(1024)
+ if buf:
+ server.wfile.write(buf)
+ else:
+ break
def check_root(device_id):
@@ -537,41 +342,34 @@ class TraceThread(threading.Thread):
self.process = subprocess.Popen(shell, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, stdin=subprocess.PIPE, start_new_session=True)
except OSError as ex:
- raise AdbError(
- 'Error executing adb command: adb shell\n{}'.format(repr(ex)))
+ raise AdbError('Error executing adb command: adb shell\n{}'.format(repr(ex)))
super().__init__()
def timeout(self):
if self.is_alive():
- log.warning(
- "Keep-alive timeout for trace on {}".format(self._device_id))
+ log.warning("Keep-alive timeout for trace on {}".format(self._device_id))
self.end_trace()
if self._device_id in TRACE_THREADS:
TRACE_THREADS.pop(self._device_id)
def reset_timer(self):
- log.debug(
- "Resetting keep-alive clock for trace on {}".format(self._device_id))
+ log.debug("Resetting keep-alive clock for trace on {}".format(self._device_id))
if self._keep_alive_timer:
self._keep_alive_timer.cancel()
- self._keep_alive_timer = threading.Timer(
- KEEP_ALIVE_INTERVAL_S, self.timeout)
+ self._keep_alive_timer = threading.Timer(KEEP_ALIVE_INTERVAL_S, self.timeout)
self._keep_alive_timer.start()
def end_trace(self):
if self._keep_alive_timer:
self._keep_alive_timer.cancel()
- log.debug("Sending SIGINT to the trace process on {}".format(
- self._device_id))
+ log.debug("Sending SIGINT to the trace process on {}".format(self._device_id))
self.process.send_signal(signal.SIGINT)
try:
- log.debug("Waiting for trace shell to exit for {}".format(
- self._device_id))
+ log.debug("Waiting for trace shell to exit for {}".format(self._device_id))
self.process.wait(timeout=5)
except TimeoutError:
- log.debug(
- "TIMEOUT - sending SIGKILL to the trace process on {}".format(self._device_id))
+ log.debug("TIMEOUT - sending SIGKILL to the trace process on {}".format(self._device_id))
self.process.kill()
self.join()
@@ -583,10 +381,8 @@ class TraceThread(threading.Thread):
time.sleep(0.2)
for i in range(10):
if call_adb("shell su root cat /data/local/tmp/winscope_status", device=self._device_id) == 'TRACE_OK\n':
- call_adb(
- "shell su root rm /data/local/tmp/winscope_status", device=self._device_id)
- log.debug("Trace finished successfully on {}".format(
- self._device_id))
+ call_adb("shell su root rm /data/local/tmp/winscope_status", device=self._device_id)
+ log.debug("Trace finished successfully on {}".format(self._device_id))
self._success = True
break
log.debug("Still waiting for cleanup on {}".format(self._device_id))
@@ -624,7 +420,13 @@ while true; do sleep 0.1; done
def process_with_device(self, server, path, device_id):
try:
- requested_types = self.get_request(server)
+ length = int(server.headers["Content-Length"])
+ except KeyError as err:
+ raise BadRequest("Missing Content-Length header\n" + str(err))
+ except ValueError as err:
+ raise BadRequest("Content length unreadable\n" + str(err))
+ try:
+ requested_types = json.loads(server.rfile.read(length).decode("utf-8"))
requested_traces = [TRACE_TARGETS[t] for t in requested_types]
except KeyError as err:
raise BadRequest("Unsupported trace target\n" + str(err))
@@ -638,10 +440,8 @@ while true; do sleep 0.1; done
command = StartTrace.TRACE_COMMAND.format(
'\n'.join([t.trace_stop for t in requested_traces]),
'\n'.join([t.trace_start for t in requested_traces]))
- log.debug("Trace requested for {} with targets {}".format(
- device_id, ','.join(requested_types)))
- TRACE_THREADS[device_id] = TraceThread(
- device_id, command.encode('utf-8'))
+ log.debug("Trace requested for {} with targets {}".format(device_id, ','.join(requested_types)))
+ TRACE_THREADS[device_id] = TraceThread(device_id, command.encode('utf-8'))
TRACE_THREADS[device_id].start()
server.respond(HTTPStatus.OK, b'', "text/plain")
@@ -654,8 +454,7 @@ class EndTrace(DeviceRequestEndpoint):
TRACE_THREADS[device_id].end_trace()
success = TRACE_THREADS[device_id].success()
- out = TRACE_THREADS[device_id].out + \
- b"\n" + TRACE_THREADS[device_id].err
+ out = TRACE_THREADS[device_id].out + b"\n" + TRACE_THREADS[device_id].err
command = TRACE_THREADS[device_id].trace_command
TRACE_THREADS.pop(device_id)
if success:
@@ -667,97 +466,24 @@ class EndTrace(DeviceRequestEndpoint):
"utf-8"))
-def execute_command(server, device_id, shell, configType, configValue):
- process = subprocess.Popen(shell, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- stdin=subprocess.PIPE, start_new_session=True)
- log.debug(f"Changing trace config on device {device_id} {configType}:{configValue}")
- out, err = process.communicate(configValue.encode('utf-8'))
- if process.returncode != 0:
- raise AdbError(
- f"Error executing command:\n {configValue}\n\n### OUTPUT ###{out.decode('utf-8')}\n{err.decode('utf-8')}")
- log.debug(f"Changing trace config finished on device {device_id}")
- server.respond(HTTPStatus.OK, b'', "text/plain")
-
-
-class ConfigTrace(DeviceRequestEndpoint):
- def process_with_device(self, server, path, device_id):
- try:
- requested_configs = self.get_request(server)
- config = SurfaceFlingerTraceConfig()
- for requested_config in requested_configs:
- if not config.is_valid(requested_config):
- raise BadRequest(
- f"Unsupported config {requested_config}\n")
- config.add(requested_config)
- except KeyError as err:
- raise BadRequest("Unsupported trace target\n" + str(err))
- if device_id in TRACE_THREADS:
- BadRequest(f"Trace in progress for {device_id}")
- if not check_root(device_id):
- raise AdbError(
- f"Unable to acquire root privileges on the device - check the output of 'adb -s {device_id} shell su root id'")
- command = config.command()
- shell = ['adb', '-s', device_id, 'shell']
- log.debug(f"Starting shell {' '.join(shell)}")
- execute_command(server, device_id, shell, "sf buffer size", command)
-
-
-def add_selected_request_to_config(self, server, device_id, config):
- try:
- requested_configs = self.get_request(server)
- for requested_config in requested_configs:
- if config.is_valid(requested_config):
- config.add(requested_config, requested_configs[requested_config])
- else:
- raise BadRequest(
- f"Unsupported config {requested_config}\n")
- except KeyError as err:
- raise BadRequest("Unsupported trace target\n" + str(err))
- if device_id in TRACE_THREADS:
- BadRequest(f"Trace in progress for {device_id}")
- if not check_root(device_id):
- raise AdbError(
- f"Unable to acquire root privileges on the device - check the output of 'adb -s {device_id} shell su root id'")
- return config
-
-
-class SurfaceFlingerSelectedConfigTrace(DeviceRequestEndpoint):
- def process_with_device(self, server, path, device_id):
- config = SurfaceFlingerTraceSelectedConfig()
- config = add_selected_request_to_config(self, server, device_id, config)
- setBufferSize = config.setBufferSize()
- shell = ['adb', '-s', device_id, 'shell']
- log.debug(f"Starting shell {' '.join(shell)}")
- execute_command(server, device_id, shell, "sf buffer size", setBufferSize)
-
-
-class WindowManagerSelectedConfigTrace(DeviceRequestEndpoint):
- def process_with_device(self, server, path, device_id):
- config = WindowManagerTraceSelectedConfig()
- config = add_selected_request_to_config(self, server, device_id, config)
- setBufferSize = config.setBufferSize()
- setTracingType = config.setTracingType()
- setTracingLevel = config.setTracingLevel()
- shell = ['adb', '-s', device_id, 'shell']
- log.debug(f"Starting shell {' '.join(shell)}")
- execute_command(server, device_id, shell, "wm buffer size", setBufferSize)
- execute_command(server, device_id, shell, "tracing type", setTracingType)
- execute_command(server, device_id, shell, "tracing level", setTracingLevel)
-
-
class StatusEndpoint(DeviceRequestEndpoint):
def process_with_device(self, server, path, device_id):
if device_id not in TRACE_THREADS:
raise BadRequest("No trace in progress for {}".format(device_id))
TRACE_THREADS[device_id].reset_timer()
- server.respond(HTTPStatus.OK, str(
- TRACE_THREADS[device_id].is_alive()).encode("utf-8"), "text/plain")
+ server.respond(HTTPStatus.OK, str(TRACE_THREADS[device_id].is_alive()).encode("utf-8"), "text/plain")
class DumpEndpoint(DeviceRequestEndpoint):
def process_with_device(self, server, path, device_id):
try:
- requested_types = self.get_request(server)
+ length = int(server.headers["Content-Length"])
+ except KeyError as err:
+ raise BadRequest("Missing Content-Length header\n" + str(err))
+ except ValueError as err:
+ raise BadRequest("Content length unreadable\n" + str(err))
+ try:
+ requested_types = json.loads(server.rfile.read(length).decode("utf-8"))
requested_traces = [DUMP_TARGETS[t] for t in requested_types]
except KeyError as err:
raise BadRequest("Unsupported trace target\n" + str(err))
@@ -784,21 +510,12 @@ class DumpEndpoint(DeviceRequestEndpoint):
class ADBWinscopeProxy(BaseHTTPRequestHandler):
def __init__(self, request, client_address, server):
self.router = RequestRouter(self)
- self.router.register_endpoint(
- RequestType.GET, "devices", ListDevicesEndpoint())
- self.router.register_endpoint(
- RequestType.GET, "status", StatusEndpoint())
- self.router.register_endpoint(
- RequestType.GET, "fetch", FetchFilesEndpoint())
+ self.router.register_endpoint(RequestType.GET, "devices", ListDevicesEndpoint())
+ self.router.register_endpoint(RequestType.GET, "status", StatusEndpoint())
+ self.router.register_endpoint(RequestType.GET, "fetch", FetchFileEndpoint())
self.router.register_endpoint(RequestType.POST, "start", StartTrace())
self.router.register_endpoint(RequestType.POST, "end", EndTrace())
self.router.register_endpoint(RequestType.POST, "dump", DumpEndpoint())
- self.router.register_endpoint(
- RequestType.POST, "configtrace", ConfigTrace())
- self.router.register_endpoint(
- RequestType.POST, "selectedsfconfigtrace", SurfaceFlingerSelectedConfigTrace())
- self.router.register_endpoint(
- RequestType.POST, "selectedwmconfigtrace", WindowManagerSelectedConfigTrace())
super().__init__(request, client_address, server)
def respond(self, code: int, data: bytes, mime: str) -> None:
diff --git a/vendor_snapshot/update.py b/vendor_snapshot/update.py
index 03cc236dc..9563380fe 100644
--- a/vendor_snapshot/update.py
+++ b/vendor_snapshot/update.py
@@ -110,6 +110,8 @@ JSON_TO_BP = {
'RuntimeLibs': 'runtime_libs',
'Required': 'required',
'Filename': 'filename',
+ 'CrateName': 'crate_name',
+ 'Prebuilt': 'prebuilt',
}
SANITIZER_VARIANT_PROPS = {
@@ -405,22 +407,35 @@ def convert_json_host_data_to_bp(mod, install_dir):
All host modules are created as a cc_prebuilt_binary
blueprint module with the prefer attribute set to true.
+ Modules that already have a prebuilt are not created.
+
Args:
mod: JSON definition of the module
install_dir: installation directory of the host snapshot
"""
+ rust_proc_macro = mod.pop('RustProcMacro', False)
prop = convert_json_data_to_bp_prop(mod, install_dir)
- prop['host_supported'] = True
- prop['device_supported'] = False
+ if 'prebuilt' in prop:
+ return
+
+ if not rust_proc_macro:
+ prop['host_supported'] = True
+ prop['device_supported'] = False
+ prop['stl'] = 'none'
+
prop['prefer'] = True
- prop['stl'] = 'none'
## Move install file to host source file
prop['target'] = dict()
prop['target']['host'] = dict()
prop['target']['host']['srcs'] = [prop['filename']]
del prop['filename']
- bp = 'cc_prebuilt_binary {\n' + gen_bp_prop(prop, INDENT) + '}\n\n'
+ mod_type = 'cc_prebuilt_binary'
+
+ if rust_proc_macro:
+ mod_type = 'rust_prebuilt_proc_macro'
+
+ bp = mod_type + ' {\n' + gen_bp_prop(prop, INDENT) + '}\n\n'
return bp
def gen_host_bp_file(install_dir):
@@ -441,7 +456,8 @@ def gen_host_bp_file(install_dir):
props = json.load(rfp)
for mod in props:
prop = convert_json_host_data_to_bp(mod, install_dir)
- wfp.write(prop)
+ if prop:
+ wfp.write(prop)
def gen_bp_files(image, vndk_dir, install_dir, snapshot_version):
"""Generates Android.bp for each archtecture.
@@ -649,7 +665,7 @@ def check_host_usage(install_dir, ninja_binary, ninja_file, goals, output):
with open(output, 'w') as f:
f.write('vsdk_host_tools = [ \n')
for m in sorted(used_modules):
- f.write(' "%s", \n' % m)
+ f.write(' "%s",\n' % m)
f.write('] \n')
def check_module_usage(install_dir, ninja_binary, image, ninja_file, goals,
diff --git a/vndk/tools/header-checker/android/envsetup.sh b/vndk/tools/header-checker/android/envsetup.sh
index bdfaf804f..ef5312db0 100644
--- a/vndk/tools/header-checker/android/envsetup.sh
+++ b/vndk/tools/header-checker/android/envsetup.sh
@@ -15,5 +15,5 @@
# limitations under the License.
export LLVM_BUILD_HOST_TOOLS=true
-export LLVM_PREBUILTS_VERSION=clang-r445002
-export LLVM_RELEASE_VERSION=14.0.2
+export LLVM_PREBUILTS_VERSION=clang-r450784c
+export LLVM_RELEASE_VERSION=14.0.5