Merge changes from topics "2019-11-12-schuffelen-ivserver", "2019-11-12-schuffelen-record-audio", "2019-11-12-schuffelen-vsoc-lib", "2019-11-13-schuffelen-socket-forward"
* changes:
Delete vsoc support libraries and tests
Remove header dependencies on vsoc_lib
Break build dependencies on vsoc_lib
Delete the stream_audio host binary
Remove references to stream_audio.
Delete the record_audio host binary
Delete the legacy audio hal
Delete vsoc, vsoc-future hwcomposers
Delete guest/hals/gralloc but not /legacy
Delete ivserver
Remove {assemble,launch,run}_cvd ivserver references
Delete socket_forward_proxy
Delete references to socket_forward_proxy
diff --git a/common/libs/fs/shared_fd.cpp b/common/libs/fs/shared_fd.cpp
index 6db27ee..061432a 100644
--- a/common/libs/fs/shared_fd.cpp
+++ b/common/libs/fs/shared_fd.cpp
@@ -231,8 +231,9 @@
}
SharedFD SharedFD::Dup(int unmanaged_fd) {
- int fd = dup(unmanaged_fd);
- return SharedFD(std::shared_ptr<FileInstance>(new FileInstance(fd, errno)));
+ int fd = fcntl(unmanaged_fd, F_DUPFD_CLOEXEC, 3);
+ int error_num = errno;
+ return SharedFD(std::shared_ptr<FileInstance>(new FileInstance(fd, error_num)));
}
bool SharedFD::Pipe(SharedFD* fd0, SharedFD* fd1) {
diff --git a/common/libs/utils/subprocess.cpp b/common/libs/utils/subprocess.cpp
index d3ebf1d..e83b487 100644
--- a/common/libs/utils/subprocess.cpp
+++ b/common/libs/utils/subprocess.cpp
@@ -99,6 +99,12 @@
LOG(ERROR) << "setpgid failed (" << strerror(error) << ")";
}
}
+ for (const auto& entry : inherited_fds) {
+ if (fcntl(entry.second, F_SETFD, 0)) {
+ int error_num = errno;
+ LOG(ERROR) << "fcntl failed: " << strerror(error_num);
+ }
+ }
int rval;
// If envp is NULL, the current process's environment is used as the
// environment of the child process. To force an empty emvironment for
@@ -248,8 +254,9 @@
if (inherited_fds_.count(shared_fd)) {
fd = inherited_fds_[shared_fd];
} else {
- fd = shared_fd->UNMANAGED_Dup();
+ fd = shared_fd->Fcntl(F_DUPFD_CLOEXEC, 3);
if (fd < 0) {
+ LOG(ERROR) << "Could not acquire a new file descriptor: " << shared_fd->StrError();
return false;
}
inherited_fds_[shared_fd] = fd;
@@ -268,8 +275,9 @@
<< static_cast<int>(channel);
return false;
}
- auto dup_fd = shared_fd->UNMANAGED_Dup();
+ auto dup_fd = shared_fd->Fcntl(F_DUPFD_CLOEXEC, 3);
if (dup_fd < 0) {
+ LOG(ERROR) << "Could not acquire a new file descriptor: " << shared_fd->StrError();
return false;
}
redirects_[channel] = dup_fd;
diff --git a/guest/monitoring/cuttlefish_service/Android.mk b/guest/monitoring/cuttlefish_service/Android.mk
index d1baf7d..2540ef5 100644
--- a/guest/monitoring/cuttlefish_service/Android.mk
+++ b/guest/monitoring/cuttlefish_service/Android.mk
@@ -23,6 +23,7 @@
LOCAL_SDK_VERSION := 28
LOCAL_PROGUARD_FLAGS := -include build/core/proguard.flags
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+LOCAL_PROGUARD_ENABLED := obfuscation
LOCAL_VENDOR_MODULE := true
include $(BUILD_PACKAGE)
diff --git a/guest/monitoring/cuttlefish_service/proguard.flags b/guest/monitoring/cuttlefish_service/proguard.flags
index c09a728..4578c0d 100644
--- a/guest/monitoring/cuttlefish_service/proguard.flags
+++ b/guest/monitoring/cuttlefish_service/proguard.flags
@@ -14,7 +14,7 @@
# Keep enough data for stack traces
-renamesourcefileattribute SourceFile
--keepattributes SourceFile,LineNumberTable,*Annotation*
+-keepattributes SourceFile,LineNumberTable,RuntimeVisible*Annotations,AnnotationDefault
# Keep classes and methods that have the guava @VisibleForTesting annotation
-keep @com.google.common.annotations.VisibleForTesting class *
@@ -24,3 +24,6 @@
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
+
+# -dontobfuscate
+-keep,allowshrinking class * { *; }
diff --git a/host/commands/assemble_cvd/super_image_mixer.cc b/host/commands/assemble_cvd/super_image_mixer.cc
index 2081af4..b2ec8c2 100644
--- a/host/commands/assemble_cvd/super_image_mixer.cc
+++ b/host/commands/assemble_cvd/super_image_mixer.cc
@@ -43,6 +43,9 @@
continue;
}
std::string expected_substr = "target_files-" + file_iter.second.build_id + ".zip";
+ if (expected_substr.size() > file_iter.first.size()) {
+ continue;
+ }
auto expected_pos = file_iter.first.size() - expected_substr.size();
if (file_iter.first.rfind(expected_substr) == expected_pos) {
return file_iter.first;
diff --git a/tests/hidl/hidl_implementation_test.cpp b/tests/hidl/hidl_implementation_test.cpp
index ae8c617..6e84d23 100644
--- a/tests/hidl/hidl_implementation_test.cpp
+++ b/tests/hidl/hidl_implementation_test.cpp
@@ -21,7 +21,7 @@
using namespace android;
-static std::set<std::string> kKnownMissing = {
+static const std::set<std::string> kKnownMissing = {
"android.frameworks.bufferhub@1.0",
"android.frameworks.cameraservice.device@2.0",
"android.frameworks.vr.composer@1.0",
@@ -82,7 +82,7 @@
"android.hardware.tv.tuner@1.0",
"android.hardware.usb@1.2",
"android.hardware.usb.gadget@1.0",
- "android.hardware.vibrator@1.4",
+ "android.hardware.vibrator@1.3",
"android.hardware.vr@1.0",
"android.hardware.weaver@1.0",
"android.hardware.wifi@1.3",
@@ -138,7 +138,7 @@
std::set<FQName> ret;
auto setInserter = [&] (const vintf::ManifestInstance& i) -> bool {
if (i.format() != vintf::HalFormat::HIDL) {
- std::cout << "[ WARNING ] Not checking non-HIDL instance: " << i.description() << std::endl;
+ std::cout << "[ WARNING ] Not checking non-HIDL instance: " << i.description() << std::endl;
return true; // continue
}
ret.insert(i.getFqInstance().getFqName());
@@ -156,7 +156,7 @@
}
TEST(Hidl, InterfacesImplemented) {
- // instances -> major version -> minor versions version
+ // instances -> major version -> minor versions
std::map<std::string, std::map<size_t, std::set<size_t>>> unimplemented;
for (const FQName& f : allTreeInterfaces()) {
@@ -165,7 +165,16 @@
unimplemented[f.package()][f.getPackageMajorVersion()].insert(f.getPackageMinorVersion());
}
+ // we'll be removing items from this which we know are missing
+ // in order to be left with those elements which we thought we
+ // knew were missing but are actually present
+ std::set<std::string> thoughtMissing = kKnownMissing;
+
for (const FQName& f : allManifestInstances()) {
+ if (thoughtMissing.erase(f.getPackageAndVersion().string()) > 0) {
+ std::cout << "[ WARNING ] Instance in missing list, but available: " << f.string() << std::endl;
+ }
+
std::set<size_t>& minors = unimplemented[f.package()][f.getPackageMajorVersion()];
size_t minor = f.getPackageMinorVersion();
@@ -185,9 +194,13 @@
FQName missing;
ASSERT_TRUE(missing.setTo(package, major, maxMinor));
- if (kKnownMissing.find(missing.string()) != kKnownMissing.end()) continue;
+ if (thoughtMissing.erase(missing.string()) > 0) continue;
ADD_FAILURE() << "Missing implementation from " << missing.string();
}
}
+
+ for (const std::string& missing : thoughtMissing) {
+ std::cout << "[ WARNING ] Instance in missing list, and cannot find it anywhere: " << missing << std::endl;
+ }
}
diff --git a/tools/create_base_image_arm.sh b/tools/create_base_image_arm.sh
index d79334b..87756df 100755
--- a/tools/create_base_image_arm.sh
+++ b/tools/create_base_image_arm.sh
@@ -219,11 +219,11 @@
setenv serverip ${TftpServer}
setenv loadaddr 0x00200000
mmc dev 0 0;
- file=$TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
- file=$UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
- file=$TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
- file=$RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
- file=$UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
+ setenv file $TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
+ setenv file $UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
+ setenv file $TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
+ setenv file $RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
+ setenv file $UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
mw.b ${scriptaddr} 0 0x8000
env export -b ${scriptaddr} 0x8000
mmc write ${scriptaddr} 0x1fc0 0x40
@@ -237,11 +237,11 @@
setenv serverip ${TftpServer}
setenv loadaddr 0x00200000
mmc dev 0 0;
- file=$TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
- file=$UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
- file=$TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
- file=$RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
- file=$UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
+ setenv file $TplSplImg; offset=0x40; size=0x1f80; run tftpget1; setenv TplSplImg
+ setenv file $UbootItb; offset=0x4000; size=0x2000; run tftpget1; setenv UbootItb
+ setenv file $TrustImg; offset=0x6000; size=0x2000; run tftpget1; setenv TrustImg
+ setenv file $RootfsImg; offset=0x8000; size=0; run tftpget1; setenv RootfsImg
+ setenv file $UbootEnv; offset=0x1fc0; size=0x40; run tftpget1; setenv UbootEnv
mw.b ${scriptaddr} 0 0x8000
env export -b ${scriptaddr} 0x8000
mmc write ${scriptaddr} 0x1fc0 0x40
@@ -249,32 +249,39 @@
echo "Already have ${Sha}. Booting..."
fi
else
- echo "Update ${Sha} isn't for me. Booting..."
+ echo "Update ${Sha} is not for me. Booting..."
fi'
-setenv tftpget1 "
-mw.b ${loadaddr} 0 0x400000
-&& tftp ${file}
-&& isGz=0 && setexpr isGz sub .*\\.gz\$ 1 ${file}
-&& if test $isGz = 1; then
- setexpr boffset ${offset} * 0x200
- && gzwrite mmc 0 ${loadaddr} 0x${filesize} 100000 ${boffset}
- && echo Updated: ${bootfile}
-elif test ${file} = boot.env; then
- env import -b ${loadaddr}
- && echo Updated: boot.env
-else
- && if test $size = 0; then
- setexpr x $filesize - 1
- && setexpr x $x / 0x1000
- && setexpr x $x + 1
- && setexpr x $x * 0x1000
- && setexpr x $x / 0x200
- && size=0x${x}
+setenv tftpget1 '
+if test "$file" != ""; then
+ mw.b ${loadaddr} 0 0x400000
+ tftp ${file}
+ if test $? = 0; then
+ setenv isGz 0 && setexpr isGz sub .*\\.gz\$ 1 ${file}
+ if test $isGz = 1; then
+ if test ${file} = ${UbootEnv}; then
+ echo "** gzipped env unsupported **"
+ else
+ setexpr boffset ${offset} * 0x200
+ gzwrite mmc 0 ${loadaddr} 0x${filesize} 100000 ${boffset} && echo Updated: ${file}
+ fi
+ elif test ${file} = ${UbootEnv}; then
+ env import -b ${loadaddr} && echo Updated: ${file}
+ else
+ if test $size = 0; then
+ setexpr x $filesize - 1
+ setexpr x $x / 0x1000
+ setexpr x $x + 1
+ setexpr x $x * 0x1000
+ setexpr x $x / 0x200
+ size=0x${x}
+ fi
+ mmc write ${loadaddr} ${offset} ${size} && echo Updated: ${file}
+ fi
fi
- && mmc write ${loadaddr} ${offset} ${size}
- && echo Updated: ${bootfile}
-fi
-|| echo ** UPDATE FAILED: ${bootfile} **"
+ if test $? != 0; then
+ echo ** UPDATE FAILED: ${file} **
+ fi
+fi'
if mmc dev 1 0; then; else
run bootcmd_dhcp;
fi
@@ -481,7 +488,7 @@
#!/bin/bash
echo "Installing cuttlefish-common package..."
echo "nameserver 8.8.8.8" > /etc/resolv.conf
-MAC=`ip link | grep eth0 -A1 | grep ether | sed 's/.*\(..:..:..:..:..:..\) .*/\1/'`
+MAC=`ip link | grep eth0 -A1 | grep ether | sed 's/.*\(..:..:..:..:..:..\) .*/\1/' | tr -d :`
sed -i " 1 s/.*/& rockpi-${MAC}/" /etc/hosts
sudo hostnamectl set-hostname "rockpi-${MAC}"
diff --git a/tools/make_manifest.sh b/tools/make_manifest.sh
index 3babc33..5b07d5d 100755
--- a/tools/make_manifest.sh
+++ b/tools/make_manifest.sh
@@ -69,19 +69,19 @@
echo "${key}=${value}" >> manifest.txt
}
-addSHAToManifest() {
- key="SHA"
+addShaToManifest() {
+ key="Sha"
cd "${ANDROID_BUILD_TOP}/device/google/cuttlefish_common"
- SHA=`git rev-parse HEAD`
+ Sha=`git rev-parse HEAD`
cd -
cd "${ANDROID_BUILD_TOP}/external/u-boot"
- SHA="$SHA,`git rev-parse HEAD`"
+ Sha="$Sha,`git rev-parse HEAD`"
cd -
cd "${ANDROID_BUILD_TOP}/external/arm-trusted-firmware"
- SHA="$SHA,`git rev-parse HEAD`"
+ Sha="$Sha,`git rev-parse HEAD`"
cd -
- addKVToManifest "${key}" "${SHA}"
+ addKVToManifest "${key}" "${Sha}"
}
addPathToManifest() {
@@ -116,4 +116,4 @@
addPathToManifest UbootEnv ${FLAGS_env}
addPathToManifest TplSplImg ${FLAGS_loader1}
addPathToManifest UbootItb ${FLAGS_loader2}
-addSHAToManifest
+addShaToManifest