Snap for 7418956 from 7c82f01a4b7d91ed61e681fd5b1ea898765d5fb2 to ndk-r23-release
Change-Id: Ieeac92c534ebb2e2086e99f207247c8de203bdbd
diff --git a/apps/Development/Android.mk b/apps/Development/Android.mk
index 39498d5..3db6cc3 100644
--- a/apps/Development/Android.mk
+++ b/apps/Development/Android.mk
@@ -5,6 +5,9 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs telephony-common org.apache.http.legacy
+LOCAL_USES_LIBRARIES := android.test.runner
+LOCAL_OPTIONAL_USES_LIBRARIES := org.apache.http.legacy android.test.base android.test.mock
+
LOCAL_SRC_FILES := $(call all-subdir-java-files) \
src/com/android/development/IRemoteService.aidl \
diff --git a/cmds/monkey/Android.bp b/cmds/monkey/Android.bp
index 192a66a..2b67032 100644
--- a/cmds/monkey/Android.bp
+++ b/cmds/monkey/Android.bp
@@ -17,16 +17,9 @@
],
}
-java_library {
- name: "monkeylib",
- installable: true,
- srcs: ["**/*.java"],
- stem: "monkey",
-}
-
//###############################################################
-cc_prebuilt_binary {
+java_binary {
name: "monkey",
- srcs: ["monkey"],
- required: ["monkeylib"],
+ srcs: ["**/*.java"],
+ wrapper: "monkey",
}
diff --git a/samples/AutofillKeyboard/lint-baseline.xml b/samples/AutofillKeyboard/lint-baseline.xml
index 9e60ad6..9ba91c5 100644
--- a/samples/AutofillKeyboard/lint-baseline.xml
+++ b/samples/AutofillKeyboard/lint-baseline.xml
@@ -36,6 +36,28 @@
<issue
id="NewApi"
+ message="Call requires API level R (current min is 29): `newStylesBuilder`"
+ errorLine1=" StylesBuilder stylesBuilder = UiVersions.newStylesBuilder();"
+ errorLine2=" ~~~~~~~~~~~~~~~~">
+ <location
+ file="development/samples/AutofillKeyboard/src/com/example/android/autofillkeyboard/AutofillImeService.java"
+ line="229"
+ column="50"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level R (current min is 29): `newStyleBuilder`"
+ errorLine1=" Style style = InlineSuggestionUi.newStyleBuilder()"
+ errorLine2=" ~~~~~~~~~~~~~~~">
+ <location
+ file="development/samples/AutofillKeyboard/src/com/example/android/autofillkeyboard/AutofillImeService.java"
+ line="230"
+ column="42"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level R (current min is 29): `new android.widget.inline.InlinePresentationSpec.Builder`"
errorLine1=" presentationSpecs.add(new InlinePresentationSpec.Builder(new Size(100, getHeight()),"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
diff --git a/samples/UiAutomator/Android.bp b/samples/UiAutomator/Android.bp
new file mode 100644
index 0000000..3a92d57
--- /dev/null
+++ b/samples/UiAutomator/Android.bp
@@ -0,0 +1,29 @@
+//Copyright (C) 2012 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.
+
+package {
+ // See: http://go/android-license-faq
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+java_library {
+ name: "uiautomator.samples",
+ installable: true,
+ srcs: ["src/**/*.java"],
+ libs: [
+ "uiautomator.core",
+ "android.test.base.stubs",
+ ],
+ static_libs: ["junit"],
+}
diff --git a/samples/UiAutomator/Android.mk b/samples/UiAutomator/Android.mk
deleted file mode 100644
index 5f4c593..0000000
--- a/samples/UiAutomator/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-#Copyright (C) 2012 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.
-
-local_target_dir := $(TARGET_OUT_DATA)/local/tmp
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE := uiautomator.samples
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-
-LOCAL_JAVA_LIBRARIES := uiautomator.core android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-LOCAL_MODULE_PATH := $(local_target_dir)
-
-include $(BUILD_JAVA_LIBRARY)
diff --git a/scripts/Android.bp b/scripts/Android.bp
index aad32ca..a3fb2c7 100644
--- a/scripts/Android.bp
+++ b/scripts/Android.bp
@@ -51,8 +51,23 @@
"example_crashes.py",
"stack_core.py",
],
+ data: [
+ ":llvm-tools",
+ ],
libs: ["python-symbol"],
- test_suites: ["general-tests"],
+ version: {
+ py2: {
+ enabled: false,
+ embedded_launcher: false,
+ },
+ py3: {
+ enabled: true,
+ embedded_launcher: false,
+ },
+ },
+ test_options: {
+ unit_test: true,
+ },
}
python_test_host {
diff --git a/scripts/acov-llvm.py b/scripts/acov-llvm.py
index e175b19..063911f 100755
--- a/scripts/acov-llvm.py
+++ b/scripts/acov-llvm.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 202121 The Android Open Source Project
+# Copyright (C) 2021 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.
@@ -32,11 +32,11 @@
# or from all processes on the device:
# $ acov-llvm.py flush
#
-# 4. pull coverage from device and generate coverage report
+# 4. Pull coverage from device and generate coverage report
# $ acov-llvm.py report -s <one-or-more-source-paths-in-$ANDROID_BUILD_TOP \
# -b <one-or-more-binaries-in-$OUT> \
# E.g.:
-# development/scripts/acov-llvm.py report \
+# acov-llvm.py report \
# -s bionic \
# -b \
# $OUT/symbols/apex/com.android.runtime/lib/bionic/libc.so \
@@ -60,7 +60,7 @@
def _get_clang_revision():
- regex = r'ClangDefaultVersion\s+= "(?P<rev>clang-r\d+)"'
+ regex = r'ClangDefaultVersion\s+= "(?P<rev>clang-r\d+[a-z]?)"'
global_go = android_build_top() / 'build/soong/cc/config/global.go'
with open(global_go) as infile:
match = re.search(regex, infile.read())
@@ -84,14 +84,59 @@
cmd, *args, **kwargs, check=True, stdout=subprocess.PIPE).stdout
+def adb(cmd, *args, **kwargs):
+ """call 'adb <cmd>' with logging."""
+ return check_output(['adb'] + cmd, *args, **kwargs)
+
+
+def adb_root(*args, **kwargs):
+ """call 'adb root' with logging."""
+ return adb(['root'], *args, **kwargs)
+
+
def adb_shell(cmd, *args, **kwargs):
"""call 'adb shell <cmd>' with logging."""
- return check_output(['adb', 'shell'] + cmd)
+ return adb(['shell'] + cmd, *args, **kwargs)
+
+
+def send_flush_signal(pids=None):
+
+ def _has_handler_sig37(pid):
+ try:
+ status = adb_shell(['cat', f'/proc/{pid}/status'],
+ text=True,
+ stderr=subprocess.DEVNULL)
+ except subprocess.CalledProcessError:
+ logging.warning(f'Process {pid} is no longer active')
+ return False
+
+ status = status.split('\n')
+ sigcgt = [
+ line.split(':\t')[1] for line in status if line.startswith('SigCgt')
+ ]
+ if not sigcgt:
+ logging.warning(f'Cannot find \'SigCgt:\' in /proc/{pid}/status')
+ return False
+ return int(sigcgt[0], base=16) & (1 << 36)
+
+ if not pids:
+ output = adb_shell(['ps', '-eo', 'pid'], text=True)
+ pids = [pid.strip() for pid in output.split()]
+ pids = pids[1:] # ignore the column header
+ pids = [pid for pid in pids if _has_handler_sig37(pid)]
+
+ if not pids:
+ logging.warning(
+ f'couldn\'t find any process with handler for signal 37')
+
+ adb_shell(['kill', '-37'] + pids)
def do_clean_device(args):
+ adb_root()
+
logging.info('resetting coverage on device')
- adb_shell(['kill', '-37', '-1'])
+ send_flush_signal()
logging.info(
f'sleeping for {FLUSH_SLEEP} seconds for coverage to be written')
@@ -102,16 +147,16 @@
def do_flush(args):
+ adb_root()
+
if args.procnames:
pids = adb_shell(['pidof'] + args.procnames, text=True).split()
logging.info(f'flushing coverage for pids: {pids}')
else:
- pids = ['-1']
+ pids = None
logging.info('flushing coverage for all processes on device')
- # TODO(pirama) Send signal 37 to only those processes that have a
- # handler installed for it. See b/149047976
- adb_shell(['kill', '-37'] + pids)
+ send_flush_signal(pids)
logging.info(
f'sleeping for {FLUSH_SLEEP} seconds for coverage to be written')
@@ -119,6 +164,8 @@
def do_report(args):
+ adb_root()
+
temp_dir = tempfile.mkdtemp(
prefix='covreport-', dir=os.environ.get('ANDROID_BUILD_TOP', None))
logging.info(f'generating coverage report in {temp_dir}')
@@ -136,12 +183,16 @@
object_flags = [args.binary[0]] + ['--object=' + b for b in args.binary[1:]]
source_dirs = ['/proc/self/cwd/' + s for s in args.source_dir]
+ output_dir = f'{temp_dir}/html'
+
check_output([
str(LLVM_COV_PATH), 'show', f'--instr-profile={profdata}',
- '--format=html', f'--output-dir={temp_dir}/html',
+ '--format=html', f'--output-dir={output_dir}',
'--show-region-summary=false'
] + object_flags + source_dirs)
+ print(f'Coverage report data written in {output_dir}')
+
def parse_args():
parser = argparse.ArgumentParser()
diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py
index 8557a6d..7c43aad 100755
--- a/scripts/cargo2android.py
+++ b/scripts/cargo2android.py
@@ -1280,7 +1280,10 @@
print('Running:', cmd)
with open(cargo_out, 'a') as out_file:
out_file.write('### Running: ' + cmd + '\n')
- os.system(cmd)
+ ret = os.system(cmd)
+ if ret != 0:
+ print('*** There was an error while running cargo. ' +
+ 'See the cargo.out file for details.')
if added_workspace: # restore original Cargo.toml
with open(cargo_toml, 'w') as out_file:
out_file.writelines(cargo_toml_lines)
diff --git a/scripts/symbol.py b/scripts/symbol.py
index 360a2cb..821da8e 100755
--- a/scripts/symbol.py
+++ b/scripts/symbol.py
@@ -24,6 +24,7 @@
import os
import platform
import re
+import shutil
import signal
import subprocess
import unittest
@@ -132,7 +133,9 @@
def ToolPath(tool, toolchain=None):
- """Return a fully-qualified path to the specified tool"""
+ """Return a fully-qualified path to the specified tool, or just the tool if it's on PATH """
+ if shutil.which(tool) is not None:
+ return tool
if not toolchain:
toolchain = FindToolchain()
return os.path.join(toolchain, tool)
@@ -431,14 +434,14 @@
if mangled_symbol in _SYMBOL_DEMANGLING_CACHE:
return _SYMBOL_DEMANGLING_CACHE[mangled_symbol]
- # TODO: Replace with llvm-cxxfilt when available.
global _CACHED_CXX_FILT
if not _CACHED_CXX_FILT:
- os_name = platform.system().lower()
- toolchains = glob.glob("%s/prebuilts/gcc/%s-*/host/*-linux-*/bin/*c++filt" %
- (ANDROID_BUILD_TOP, os_name))
+ toolchains = None
+ # TODO(b/187231324) do not hard-code prebuilt version number below
+ if os.path.exists('./clang-r416183b/bin/llvm-cxxfilt'):
+ toolchains = ["./clang-r416183b/bin/llvm-cxxfilt"]
if not toolchains:
- raise Exception("Could not find gcc c++filt tool")
+ raise Exception("Could not find llvm-cxxfilt tool")
_CACHED_CXX_FILT = sorted(toolchains)[-1]
cmd = [_CACHED_CXX_FILT]
diff --git a/tools/otagui/README.md b/tools/otagui/README.md
new file mode 100644
index 0000000..3d73f5e
--- /dev/null
+++ b/tools/otagui/README.md
@@ -0,0 +1,4 @@
+# README
+This is a GUI for generating OTA package, using OTA_from_target_files command.
+
+
diff --git a/vndk/snapshot/gen_buildfiles.py b/vndk/snapshot/gen_buildfiles.py
index f56187d..336a9f9 100644
--- a/vndk/snapshot/gen_buildfiles.py
+++ b/vndk/snapshot/gen_buildfiles.py
@@ -102,6 +102,8 @@
self._snapshot_archs = utils.get_snapshot_archs(install_dir)
self._root_bpfile = os.path.join(install_dir, utils.ROOT_BP_PATH)
self._common_bpfile = os.path.join(install_dir, utils.COMMON_BP_PATH)
+ self._llndk = self._parse_lib_list(
+ os.path.basename(self._etc_paths['llndk.libraries.txt']))
self._vndk_core = self._parse_lib_list(
os.path.basename(self._etc_paths['vndkcore.libraries.txt']))
self._vndk_sp = self._parse_lib_list(
@@ -232,15 +234,26 @@
vndk_core_buildrules = self._gen_vndk_shared_prebuilts(
self._vndk_core[arch],
arch,
+ is_llndk=False,
is_vndk_sp=False,
is_binder32=is_binder32,
module_names=module_names)
vndk_sp_buildrules = self._gen_vndk_shared_prebuilts(
self._vndk_sp[arch],
arch,
+ is_llndk=False,
is_vndk_sp=True,
is_binder32=is_binder32,
module_names=module_names)
+ include_llndk = self._vndk_version > 30
+ if include_llndk:
+ llndk_buildrules = self._gen_vndk_shared_prebuilts(
+ self._llndk[arch],
+ arch,
+ is_llndk=True,
+ is_vndk_sp=False,
+ is_binder32=is_binder32,
+ module_names=module_names)
with open(bpfile_path, 'w') as bpfile:
bpfile.write(self._gen_autogen_msg('/'))
@@ -248,6 +261,9 @@
bpfile.write('\n'.join(vndk_core_buildrules))
bpfile.write('\n')
bpfile.write('\n'.join(vndk_sp_buildrules))
+ if include_llndk:
+ bpfile.write('\n')
+ bpfile.write('\n'.join(llndk_buildrules))
variant_include_path = os.path.join(variant_path, 'include')
include_path = os.path.join(self._install_dir, arch, 'include')
@@ -409,6 +425,7 @@
def _gen_vndk_shared_prebuilts(self,
prebuilts,
arch,
+ is_llndk,
is_vndk_sp,
is_binder32,
module_names):
@@ -417,6 +434,7 @@
Args:
prebuilts: list of VNDK shared prebuilts
arch: string, VNDK snapshot arch (e.g. 'arm64')
+ is_llndk: bool, True if the prebuilts are LLNDK stubs
is_vndk_sp: bool, True if prebuilts are VNDK_SP libs
is_binder32: bool, True if binder interface is 32-bit
module_names: dict, module names for given prebuilts
@@ -427,6 +445,7 @@
bp_module = self._gen_vndk_shared_prebuilt(
prebuilt,
arch,
+ is_llndk=is_llndk,
is_vndk_sp=is_vndk_sp,
is_binder32=is_binder32,
module_names=module_names)
@@ -437,6 +456,7 @@
def _gen_vndk_shared_prebuilt(self,
prebuilt,
arch,
+ is_llndk,
is_vndk_sp,
is_binder32,
module_names):
@@ -446,6 +466,7 @@
Args:
prebuilt: string, name of prebuilt object
arch: string, VNDK snapshot arch (e.g. 'arm64')
+ is_llndk: bool, True if prebuilt is a LLNDK stub
is_vndk_sp: bool, True if prebuilt is a VNDK_SP lib
is_binder32: bool, True if binder interface is 32-bit
module_names: dict, module names for given prebuilts
@@ -571,19 +592,31 @@
product_available = ''
# if vndkproduct.libraries.txt is empty, make the VNDKs available to product by default.
- if not self._vndk_product[arch] or prebuilt in self._vndk_product[arch]:
+ if not self._vndk_product[arch] or prebuilt in self._vndk_product[arch] or is_llndk:
product_available = '{ind}product_available: true,\n'.format(
ind=self.INDENT)
- vndk_sp = ''
- if is_vndk_sp:
- vndk_sp = '{ind}{ind}support_system_process: true,\n'.format(
- ind=self.INDENT)
+ vndk_props = ''
+ if not is_llndk:
+ vndk_sp = ''
+ if is_vndk_sp:
+ vndk_sp = '{ind}{ind}support_system_process: true,\n'.format(
+ ind=self.INDENT)
- vndk_private = ''
- if prebuilt in self._vndk_private[arch]:
- vndk_private = '{ind}{ind}private: true,\n'.format(
- ind=self.INDENT)
+ vndk_private = ''
+ if prebuilt in self._vndk_private[arch]:
+ vndk_private = '{ind}{ind}private: true,\n'.format(
+ ind=self.INDENT)
+
+ vndk_props = ('{ind}vndk: {{\n'
+ '{ind}{ind}enabled: true,\n'
+ '{vndk_sp}'
+ '{vndk_private}'
+ '{ind}}},\n'.format(
+ ind=self.INDENT,
+ product_available=product_available,
+ vndk_sp=vndk_sp,
+ vndk_private=vndk_private))
notice = get_notice_file(prebuilt)
arch_props = get_arch_props(prebuilt, arch, src_paths)
@@ -599,11 +632,7 @@
'{binder32bit}'
'{ind}vendor_available: true,\n'
'{product_available}'
- '{ind}vndk: {{\n'
- '{ind}{ind}enabled: true,\n'
- '{vndk_sp}'
- '{vndk_private}'
- '{ind}}},\n'
+ '{vndk_props}'
'{notice}'
'{arch_props}'
'}}\n'.format(
@@ -613,8 +642,7 @@
target_arch=arch,
binder32bit=binder32bit,
product_available=product_available,
- vndk_sp=vndk_sp,
- vndk_private=vndk_private,
+ vndk_props=vndk_props,
notice=notice,
arch_props=arch_props))
diff --git a/vndk/tools/header-checker/utils/utils.py b/vndk/tools/header-checker/utils/utils.py
index 9256e18..e0fd5cf 100644
--- a/vndk/tools/header-checker/utils/utils.py
+++ b/vndk/tools/header-checker/utils/utils.py
@@ -2,6 +2,7 @@
import gzip
import os
+import re
import shutil
import subprocess
import sys
@@ -177,9 +178,12 @@
return os.path.join(product_out, 'lsdump_paths.txt')
-def _is_sanitizer_variation(variation):
- """Check whether the variation is introduced by a sanitizer."""
- return variation in {'asan', 'hwasan', 'tsan', 'intOverflow', 'cfi', 'scs'}
+def _get_module_variant_sort_key(suffix):
+ for variant in suffix.split('_'):
+ match = re.match(r'apex(\d+)$', variant)
+ if match:
+ return (int(match.group(1)), suffix)
+ return (-1, suffix)
def _get_module_variant_dir_name(tag, vndk_version, arch_cpu_str):
@@ -232,13 +236,10 @@
if not variant.startswith(prefix):
continue
new_suffix = variant[len(prefix):]
- # Skip if the suffix contains APEX variations.
- new_variations = [x for x in new_suffix.split('_') if x]
- if new_variations and not all(_is_sanitizer_variation(x)
- for x in new_variations):
- continue
old_suffix = suffixes[libname].get(arch_cpu)
- if not old_suffix or new_suffix > old_suffix:
+ if (not old_suffix or
+ _get_module_variant_sort_key(new_suffix) >
+ _get_module_variant_sort_key(old_suffix)):
lsdump_paths[libname][arch_cpu][tag] = path
suffixes[libname][arch_cpu] = new_suffix
return lsdump_paths