Merge "liblp: Allow building liblp as a shared library."
diff --git a/adb/daemon/remount_service.cpp b/adb/daemon/remount_service.cpp
index 76a1452..6588587 100644
--- a/adb/daemon/remount_service.cpp
+++ b/adb/daemon/remount_service.cpp
@@ -216,7 +216,7 @@
}
void remount_service(unique_fd fd, const std::string& cmd) {
- bool user_requested_reboot = cmd != "-R";
+ bool user_requested_reboot = cmd == "-R";
if (getuid() != 0) {
WriteFdExactly(fd.get(), "Not running as root. Try \"adb root\" first.\n");
diff --git a/init/reboot.cpp b/init/reboot.cpp
index 6f6e39f..11507f4 100644
--- a/init/reboot.cpp
+++ b/init/reboot.cpp
@@ -443,6 +443,7 @@
for (const auto& s : ServiceList::GetInstance().services_in_shutdown_order()) {
if (!s->IsShutdownCritical()) s->Stop();
}
+ SubcontextTerminate();
ReapAnyOutstandingChildren();
// 3. send volume shutdown to vold
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index 267d530..ee72513 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -352,6 +352,7 @@
}
static std::vector<Subcontext> subcontexts;
+static bool shutting_down;
std::vector<Subcontext>* InitializeSubcontexts() {
if (SelinuxHasVendorInit()) {
@@ -365,12 +366,21 @@
bool SubcontextChildReap(pid_t pid) {
for (auto& subcontext : subcontexts) {
if (subcontext.pid() == pid) {
- subcontext.Restart();
+ if (!shutting_down) {
+ subcontext.Restart();
+ }
return true;
}
}
return false;
}
+void SubcontextTerminate() {
+ shutting_down = true;
+ for (auto& subcontext : subcontexts) {
+ kill(subcontext.pid(), SIGTERM);
+ }
+}
+
} // namespace init
} // namespace android
diff --git a/init/subcontext.h b/init/subcontext.h
index 22d7d43..628fd50 100644
--- a/init/subcontext.h
+++ b/init/subcontext.h
@@ -63,6 +63,7 @@
int SubcontextMain(int argc, char** argv, const KeywordFunctionMap* function_map);
std::vector<Subcontext>* InitializeSubcontexts();
bool SubcontextChildReap(pid_t pid);
+void SubcontextTerminate();
} // namespace init
} // namespace android
diff --git a/libsync/include/ndk/sync.h b/libsync/include/ndk/sync.h
index ba7d8c4..2a59e35 100644
--- a/libsync/include/ndk/sync.h
+++ b/libsync/include/ndk/sync.h
@@ -63,6 +63,8 @@
*
* The original fences remain valid, and the caller is responsible for closing
* them.
+ *
+ * Available since API level 26.
*/
int32_t sync_merge(const char* name, int32_t fd1, int32_t fd2) __INTRODUCED_IN(26);
@@ -70,6 +72,8 @@
* Retrieve detailed information about a sync file and its fences.
*
* The returned sync_file_info must be freed by calling sync_file_info_free().
+ *
+ * Available since API level 26.
*/
struct sync_file_info* sync_file_info(int32_t fd) __INTRODUCED_IN(26);
@@ -78,6 +82,8 @@
*
* The returned array is owned by the parent sync file info, and has
* info->num_fences entries.
+ *
+ * Available since API level 26.
*/
static inline struct sync_fence_info* sync_get_fence_info(const struct sync_file_info* info) {
// This header should compile in C, but some C++ projects enable
@@ -88,7 +94,11 @@
#pragma GCC diagnostic pop
}
-/** Free a struct sync_file_info structure */
+/**
+ * Free a struct sync_file_info structure
+ *
+ * Available since API level 26.
+ */
void sync_file_info_free(struct sync_file_info* info) __INTRODUCED_IN(26);
#endif /* __ANDROID_API__ >= 26 */