Loading fastboot/Android.mk +0 −10 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ LOCAL_CFLAGS += -DFASTBOOT_VERSION="\"$(tool_version)\"" LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../adb \ $(LOCAL_PATH)/../mkbootimg \ $(LOCAL_PATH)/../../extras/f2fs_utils \ LOCAL_SRC_FILES := \ bootimg_utils.cpp \ Loading Loading @@ -67,13 +66,7 @@ LOCAL_STATIC_LIBRARIES := \ libcutils \ libgtest_host \ # libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn") LOCAL_CFLAGS_linux := -DUSE_F2FS LOCAL_LDFLAGS_linux := -ldl -rdynamic -Wl,-rpath,. LOCAL_REQUIRED_MODULES_linux := libf2fs_fmt_host_dyn # The following libf2fs_* are from system/extras/f2fs_utils, # and do not use code in external/f2fs-tools. LOCAL_STATIC_LIBRARIES_linux += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host LOCAL_CXX_STL := libc++_static Loading @@ -87,9 +80,6 @@ include $(BUILD_HOST_EXECUTABLE) 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) ifeq ($(HOST_OS),linux) my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX) endif $(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files)) ifdef HOST_CROSS_OS # Archive fastboot.exe for win_sdk build. Loading fastboot/fs.cpp +22 −8 Original line number Diff line number Diff line #include "fs.h" #include "fastboot.h" #include "make_f2fs.h" #include <errno.h> #include <fcntl.h> Loading @@ -23,7 +22,6 @@ #include <android-base/file.h> #include <android-base/stringprintf.h> #include <android-base/unique_fd.h> #include <sparse/sparse.h> using android::base::StringPrintf; using android::base::unique_fd; Loading Loading @@ -160,16 +158,32 @@ static int generate_ext4_image(const char* fileName, long long partSize, static int generate_f2fs_image(const char* fileName, long long partSize, const std::string& initial_dir, unsigned /* unused */, unsigned /* unused */) { if (!initial_dir.empty()) { fprintf(stderr, "Unable to set initial directory on F2FS filesystem: %s\n", strerror(errno)); 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()}; mkf2fs_args.push_back("-S"); std::string size_str = std::to_string(partSize); mkf2fs_args.push_back(size_str.c_str()); mkf2fs_args.push_back("-f"); mkf2fs_args.push_back("-O"); mkf2fs_args.push_back("encrypt"); mkf2fs_args.push_back("-O"); mkf2fs_args.push_back("quota"); mkf2fs_args.push_back(fileName); mkf2fs_args.push_back(nullptr); int ret = exec_e2fs_cmd(mkf2fs_args[0], const_cast<char**>(mkf2fs_args.data())); if (ret != 0) { fprintf(stderr, "mkf2fs failed: %d\n", ret); return -1; } unique_fd fd(open(fileName, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)); if (fd == -1) { fprintf(stderr, "Unable to open output file for F2FS filesystem: %s\n", strerror(errno)); if (!initial_dir.empty()) { fprintf(stderr, "Unable to set initial directory on F2FS filesystem: %s\n", strerror(errno)); return -1; } return make_f2fs_sparse_fd(fd, partSize, NULL, NULL); return 0; } #endif Loading healthd/Health.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ namespace health { namespace V2_0 { namespace implementation { sp<Health> Health::instance_; Health::Health(struct healthd_config* c) { battery_monitor_ = std::make_unique<BatteryMonitor>(); battery_monitor_->init(c); Loading Loading @@ -154,7 +156,17 @@ void Health::serviceDied(uint64_t /* cookie */, const wp<IBase>& who) { (void)unregisterCallbackInternal(who.promote()); } // Methods from ::android::hidl::base::V1_0::IBase follow. sp<IHealth> Health::initInstance(struct healthd_config* c) { if (instance_ == nullptr) { instance_ = new Health(c); } return instance_; } sp<Health> Health::getImplementation() { CHECK(instance_ != nullptr); return instance_; } } // namespace implementation } // namespace V2_0 Loading healthd/HealthServiceCommon.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -33,9 +33,6 @@ using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo; using android::hardware::health::V2_0::IHealth; using android::hardware::health::V2_0::implementation::Health; // see healthd_common.cpp android::sp<IHealth> gHealth; extern int healthd_main(void); static void binder_event(uint32_t /*epevents*/) { Loading Loading @@ -63,8 +60,8 @@ void healthd_mode_service_2_0_init(struct healthd_config* config) { // TODO(b/68724651): healthd_board_* functions should be removed in health@2.0 healthd_board_init(config); gHealth = new ::android::hardware::health::V2_0::implementation::Health(config); CHECK_EQ(gHealth->registerAsService(HEALTH_INSTANCE_NAME), android::OK) android::sp<IHealth> service = Health::initInstance(config); CHECK_EQ(service->registerAsService(HEALTH_INSTANCE_NAME), android::OK) << LOG_TAG << ": Failed to register HAL"; LOG(INFO) << LOG_TAG << ": Hal init done"; Loading @@ -85,7 +82,7 @@ void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* HealthInfo info; convertToHealthInfo(prop, info); static_cast<Health*>(gHealth.get())->notifyListeners(info); Health::getImplementation()->notifyListeners(info); } static struct healthd_mode_ops healthd_mode_service_2_0_ops = { Loading healthd/healthd_common.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ static int wakealarm_wake_interval = DEFAULT_PERIODIC_CHORES_INTERVAL_FAST; #ifndef HEALTHD_USE_HEALTH_2_0 static BatteryMonitor* gBatteryMonitor = nullptr; #else extern sp<::android::hardware::health::V2_0::IHealth> gHealth; using ::android::hardware::health::V2_0::implementation::Health; #endif struct healthd_mode_ops *healthd_mode_ops = nullptr; Loading Loading @@ -160,42 +160,42 @@ status_t healthd_get_property(int id, struct BatteryProperty *val) { status_t err = UNKNOWN_ERROR; switch (id) { case BATTERY_PROP_CHARGE_COUNTER: { gHealth->getChargeCounter([&](Result r, int32_t v) { Health::getImplementation()->getChargeCounter([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_CURRENT_NOW: { gHealth->getCurrentNow([&](Result r, int32_t v) { Health::getImplementation()->getCurrentNow([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_CURRENT_AVG: { gHealth->getCurrentAverage([&](Result r, int32_t v) { Health::getImplementation()->getCurrentAverage([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_CAPACITY: { gHealth->getCapacity([&](Result r, int32_t v) { Health::getImplementation()->getCapacity([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_ENERGY_COUNTER: { gHealth->getEnergyCounter([&](Result r, int64_t v) { Health::getImplementation()->getEnergyCounter([&](Result r, int64_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_BATTERY_STATUS: { gHealth->getChargeStatus([&](Result r, BatteryStatus v) { Health::getImplementation()->getChargeStatus([&](Result r, BatteryStatus v) { err = convertStatus(r); val->valueInt64 = static_cast<int64_t>(v); }); Loading Loading @@ -237,7 +237,7 @@ void healthd_battery_update(void) { #ifndef HEALTHD_USE_HEALTH_2_0 healthd_battery_update_internal(gBatteryMonitor->update()); #else gHealth->update(); Health::getImplementation()->update(); #endif } Loading @@ -249,7 +249,7 @@ void healthd_dump_battery_state(int fd) { nativeHandle->data[0] = fd; ::android::hardware::hidl_handle handle; handle.setTo(nativeHandle, true /* shouldOwn */); gHealth->debug(handle, {} /* options */); Health::getImplementation()->debug(handle, {} /* options */); #endif fsync(fd); Loading Loading
fastboot/Android.mk +0 −10 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ LOCAL_CFLAGS += -DFASTBOOT_VERSION="\"$(tool_version)\"" LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/../adb \ $(LOCAL_PATH)/../mkbootimg \ $(LOCAL_PATH)/../../extras/f2fs_utils \ LOCAL_SRC_FILES := \ bootimg_utils.cpp \ Loading Loading @@ -67,13 +66,7 @@ LOCAL_STATIC_LIBRARIES := \ libcutils \ libgtest_host \ # libf2fs_dlutils_host will dlopen("libf2fs_fmt_host_dyn") LOCAL_CFLAGS_linux := -DUSE_F2FS LOCAL_LDFLAGS_linux := -ldl -rdynamic -Wl,-rpath,. LOCAL_REQUIRED_MODULES_linux := libf2fs_fmt_host_dyn # The following libf2fs_* are from system/extras/f2fs_utils, # and do not use code in external/f2fs-tools. LOCAL_STATIC_LIBRARIES_linux += libf2fs_utils_host libf2fs_ioutils_host libf2fs_dlutils_host LOCAL_CXX_STL := libc++_static Loading @@ -87,9 +80,6 @@ include $(BUILD_HOST_EXECUTABLE) 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) ifeq ($(HOST_OS),linux) my_dist_files += $(HOST_LIBRARY_PATH)/libf2fs_fmt_host_dyn$(HOST_SHLIB_SUFFIX) endif $(call dist-for-goals,dist_files sdk win_sdk,$(my_dist_files)) ifdef HOST_CROSS_OS # Archive fastboot.exe for win_sdk build. Loading
fastboot/fs.cpp +22 −8 Original line number Diff line number Diff line #include "fs.h" #include "fastboot.h" #include "make_f2fs.h" #include <errno.h> #include <fcntl.h> Loading @@ -23,7 +22,6 @@ #include <android-base/file.h> #include <android-base/stringprintf.h> #include <android-base/unique_fd.h> #include <sparse/sparse.h> using android::base::StringPrintf; using android::base::unique_fd; Loading Loading @@ -160,16 +158,32 @@ static int generate_ext4_image(const char* fileName, long long partSize, static int generate_f2fs_image(const char* fileName, long long partSize, const std::string& initial_dir, unsigned /* unused */, unsigned /* unused */) { if (!initial_dir.empty()) { fprintf(stderr, "Unable to set initial directory on F2FS filesystem: %s\n", strerror(errno)); 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()}; mkf2fs_args.push_back("-S"); std::string size_str = std::to_string(partSize); mkf2fs_args.push_back(size_str.c_str()); mkf2fs_args.push_back("-f"); mkf2fs_args.push_back("-O"); mkf2fs_args.push_back("encrypt"); mkf2fs_args.push_back("-O"); mkf2fs_args.push_back("quota"); mkf2fs_args.push_back(fileName); mkf2fs_args.push_back(nullptr); int ret = exec_e2fs_cmd(mkf2fs_args[0], const_cast<char**>(mkf2fs_args.data())); if (ret != 0) { fprintf(stderr, "mkf2fs failed: %d\n", ret); return -1; } unique_fd fd(open(fileName, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)); if (fd == -1) { fprintf(stderr, "Unable to open output file for F2FS filesystem: %s\n", strerror(errno)); if (!initial_dir.empty()) { fprintf(stderr, "Unable to set initial directory on F2FS filesystem: %s\n", strerror(errno)); return -1; } return make_f2fs_sparse_fd(fd, partSize, NULL, NULL); return 0; } #endif Loading
healthd/Health.cpp +13 −1 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ namespace health { namespace V2_0 { namespace implementation { sp<Health> Health::instance_; Health::Health(struct healthd_config* c) { battery_monitor_ = std::make_unique<BatteryMonitor>(); battery_monitor_->init(c); Loading Loading @@ -154,7 +156,17 @@ void Health::serviceDied(uint64_t /* cookie */, const wp<IBase>& who) { (void)unregisterCallbackInternal(who.promote()); } // Methods from ::android::hidl::base::V1_0::IBase follow. sp<IHealth> Health::initInstance(struct healthd_config* c) { if (instance_ == nullptr) { instance_ = new Health(c); } return instance_; } sp<Health> Health::getImplementation() { CHECK(instance_ != nullptr); return instance_; } } // namespace implementation } // namespace V2_0 Loading
healthd/HealthServiceCommon.cpp +3 −6 Original line number Diff line number Diff line Loading @@ -33,9 +33,6 @@ using android::hardware::health::V1_0::hal_conversion::convertToHealthInfo; using android::hardware::health::V2_0::IHealth; using android::hardware::health::V2_0::implementation::Health; // see healthd_common.cpp android::sp<IHealth> gHealth; extern int healthd_main(void); static void binder_event(uint32_t /*epevents*/) { Loading Loading @@ -63,8 +60,8 @@ void healthd_mode_service_2_0_init(struct healthd_config* config) { // TODO(b/68724651): healthd_board_* functions should be removed in health@2.0 healthd_board_init(config); gHealth = new ::android::hardware::health::V2_0::implementation::Health(config); CHECK_EQ(gHealth->registerAsService(HEALTH_INSTANCE_NAME), android::OK) android::sp<IHealth> service = Health::initInstance(config); CHECK_EQ(service->registerAsService(HEALTH_INSTANCE_NAME), android::OK) << LOG_TAG << ": Failed to register HAL"; LOG(INFO) << LOG_TAG << ": Hal init done"; Loading @@ -85,7 +82,7 @@ void healthd_mode_service_2_0_battery_update(struct android::BatteryProperties* HealthInfo info; convertToHealthInfo(prop, info); static_cast<Health*>(gHealth.get())->notifyListeners(info); Health::getImplementation()->notifyListeners(info); } static struct healthd_mode_ops healthd_mode_service_2_0_ops = { Loading
healthd/healthd_common.cpp +9 −9 Original line number Diff line number Diff line Loading @@ -91,7 +91,7 @@ static int wakealarm_wake_interval = DEFAULT_PERIODIC_CHORES_INTERVAL_FAST; #ifndef HEALTHD_USE_HEALTH_2_0 static BatteryMonitor* gBatteryMonitor = nullptr; #else extern sp<::android::hardware::health::V2_0::IHealth> gHealth; using ::android::hardware::health::V2_0::implementation::Health; #endif struct healthd_mode_ops *healthd_mode_ops = nullptr; Loading Loading @@ -160,42 +160,42 @@ status_t healthd_get_property(int id, struct BatteryProperty *val) { status_t err = UNKNOWN_ERROR; switch (id) { case BATTERY_PROP_CHARGE_COUNTER: { gHealth->getChargeCounter([&](Result r, int32_t v) { Health::getImplementation()->getChargeCounter([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_CURRENT_NOW: { gHealth->getCurrentNow([&](Result r, int32_t v) { Health::getImplementation()->getCurrentNow([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_CURRENT_AVG: { gHealth->getCurrentAverage([&](Result r, int32_t v) { Health::getImplementation()->getCurrentAverage([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_CAPACITY: { gHealth->getCapacity([&](Result r, int32_t v) { Health::getImplementation()->getCapacity([&](Result r, int32_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_ENERGY_COUNTER: { gHealth->getEnergyCounter([&](Result r, int64_t v) { Health::getImplementation()->getEnergyCounter([&](Result r, int64_t v) { err = convertStatus(r); val->valueInt64 = v; }); break; } case BATTERY_PROP_BATTERY_STATUS: { gHealth->getChargeStatus([&](Result r, BatteryStatus v) { Health::getImplementation()->getChargeStatus([&](Result r, BatteryStatus v) { err = convertStatus(r); val->valueInt64 = static_cast<int64_t>(v); }); Loading Loading @@ -237,7 +237,7 @@ void healthd_battery_update(void) { #ifndef HEALTHD_USE_HEALTH_2_0 healthd_battery_update_internal(gBatteryMonitor->update()); #else gHealth->update(); Health::getImplementation()->update(); #endif } Loading @@ -249,7 +249,7 @@ void healthd_dump_battery_state(int fd) { nativeHandle->data[0] = fd; ::android::hardware::hidl_handle handle; handle.setTo(nativeHandle, true /* shouldOwn */); gHealth->debug(handle, {} /* options */); Health::getImplementation()->debug(handle, {} /* options */); #endif fsync(fd); Loading