Merge "Build init with the bootstrap bionic libs"
diff --git a/adb/client/commandline.cpp b/adb/client/commandline.cpp
index ce51b1c..20fd036 100644
--- a/adb/client/commandline.cpp
+++ b/adb/client/commandline.cpp
@@ -192,7 +192,9 @@
" get-state print offline | bootloader | device\n"
" get-serialno print <serial-number>\n"
" get-devpath print <device-path>\n"
- " remount remount partitions read-write\n"
+ " remount [-R]\n"
+ " remount partitions read-write. if a reboot is required, -R will\n"
+ " will automatically reboot the device.\n"
" reboot [bootloader|recovery|sideload|sideload-auto-reboot]\n"
" reboot the device; defaults to booting system image but\n"
" supports bootloader and recovery too. sideload reboots\n"
diff --git a/adb/daemon/mdns.cpp b/adb/daemon/mdns.cpp
index 849378f..3530f48 100644
--- a/adb/daemon/mdns.cpp
+++ b/adb/daemon/mdns.cpp
@@ -74,7 +74,7 @@
if (error != kDNSServiceErr_NoError) {
LOG(ERROR) << "Could not register mDNS service (" << error << ").";
- mdns_registered = false;
+ return;
}
mdns_registered = true;
diff --git a/adb/daemon/remount_service.cpp b/adb/daemon/remount_service.cpp
index 80b3e06..3c9dd04 100644
--- a/adb/daemon/remount_service.cpp
+++ b/adb/daemon/remount_service.cpp
@@ -240,59 +240,57 @@
std::vector<std::string> partitions{"/", "/odm", "/oem", "/product_services",
"/product", "/vendor"};
- bool verity_enabled = (system_verified || vendor_verified);
+ if (system_verified || vendor_verified) {
+ // Disable verity automatically (reboot will be required).
+ set_verity_enabled_state_service(unique_fd(dup(fd.get())), false);
- // If we can use overlayfs, lets get it in place first
- // before we struggle with determining deduplication operations.
- if (!verity_enabled && fs_mgr_overlayfs_setup()) {
+ // If overlayfs is not supported, we try and remount or set up
+ // un-deduplication. If it is supported, we can go ahead and wait for
+ // a reboot.
+ if (fs_mgr_overlayfs_valid() != OverlayfsValidResult::kNotSupported) {
+ if (user_requested_reboot) {
+ if (android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot")) {
+ WriteFdExactly(fd.get(), "rebooting device\n");
+ } else {
+ WriteFdExactly(fd.get(), "reboot failed\n");
+ }
+ }
+ return;
+ }
+ } else if (fs_mgr_overlayfs_setup()) {
+ // If we can use overlayfs, lets get it in place first before we
+ // struggle with determining deduplication operations.
Fstab fstab;
if (ReadDefaultFstab(&fstab) && fs_mgr_overlayfs_mount_all(&fstab)) {
WriteFdExactly(fd.get(), "overlayfs mounted\n");
}
}
- // Find partitions that are deduplicated, and can be un-deduplicated.
+ // If overlayfs is supported, we don't bother trying to un-deduplicate
+ // partitions.
std::set<std::string> dedup;
- for (const auto& part : partitions) {
- auto partition = part;
- if ((part == "/") && !find_mount("/system", false).empty()) partition = "/system";
- std::string dev = find_mount(partition.c_str(), partition == "/");
- if (dev.empty() || !fs_mgr_has_shared_blocks(partition, dev)) {
- continue;
- }
- if (can_unshare_blocks(fd.get(), dev.c_str())) {
- dedup.emplace(partition);
- }
- }
-
- // Reboot now if the user requested it (and an operation needs a reboot).
- if (user_requested_reboot) {
- if (!dedup.empty() || verity_enabled) {
- if (verity_enabled) {
- set_verity_enabled_state_service(unique_fd(dup(fd.get())), false);
+ if (fs_mgr_overlayfs_valid() == OverlayfsValidResult::kNotSupported) {
+ // Find partitions that are deduplicated, and can be un-deduplicated.
+ for (const auto& part : partitions) {
+ auto partition = part;
+ if ((part == "/") && !find_mount("/system", false).empty()) partition = "/system";
+ std::string dev = find_mount(partition.c_str(), partition == "/");
+ if (dev.empty() || !fs_mgr_has_shared_blocks(partition, dev)) {
+ continue;
}
- reboot_for_remount(fd.get(), !dedup.empty());
- return;
+ if (can_unshare_blocks(fd.get(), dev.c_str())) {
+ dedup.emplace(partition);
+ }
}
- WriteFdExactly(fd.get(), "No reboot needed, skipping -R.\n");
- }
- // If we need to disable-verity, but we also need to perform a recovery
- // fsck for deduplicated partitions, hold off on warning about verity. We
- // can handle both verity and the recovery fsck in the same reboot cycle.
- if (verity_enabled && dedup.empty()) {
- // Allow remount but warn of likely bad effects
- bool both = system_verified && vendor_verified;
- WriteFdFmt(fd.get(), "dm_verity is enabled on the %s%s%s partition%s.\n",
- system_verified ? "system" : "", both ? " and " : "",
- vendor_verified ? "vendor" : "", both ? "s" : "");
- WriteFdExactly(fd.get(),
- "Use \"adb disable-verity\" to disable verity.\n"
- "If you do not, remount may succeed, however, you will still "
- "not be able to write to these volumes.\n");
- WriteFdExactly(fd.get(),
- "Alternately, use \"adb remount -R\" to disable verity "
- "and automatically reboot.\n");
+ // Reboot now if the user requested it (and an operation needs a reboot).
+ if (user_requested_reboot) {
+ if (!dedup.empty()) {
+ reboot_for_remount(fd.get(), !dedup.empty());
+ return;
+ }
+ WriteFdExactly(fd.get(), "No reboot needed, skipping -R.\n");
+ }
}
bool success = true;
diff --git a/fs_mgr/tests/adb-remount-test.sh b/fs_mgr/tests/adb-remount-test.sh
index 160e076..a849578 100755
--- a/fs_mgr/tests/adb-remount-test.sh
+++ b/fs_mgr/tests/adb-remount-test.sh
@@ -366,7 +366,7 @@
fi
D=`adb_sh df -k </dev/null` &&
H=`echo "${D}" | head -1` &&
- D=`echo "${D}" | grep "^overlay "` &&
+ D=`echo "${D}" | grep -v " /vendor/..*$" | grep "^overlay "` &&
echo "${H}" &&
echo "${D}" &&
echo "${ORANGE}[ WARNING ]${NORMAL} overlays present before setup" >&2 ||
@@ -410,7 +410,7 @@
fi
D=`adb_sh df -k </dev/null` &&
H=`echo "${D}" | head -1` &&
- D=`echo "${D}" | grep "^overlay " || true` &&
+ D=`echo "${D}" | grep -v " /vendor/..*$" | grep "^overlay " || true` &&
[ -z "${D}" ] ||
( echo "${H}" && echo "${D}" && false ) ||
die -t ${T} "overlay takeover unexpected at this phase"
@@ -443,7 +443,7 @@
echo "${H}"
D=`adb_sh df -k </dev/null` &&
H=`echo "${D}" | head -1` &&
- D=`echo "${D}" | grep "^overlay " || true` &&
+ D=`echo "${D}" | grep -v " /vendor/..*$" | grep "^overlay " || true` &&
[ -z "${D}" ] ||
( echo "${H}" && echo "${D}" && false ) ||
( [ -n "${L}" ] && echo "${L}" && false ) ||
@@ -463,7 +463,7 @@
die -t "${T}" "adb remount failed"
D=`adb_sh df -k </dev/null` &&
H=`echo "${D}" | head -1` &&
- D=`echo "${D}" | grep "^overlay "` ||
+ D=`echo "${D}" | grep -v " /vendor/..*$" | grep "^overlay "` ||
( [ -n "${L}" ] && echo "${L}" && false )
ret=${?}
uses_dynamic_scratch=false
@@ -506,7 +506,7 @@
echo "${D}" &&
echo "${D}" | grep "^overlay .* /system\$" >/dev/null ||
die "overlay takeover after remount"
- !(adb_sh grep "^overlay " /proc/mounts </dev/null | grep " overlay ro,") &&
+ !(adb_sh grep "^overlay " /proc/mounts </dev/null | grep -v "^overlay /vendor/..* overlay ro," | grep " overlay ro,") &&
!(adb_sh grep " rw," /proc/mounts </dev/null |
skip_administrative_mounts data) ||
die "remount overlayfs missed a spot (ro)"
@@ -539,7 +539,7 @@
if ${overlayfs_needed}; then
D=`adb_su df -k </dev/null` &&
H=`echo "${D}" | head -1` &&
- D=`echo "${D}" | grep "^overlay "` ||
+ D=`echo "${D}" | grep -v " /vendor/..*$" | grep "^overlay "` ||
( echo "${L}" && false ) ||
die -d "overlay takeover failed after reboot"
@@ -621,7 +621,7 @@
adb_root &&
D=`adb_sh df -k </dev/null` &&
H=`echo "${D}" | head -1` &&
- D=`echo "${D}" | grep "^overlay "` &&
+ D=`echo "${D}" | grep -v " /vendor/..*$" | grep "^overlay "` &&
echo "${H}" &&
echo "${D}" &&
echo "${D}" | grep "^overlay .* /system\$" >/dev/null ||
diff --git a/libcutils/include/cutils/trace.h b/libcutils/include/cutils/trace.h
index 58b9f09..79b4b35 100644
--- a/libcutils/include/cutils/trace.h
+++ b/libcutils/include/cutils/trace.h
@@ -75,7 +75,8 @@
#define ATRACE_TAG_VIBRATOR (1<<23)
#define ATRACE_TAG_AIDL (1<<24)
#define ATRACE_TAG_NNAPI (1<<25)
-#define ATRACE_TAG_LAST ATRACE_TAG_NNAPI
+#define ATRACE_TAG_RRO (1<<26)
+#define ATRACE_TAG_LAST ATRACE_TAG_RRO
// Reserved for initialization.
#define ATRACE_TAG_NOT_READY (1ULL<<63)