Merge "libutils: Cleanup unused class declaration"
diff --git a/adb/file_sync_service.cpp b/adb/file_sync_service.cpp
index c6f3e66..9a87931 100644
--- a/adb/file_sync_service.cpp
+++ b/adb/file_sync_service.cpp
@@ -62,7 +62,7 @@
}
vfs_cap_data cap_data = {};
- cap_data.magic_etc = VFS_CAP_REVISION | VFS_CAP_FLAGS_EFFECTIVE;
+ cap_data.magic_etc = VFS_CAP_REVISION_2 | VFS_CAP_FLAGS_EFFECTIVE;
cap_data.data[0].permitted = (capabilities & 0xffffffff);
cap_data.data[0].inheritable = 0;
cap_data.data[1].permitted = (capabilities >> 32);
diff --git a/fastboot/Android.mk b/fastboot/Android.mk
index 7723ec6..b0b2337 100644
--- a/fastboot/Android.mk
+++ b/fastboot/Android.mk
@@ -39,7 +39,7 @@
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_HOST_OS := darwin linux windows
LOCAL_CFLAGS += -Wall -Wextra -Werror -Wunreachable-code
-LOCAL_REQUIRED_MODULES := mke2fs e2fsdroid
+LOCAL_REQUIRED_MODULES := mke2fs e2fsdroid make_f2fs
LOCAL_SRC_FILES_linux := usb_linux.cpp
LOCAL_STATIC_LIBRARIES_linux := libselinux
@@ -66,8 +66,6 @@
libcutils \
libgtest_host \
-LOCAL_CFLAGS_linux := -DUSE_F2FS
-
LOCAL_CXX_STL := libc++_static
# Don't add anything here, we don't want additional shared dependencies
@@ -80,6 +78,7 @@
my_dist_files := $(LOCAL_BUILT_MODULE)
my_dist_files += $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX)
my_dist_files += $(HOST_OUT_EXECUTABLES)/e2fsdroid$(HOST_EXECUTABLE_SUFFIX)
+my_dist_files += $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
$(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files))
ifdef HOST_CROSS_OS
# Archive fastboot.exe for win_sdk build.
diff --git a/fastboot/fs.cpp b/fastboot/fs.cpp
index 8877b09..4141a3b 100644
--- a/fastboot/fs.cpp
+++ b/fastboot/fs.cpp
@@ -154,10 +154,10 @@
return 0;
}
-#ifdef USE_F2FS
static int generate_f2fs_image(const char* fileName, long long partSize, const std::string& initial_dir,
unsigned /* unused */, unsigned /* unused */)
{
+#ifndef WIN32
const std::string exec_dir = android::base::GetExecutableDirectory();
const std::string mkf2fs_path = exec_dir + "/make_f2fs";
std::vector<const char*> mkf2fs_args = {mkf2fs_path.c_str()};
@@ -180,12 +180,15 @@
}
if (!initial_dir.empty()) {
- fprintf(stderr, "Unable to set initial directory on F2FS filesystem: %s\n", strerror(errno));
- return -1;
+ fprintf(stderr, "sload.f2s not supported yet\n");
+ return 0;
}
return 0;
-}
+#else
+ fprintf(stderr, "make_f2fs not supported on Windows\n");
+ return -1;
#endif
+}
static const struct fs_generator {
const char* fs_type; //must match what fastboot reports for partition type
@@ -196,9 +199,7 @@
} generators[] = {
{ "ext4", generate_ext4_image},
-#ifdef USE_F2FS
{ "f2fs", generate_f2fs_image},
-#endif
};
const struct fs_generator* fs_get_generator(const std::string& fs_type) {
diff --git a/init/capabilities.cpp b/init/capabilities.cpp
index 642a364..50987db 100644
--- a/init/capabilities.cpp
+++ b/init/capabilities.cpp
@@ -194,5 +194,18 @@
return SetAmbientCaps(to_keep);
}
+bool DropInheritableCaps() {
+ ScopedCaps caps(cap_get_proc());
+ if (cap_clear_flag(caps.get(), CAP_INHERITABLE) == -1) {
+ PLOG(ERROR) << "cap_clear_flag(INHERITABLE) failed";
+ return false;
+ }
+ if (cap_set_proc(caps.get()) != 0) {
+ PLOG(ERROR) << "cap_set_proc() failed";
+ return false;
+ }
+ return true;
+}
+
} // namespace init
} // namespace android
diff --git a/init/capabilities.h b/init/capabilities.h
index ede85c3..fc80c98 100644
--- a/init/capabilities.h
+++ b/init/capabilities.h
@@ -35,6 +35,7 @@
bool CapAmbientSupported();
unsigned int GetLastValidCap();
bool SetCapsForExec(const CapSet& to_keep);
+bool DropInheritableCaps();
} // namespace init
} // namespace android
diff --git a/init/service.cpp b/init/service.cpp
index 481df65..331b859 100644
--- a/init/service.cpp
+++ b/init/service.cpp
@@ -291,6 +291,11 @@
if (!SetCapsForExec(capabilities_)) {
LOG(FATAL) << "cannot set capabilities for " << name_;
}
+ } else if (uid_) {
+ // Inheritable caps can be non-zero when running in a container.
+ if (!DropInheritableCaps()) {
+ LOG(FATAL) << "cannot drop inheritable caps for " << name_;
+ }
}
}
diff --git a/init/subcontext.cpp b/init/subcontext.cpp
index 84feeee..068be6e 100644
--- a/init/subcontext.cpp
+++ b/init/subcontext.cpp
@@ -23,7 +23,6 @@
#include <android-base/file.h>
#include <android-base/logging.h>
-#include <android-base/properties.h>
#include <android-base/strings.h>
#include <selinux/android.h>
@@ -32,7 +31,6 @@
#include "system/core/init/subcontext.pb.h"
#include "util.h"
-using android::base::GetBoolProperty;
using android::base::GetExecutablePath;
using android::base::Join;
using android::base::Socketpair;
@@ -262,13 +260,11 @@
static std::vector<Subcontext> subcontexts;
std::vector<Subcontext>* InitializeSubcontexts() {
- if (GetBoolProperty("ro.init.subcontexts_enabled", false)) {
- static const char* const paths_and_secontexts[][2] = {
- {"/vendor", kVendorContext.c_str()},
- };
- for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
- subcontexts.emplace_back(path_prefix, secontext);
- }
+ static const char* const paths_and_secontexts[][2] = {
+ {"/vendor", kVendorContext.c_str()},
+ };
+ for (const auto& [path_prefix, secontext] : paths_and_secontexts) {
+ subcontexts.emplace_back(path_prefix, secontext);
}
return &subcontexts;
}
diff --git a/rootdir/Android.mk b/rootdir/Android.mk
index d4de0ba..aa970d6 100644
--- a/rootdir/Android.mk
+++ b/rootdir/Android.mk
@@ -257,3 +257,45 @@
LOCAL_MODULE_STEM := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
endif
+
+#######################################
+# llndk.libraries.txt
+include $(CLEAR_VARS)
+LOCAL_MODULE := llndk.libraries.txt
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
+LOCAL_MODULE_STEM := $(LOCAL_MODULE)
+include $(BUILD_SYSTEM)/base_rules.mk
+llndk_md5 = $(word 1, $(shell echo $(LLNDK_LIBRARIES) | $(MD5SUM)))
+llndk_dep = $(intermediates)/$(llndk_md5).dep
+$(llndk_dep):
+ $(hide) mkdir -p $(dir $@) && rm -rf $(dir $@)*.dep && touch $@
+
+$(LOCAL_BUILT_MODULE): PRIVATE_LLNDK_LIBRARIES := $(LLNDK_LIBRARIES)
+$(LOCAL_BUILT_MODULE): $(llndk_dep)
+ @echo "Generate: $@"
+ @mkdir -p $(dir $@)
+ $(hide) echo -n > $@
+ $(hide) $(foreach lib,$(PRIVATE_LLNDK_LIBRARIES), \
+ echo $(lib).so >> $@;)
+
+#######################################
+# vndksp.libraries.txt
+include $(CLEAR_VARS)
+LOCAL_MODULE := vndksp.libraries.txt
+LOCAL_MODULE_CLASS := ETC
+LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)
+LOCAL_MODULE_STEM := $(LOCAL_MODULE)
+include $(BUILD_SYSTEM)/base_rules.mk
+vndksp_md5 = $(word 1, $(shell echo $(LLNDK_LIBRARIES) | $(MD5SUM)))
+vndksp_dep = $(intermediates)/$(vndksp_md5).dep
+$(vndksp_dep):
+ $(hide) mkdir -p $(dir $@) && rm -rf $(dir $@)*.dep && touch $@
+
+$(LOCAL_BUILT_MODULE): PRIVATE_VNDK_SAMEPROCESS_LIBRARIES := $(VNDK_SAMEPROCESS_LIBRARIES)
+$(LOCAL_BUILT_MODULE): $(vndksp_dep)
+ @echo "Generate: $@"
+ @mkdir -p $(dir $@)
+ $(hide) echo -n > $@
+ $(hide) $(foreach lib,$(PRIVATE_VNDK_SAMEPROCESS_LIBRARIES), \
+ echo $(lib).so >> $@;)
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 7eddf13..11b8383 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -433,6 +433,8 @@
mkdir /data/misc/update_engine 0700 root root
mkdir /data/misc/update_engine_log 02750 root log
mkdir /data/misc/trace 0700 root root
+ # create location to store surface and window trace files
+ mkdir /data/misc/wmtrace 0700 system system
# profile file layout
mkdir /data/misc/profiles 0771 system system
mkdir /data/misc/profiles/cur 0771 system system
@@ -482,6 +484,10 @@
mkdir /data/anr 0775 system system
+ # NFC: create data/nfc for nv storage
+ mkdir /data/nfc 0770 nfc nfc
+ mkdir /data/nfc/param 0770 nfc nfc
+
# Create all remaining /data root dirs so that they are made through init
# and get proper encryption policy installed
mkdir /data/backup 0700 system system
@@ -727,6 +733,8 @@
# Give writes to anyone for the trace folder on debug builds.
# The folder is used to store method traces.
chmod 0773 /data/misc/trace
+ # Give reads to anyone for the window trace folder on debug builds.
+ chmod 0775 /data/misc/wmtrace
start console
service flash_recovery /system/bin/install-recovery.sh