Merge "reboot: only pause indefinitely for non-shutdown operations"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 5b5eff4..304ce4e 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -60,3 +60,4 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib64/hw/gatekeeper.$(TARGET_DEVICE).so)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/vendor)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/init.rc)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/root)
diff --git a/adb/services.cpp b/adb/services.cpp
index ca34556..aff7012 100644
--- a/adb/services.cpp
+++ b/adb/services.cpp
@@ -58,6 +58,7 @@
#include "transport.h"
struct stinfo {
+ const char* service_name;
void (*func)(int fd, void *cookie);
int fd;
void *cookie;
@@ -65,7 +66,7 @@
static void service_bootstrap_func(void* x) {
stinfo* sti = reinterpret_cast<stinfo*>(x);
- adb_thread_setname(android::base::StringPrintf("service %d", sti->fd));
+ adb_thread_setname(android::base::StringPrintf("%s svc %d", sti->service_name, sti->fd));
sti->func(sti->fd, sti->cookie);
free(sti);
}
@@ -160,8 +161,7 @@
return true;
}
-void reboot_service(int fd, void* arg)
-{
+void reboot_service(int fd, void* arg) {
if (reboot_service_impl(fd, static_cast<const char*>(arg))) {
// Don't return early. Give the reboot command time to take effect
// to avoid messing up scripts which do "adb reboot && adb wait-for-device"
@@ -236,8 +236,7 @@
#endif // !ADB_HOST
-static int create_service_thread(void (*func)(int, void *), void *cookie)
-{
+static int create_service_thread(const char* service_name, void (*func)(int, void*), void* cookie) {
int s[2];
if (adb_socketpair(s)) {
printf("cannot create service socket pair\n");
@@ -258,6 +257,7 @@
if (sti == nullptr) {
fatal("cannot allocate stinfo");
}
+ sti->service_name = service_name;
sti->func = func;
sti->cookie = cookie;
sti->fd = s[1];
@@ -281,7 +281,7 @@
} else if(!strncmp("dev:", name, 4)) {
ret = unix_open(name + 4, O_RDWR | O_CLOEXEC);
} else if(!strncmp(name, "framebuffer:", 12)) {
- ret = create_service_thread(framebuffer_service, 0);
+ ret = create_service_thread("fb", framebuffer_service, nullptr);
} else if (!strncmp(name, "jdwp:", 5)) {
ret = create_jdwp_connection_fd(atoi(name+5));
} else if(!strncmp(name, "shell", 5)) {
@@ -289,17 +289,17 @@
} else if(!strncmp(name, "exec:", 5)) {
ret = StartSubprocess(name + 5, nullptr, SubprocessType::kRaw, SubprocessProtocol::kNone);
} else if(!strncmp(name, "sync:", 5)) {
- ret = create_service_thread(file_sync_service, NULL);
+ ret = create_service_thread("sync", file_sync_service, nullptr);
} else if(!strncmp(name, "remount:", 8)) {
- ret = create_service_thread(remount_service, NULL);
+ ret = create_service_thread("remount", remount_service, nullptr);
} else if(!strncmp(name, "reboot:", 7)) {
void* arg = strdup(name + 7);
if (arg == NULL) return -1;
- ret = create_service_thread(reboot_service, arg);
+ ret = create_service_thread("reboot", reboot_service, arg);
} else if(!strncmp(name, "root:", 5)) {
- ret = create_service_thread(restart_root_service, NULL);
+ ret = create_service_thread("root", restart_root_service, nullptr);
} else if(!strncmp(name, "unroot:", 7)) {
- ret = create_service_thread(restart_unroot_service, NULL);
+ ret = create_service_thread("unroot", restart_unroot_service, nullptr);
} else if(!strncmp(name, "backup:", 7)) {
ret = StartSubprocess(android::base::StringPrintf("/system/bin/bu backup %s",
(name + 7)).c_str(),
@@ -312,17 +312,20 @@
if (sscanf(name + 6, "%d", &port) != 1) {
return -1;
}
- ret = create_service_thread(restart_tcp_service, (void *) (uintptr_t) port);
+ ret = create_service_thread("tcp", restart_tcp_service, reinterpret_cast<void*>(port));
} else if(!strncmp(name, "usb:", 4)) {
- ret = create_service_thread(restart_usb_service, NULL);
+ ret = create_service_thread("usb", restart_usb_service, nullptr);
} else if (!strncmp(name, "reverse:", 8)) {
ret = reverse_service(name + 8);
} else if(!strncmp(name, "disable-verity:", 15)) {
- ret = create_service_thread(set_verity_enabled_state_service, (void*)0);
+ ret = create_service_thread("verity-on", set_verity_enabled_state_service,
+ reinterpret_cast<void*>(0));
} else if(!strncmp(name, "enable-verity:", 15)) {
- ret = create_service_thread(set_verity_enabled_state_service, (void*)1);
+ ret = create_service_thread("verity-off", set_verity_enabled_state_service,
+ reinterpret_cast<void*>(1));
} else if (!strcmp(name, "reconnect")) {
- ret = create_service_thread(reconnect_service, const_cast<atransport*>(transport));
+ ret = create_service_thread("reconnect", reconnect_service,
+ const_cast<atransport*>(transport));
#endif
}
if (ret >= 0) {
@@ -484,14 +487,14 @@
return nullptr;
}
- int fd = create_service_thread(wait_for_state, sinfo.get());
+ int fd = create_service_thread("wait", wait_for_state, sinfo.get());
if (fd != -1) {
sinfo.release();
}
return create_local_socket(fd);
} else if (!strncmp(name, "connect:", 8)) {
char* host = strdup(name + 8);
- int fd = create_service_thread(connect_service, host);
+ int fd = create_service_thread("connect", connect_service, host);
if (fd == -1) {
free(host);
}
diff --git a/adb/shell_service.cpp b/adb/shell_service.cpp
index ee821f8..5b48da0 100644
--- a/adb/shell_service.cpp
+++ b/adb/shell_service.cpp
@@ -435,8 +435,7 @@
void Subprocess::ThreadHandler(void* userdata) {
Subprocess* subprocess = reinterpret_cast<Subprocess*>(userdata);
- adb_thread_setname(android::base::StringPrintf(
- "shell srvc %d", subprocess->pid()));
+ adb_thread_setname(android::base::StringPrintf("shell svc %d", subprocess->pid()));
D("passing data streams for PID %d", subprocess->pid());
subprocess->PassDataStreams();
diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp
index 31c8803..bce245c 100644
--- a/fs_mgr/fs_mgr_fstab.cpp
+++ b/fs_mgr/fs_mgr_fstab.cpp
@@ -779,47 +779,21 @@
}
/*
- * Returns the 1st matching fstab_rec that follows the start_rec.
- * start_rec is the result of a previous search or NULL.
+ * Returns the fstab_rec* whose mount_point is path.
+ * Returns nullptr if not found.
*/
-struct fstab_rec* fs_mgr_get_entry_for_mount_point_after(struct fstab_rec* start_rec,
- struct fstab* fstab,
- const std::string& path) {
- int i;
+struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path) {
if (!fstab) {
return nullptr;
}
-
- if (start_rec) {
- for (i = 0; i < fstab->num_entries; i++) {
- if (&fstab->recs[i] == start_rec) {
- i++;
- break;
- }
- }
- } else {
- i = 0;
- }
-
- for (; i < fstab->num_entries; i++) {
+ for (int i = 0; i < fstab->num_entries; i++) {
if (fstab->recs[i].mount_point && path == fstab->recs[i].mount_point) {
return &fstab->recs[i];
}
}
-
return nullptr;
}
-/*
- * Returns the 1st matching mount point.
- * There might be more. To look for others, use fs_mgr_get_entry_for_mount_point_after()
- * and give the fstab_rec from the previous search.
- */
-struct fstab_rec *fs_mgr_get_entry_for_mount_point(struct fstab *fstab, const char *path)
-{
- return fs_mgr_get_entry_for_mount_point_after(NULL, fstab, path);
-}
-
int fs_mgr_is_voldmanaged(const struct fstab_rec *fstab)
{
return fstab->fs_mgr_flags & MF_VOLDMANAGED;
diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h
index 8a18ec0..ef51724 100644
--- a/fs_mgr/include_fstab/fstab/fstab.h
+++ b/fs_mgr/include_fstab/fstab/fstab.h
@@ -70,7 +70,6 @@
int fs_mgr_add_entry(struct fstab* fstab, const char* mount_point, const char* fs_type,
const char* blk_device);
-struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const char* path);
int fs_mgr_is_voldmanaged(const struct fstab_rec* fstab);
int fs_mgr_is_nonremovable(const struct fstab_rec* fstab);
int fs_mgr_is_verified(const struct fstab_rec* fstab);
@@ -95,6 +94,7 @@
// TODO: move this into separate header files under include/fs_mgr/*.h
#ifdef __cplusplus
std::string fs_mgr_get_slot_suffix();
+struct fstab_rec* fs_mgr_get_entry_for_mount_point(struct fstab* fstab, const std::string& path);
#endif
#endif /* __CORE_FS_TAB_H */
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 1185040..bab095e 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -80,7 +80,6 @@
{ 00775, AID_ROOT, AID_ROOT, 0, "data/preloads" },
{ 00771, AID_SYSTEM, AID_SYSTEM, 0, "data" },
{ 00755, AID_ROOT, AID_SYSTEM, 0, "mnt" },
- { 00755, AID_ROOT, AID_ROOT, 0, "root" },
{ 00750, AID_ROOT, AID_SHELL, 0, "sbin" },
{ 00777, AID_ROOT, AID_ROOT, 0, "sdcard" },
{ 00751, AID_ROOT, AID_SDCARD_R, 0, "storage" },
diff --git a/libsparse/Android.bp b/libsparse/Android.bp
index 6ec0991..b894656 100644
--- a/libsparse/Android.bp
+++ b/libsparse/Android.bp
@@ -15,19 +15,11 @@
cflags: ["-Werror"],
local_include_dirs: ["include"],
export_include_dirs: ["include"],
+ shared_libs: [
+ "libz",
+ "libbase",
+ ],
target: {
- host: {
- shared_libs: [
- "libz-host",
- "libbase",
- ],
- },
- android: {
- shared_libs: [
- "libz",
- "libbase",
- ],
- },
windows: {
enabled: true,
},
diff --git a/libziparchive/Android.bp b/libziparchive/Android.bp
index f395c74..e3faee3 100644
--- a/libziparchive/Android.bp
+++ b/libziparchive/Android.bp
@@ -69,11 +69,11 @@
shared_libs: [
"liblog",
"libbase",
+ "libz",
],
target: {
android: {
shared_libs: [
- "libz",
"libutils",
],
},
@@ -81,18 +81,8 @@
static_libs: ["libutils"],
},
linux_bionic: {
- static_libs: ["libz"],
enabled: true,
},
- linux: {
- shared_libs: ["libz-host"],
- },
- darwin: {
- shared_libs: ["libz-host"],
- },
- windows: {
- shared_libs: ["libz-host"],
- },
},
}
@@ -105,7 +95,7 @@
"libziparchive_defaults",
"libziparchive_flags",
],
- shared_libs: ["libz-host"],
+ shared_libs: ["libz"],
static_libs: ["libutils"],
}
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index 48a46c6..e199ed4 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -127,7 +127,7 @@
#
# create some directories (some are mount points) and symlinks
LOCAL_POST_INSTALL_CMD := mkdir -p $(addprefix $(TARGET_ROOT_OUT)/, \
- sbin dev proc sys system data oem acct config storage mnt root $(BOARD_ROOT_EXTRA_FOLDERS)); \
+ sbin dev proc sys system data oem acct config storage mnt $(BOARD_ROOT_EXTRA_FOLDERS)); \
ln -sf /system/etc $(TARGET_ROOT_OUT)/etc; \
ln -sf /data/user_de/0/com.android.shell/files/bugreports $(TARGET_ROOT_OUT)/bugreports; \
ln -sf /sys/kernel/debug $(TARGET_ROOT_OUT)/d; \