diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index 7df7cfd99b30..b7145d53814c 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -329,6 +329,8 @@ void ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { } } else if (StartsWith(flag, "zram_backing_dev_path=")) { entry->zram_backing_dev_path = arg; + } else if (StartsWith(flag, "wrappedkey")) { + entry->fs_mgr_flags.wrappedkey = true; } else { LWARNING << "Warning: unknown flag: " << flag; } diff --git a/fs_mgr/fs_mgr_roots.cpp b/fs_mgr/fs_mgr_roots.cpp index 58ef9b6cd309..04030880e1df 100644 --- a/fs_mgr/fs_mgr_roots.cpp +++ b/fs_mgr/fs_mgr_roots.cpp @@ -117,18 +117,7 @@ bool EnsurePathMounted(Fstab* fstab, const std::string& path, const std::string& return false; } - int result = fs_mgr_do_mount_one(*rec, mount_point); - if (result == -1 && rec->fs_mgr_flags.formattable) { - PERROR << "Failed to mount " << mount_point << "; formatting"; - bool crypt_footer = rec->is_encryptable() && rec->key_loc == "footer"; - if (fs_mgr_do_format(*rec, crypt_footer) != 0) { - PERROR << "Failed to format " << mount_point; - return false; - } - result = fs_mgr_do_mount_one(*rec, mount_point); - } - - if (result == -1) { + if (fs_mgr_do_mount_one(*rec, mount_point) == -1) { PERROR << "Failed to mount " << mount_point; return false; } diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h index d7afed654892..9ab8ddc02a50 100644 --- a/fs_mgr/include_fstab/fstab/fstab.h +++ b/fs_mgr/include_fstab/fstab/fstab.h @@ -84,6 +84,7 @@ struct FstabEntry { bool first_stage_mount : 1; bool slot_select_other : 1; bool fs_verity : 1; + bool wrappedkey : 1; } fs_mgr_flags = {}; bool is_encryptable() const { diff --git a/healthd/Android.mk b/healthd/Android.mk index 05123af80d35..4eb98dae0d48 100644 --- a/healthd/Android.mk +++ b/healthd/Android.mk @@ -200,8 +200,13 @@ include $$(BUILD_PREBUILT) endef _img_modules := +ifeq ($(strip $(BOARD_HEALTHD_CUSTOM_CHARGER_RES)),) +IMAGES_DIR := images +else +IMAGES_DIR := ../../../$(BOARD_HEALTHD_CUSTOM_CHARGER_RES) +endif _images := -$(foreach _img, $(call find-subdir-subdir-files, "images", "*.png"), \ +$(foreach _img, $(call find-subdir-subdir-files, "$(IMAGES_DIR)", "*.png"), \ $(eval $(call _add-charger-image,$(_img)))) include $(CLEAR_VARS) diff --git a/healthd/BatteryMonitor.cpp b/healthd/BatteryMonitor.cpp index 06c8176e9588..5b24b23a9db3 100644 --- a/healthd/BatteryMonitor.cpp +++ b/healthd/BatteryMonitor.cpp @@ -158,12 +158,14 @@ BatteryMonitor::PowerSupplyType BatteryMonitor::readPowerSupplyType(const String { "USB", ANDROID_POWER_SUPPLY_TYPE_USB }, { "USB_DCP", ANDROID_POWER_SUPPLY_TYPE_AC }, { "USB_HVDCP", ANDROID_POWER_SUPPLY_TYPE_AC }, + { "USB_HVDCP_3", ANDROID_POWER_SUPPLY_TYPE_AC }, { "USB_CDP", ANDROID_POWER_SUPPLY_TYPE_AC }, { "USB_ACA", ANDROID_POWER_SUPPLY_TYPE_AC }, { "USB_C", ANDROID_POWER_SUPPLY_TYPE_AC }, { "USB_PD", ANDROID_POWER_SUPPLY_TYPE_AC }, { "USB_PD_DRP", ANDROID_POWER_SUPPLY_TYPE_USB }, { "Wireless", ANDROID_POWER_SUPPLY_TYPE_WIRELESS }, + { "DASH", ANDROID_POWER_SUPPLY_TYPE_AC }, { NULL, 0 }, }; @@ -244,6 +246,40 @@ bool BatteryMonitor::update(void) { double MaxPower = 0; + // Rescan for the available charger types + std::unique_ptr dir(opendir(POWER_SUPPLY_SYSFS_PATH), closedir); + if (dir == NULL) { + KLOG_ERROR(LOG_TAG, "Could not open %s\n", POWER_SUPPLY_SYSFS_PATH); + } else { + struct dirent* entry; + String8 path; + + mChargerNames.clear(); + + while ((entry = readdir(dir.get()))) { + const char* name = entry->d_name; + + if (!strcmp(name, ".") || !strcmp(name, "..")) + continue; + + // Look for "type" file in each subdirectory + path.clear(); + path.appendFormat("%s/%s/type", POWER_SUPPLY_SYSFS_PATH, name); + switch(BatteryMonitor::readPowerSupplyType(path)) { + case ANDROID_POWER_SUPPLY_TYPE_AC: + case ANDROID_POWER_SUPPLY_TYPE_USB: + case ANDROID_POWER_SUPPLY_TYPE_WIRELESS: + path.clear(); + path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, name); + if (access(path.string(), R_OK) == 0) + mChargerNames.add(String8(name)); + break; + default: + break; + } + } + } + for (size_t i = 0; i < mChargerNames.size(); i++) { String8 path; path.appendFormat("%s/%s/online", POWER_SUPPLY_SYSFS_PATH, @@ -280,6 +316,11 @@ bool BatteryMonitor::update(void) { (access(path.string(), R_OK) == 0) ? getIntField(path) : DEFAULT_VBUS_VOLTAGE; + // there are devices that have the file but with a value of 0 + if (ChargingVoltage == 0) { + ChargingVoltage = DEFAULT_VBUS_VOLTAGE; + } + double power = ((double)ChargingCurrent / MILLION) * ((double)ChargingVoltage / MILLION); if (MaxPower < power) { diff --git a/init/Android.bp b/init/Android.bp index 6be7290e3278..ac95f288d445 100644 --- a/init/Android.bp +++ b/init/Android.bp @@ -26,7 +26,7 @@ cc_defaults { "-Wextra", "-Wno-unused-parameter", "-Werror", - "-DALLOW_LOCAL_PROP_OVERRIDE=0", + "-DALLOW_LOCAL_PROP_OVERRIDE=1", "-DALLOW_PERMISSIVE_SELINUX=0", "-DREBOOT_BOOTLOADER_ON_PANIC=0", "-DWORLD_WRITABLE_KMSG=0", @@ -136,6 +136,7 @@ cc_library_static { "ueventd.cpp", "ueventd_parser.cpp", "util.cpp", + "vendor_init.cpp", ], whole_static_libs: ["libcap", "com.android.sysprop.apex"], header_libs: ["bootimg_headers"], @@ -150,6 +151,14 @@ cc_library_static { exclude_shared_libs: ["libbinder", "libutils"], }, }, + + product_variables: { + rr: { + target_init_vendor_lib: { + whole_static_libs: ["%s"], + }, + }, + }, } cc_binary { diff --git a/init/Android.mk b/init/Android.mk index c4f7d34b2d7d..4f29b68a929f 100644 --- a/init/Android.mk +++ b/init/Android.mk @@ -113,6 +113,7 @@ LOCAL_STATIC_LIBRARIES := \ LOCAL_SANITIZE := signed-integer-overflow # First stage init is weird: it may start without stdout/stderr, and no /proc. LOCAL_NOSANITIZE := hwaddress + include $(BUILD_EXECUTABLE) endif diff --git a/init/NOTICE b/init/NOTICE index c5b1efa7aac7..383d0f5418a6 100644 --- a/init/NOTICE +++ b/init/NOTICE @@ -188,3 +188,29 @@ END OF TERMS AND CONDITIONS +Copyright (c) 2013, The Linux Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/init/property_service.cpp b/init/property_service.cpp index f2c7462abf02..470f6e06c46e 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -64,6 +64,7 @@ #include "selinux.h" #include "subcontext.h" #include "util.h" +#include "vendor_init.h" using namespace std::literals; @@ -912,6 +913,9 @@ void property_load_boot_defaults(bool load_debug_prop) { } } + // Update with vendor-specific property runtime overrides + vendor_load_properties(); + property_initialize_ro_product_props(); property_derive_build_fingerprint(); diff --git a/init/service.cpp b/init/service.cpp index ccc37b70cb40..ad9a3e0aff27 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -94,11 +94,16 @@ static Result ComputeContextFromExecutable(const std::string& servi free(new_con); } if (rc == 0 && computed_context == mycon.get()) { - return Error() << "File " << service_path << "(labeled \"" << filecon.get() - << "\") has incorrect label or no domain transition from " << mycon.get() - << " to another SELinux domain defined. Have you configured your " - "service correctly? https://source.android.com/security/selinux/" - "device-policy#label_new_services_and_address_denials"; + std::string error = StringPrintf( + "File %s (labeled \"%s\") has incorrect label or no domain transition from %s to " + "another SELinux domain defined. Have you configured your " + "service correctly? https://source.android.com/security/selinux/" + "device-policy#label_new_services_and_address_denials", + service_path.c_str(), filecon.get(), mycon.get()); + if (selinux_status_getenforce() > 0) { + return Error() << error; + } + LOG(ERROR) << error; } if (rc < 0) { return Error() << "Could not get process context"; diff --git a/init/ueventd.cpp b/init/ueventd.cpp index 399ea4c5c2b4..2668b6575f79 100644 --- a/init/ueventd.cpp +++ b/init/ueventd.cpp @@ -17,12 +17,15 @@ #include "ueventd.h" #include +#include #include #include #include #include #include +#include #include +#include #include #include @@ -120,8 +123,9 @@ class ColdBoot { void UeventHandlerMain(unsigned int process_num, unsigned int total_processes); void RegenerateUevents(); void ForkSubProcesses(); - void DoRestoreCon(); void WaitForSubProcesses(); + void RestoreConHandler(unsigned int process_num, unsigned int total_processes); + void GenerateRestoreCon(const std::string& directory); UeventListener& uevent_listener_; std::vector>& uevent_handlers_; @@ -130,6 +134,8 @@ class ColdBoot { std::vector uevent_queue_; std::set subprocess_pids_; + + std::vector restorecon_queue_; }; void ColdBoot::UeventHandlerMain(unsigned int process_num, unsigned int total_processes) { @@ -140,9 +146,38 @@ void ColdBoot::UeventHandlerMain(unsigned int process_num, unsigned int total_pr uevent_handler->HandleUevent(uevent); } } +} + +void ColdBoot::RestoreConHandler(unsigned int process_num, unsigned int total_processes) { + for (unsigned int i = process_num; i < restorecon_queue_.size(); i += total_processes) { + auto& dir = restorecon_queue_[i]; + + selinux_android_restorecon(dir.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE); + } _exit(EXIT_SUCCESS); } +void ColdBoot::GenerateRestoreCon(const std::string& directory) { + std::unique_ptr dir(opendir(directory.c_str()), &closedir); + + if (!dir) return; + + struct dirent* dent; + while ((dent = readdir(dir.get())) != NULL) { + if (strcmp(dent->d_name, ".") == 0 || strcmp(dent->d_name, "..") == 0) continue; + + struct stat st; + if (fstatat(dirfd(dir.get()), dent->d_name, &st, 0) == -1) continue; + + if (S_ISDIR(st.st_mode)) { + std::string fullpath = directory + "/" + dent->d_name; + if (fullpath != "/sys/devices") { + restorecon_queue_.emplace_back(fullpath); + } + } + } +} + void ColdBoot::RegenerateUevents() { uevent_listener_.RegenerateUevents([this](const Uevent& uevent) { uevent_queue_.emplace_back(std::move(uevent)); @@ -159,16 +194,13 @@ void ColdBoot::ForkSubProcesses() { if (pid == 0) { UeventHandlerMain(i, num_handler_subprocesses_); + RestoreConHandler(i, num_handler_subprocesses_); } subprocess_pids_.emplace(pid); } } -void ColdBoot::DoRestoreCon() { - selinux_android_restorecon("/sys", SELINUX_ANDROID_RESTORECON_RECURSE); -} - void ColdBoot::WaitForSubProcesses() { // Treat subprocesses that crash or get stuck the same as if ueventd itself has crashed or gets // stuck. @@ -207,9 +239,13 @@ void ColdBoot::Run() { RegenerateUevents(); - ForkSubProcesses(); + selinux_android_restorecon("/sys", 0); + selinux_android_restorecon("/sys/devices", 0); + GenerateRestoreCon("/sys"); + // takes long time for /sys/devices, parallelize it + GenerateRestoreCon("/sys/devices"); - DoRestoreCon(); + ForkSubProcesses(); WaitForSubProcesses(); diff --git a/init/vendor_init.cpp b/init/vendor_init.cpp new file mode 100644 index 000000000000..d3fd5ffe2be9 --- /dev/null +++ b/init/vendor_init.cpp @@ -0,0 +1,37 @@ +/* +Copyright (c) 2013, The Linux Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "vendor_init.h" + +/* init vendor override stubs */ + +__attribute__ ((weak)) +void vendor_load_properties() +{ +} diff --git a/init/vendor_init.h b/init/vendor_init.h new file mode 100644 index 000000000000..9afb449be013 --- /dev/null +++ b/init/vendor_init.h @@ -0,0 +1,33 @@ +/* +Copyright (c) 2013, The Linux Foundation. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of The Linux Foundation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __INIT_VENDOR__H__ +#define __INIT_VENDOR__H__ +extern void vendor_load_properties(void); +#endif /* __INIT_VENDOR__H__ */ diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp index a5f4f0e5579d..27e450bee9e6 100644 --- a/libcutils/fs_config.cpp +++ b/libcutils/fs_config.cpp @@ -220,6 +220,7 @@ static const struct fs_path_config android_files[] = { { 00755, AID_ROOT, AID_SHELL, 0, "product/bin/*" }, { 00750, AID_ROOT, AID_SHELL, 0, "sbin/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "system/bin/*" }, + { 00755, AID_ROOT, AID_SHELL, 0, "system/etc/init.d/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "system/apex/*/bin/*" }, { 00755, AID_ROOT, AID_SHELL, 0, "vendor/bin/*" }, diff --git a/libsystem/include/system/camera.h b/libsystem/include/system/camera.h index 2ca90c395ba1..1b5154e3c028 100644 --- a/libsystem/include/system/camera.h +++ b/libsystem/include/system/camera.h @@ -88,9 +88,20 @@ enum { // Notify on autofocus start and stop. This is useful in continuous // autofocus - FOCUS_MODE_CONTINUOUS_VIDEO and FOCUS_MODE_CONTINUOUS_PICTURE. CAMERA_MSG_FOCUS_MOVE = 0x0800, // notifyCallback + CAMERA_MSG_VENDOR_START = 0x1000, + CAMERA_MSG_STATS_DATA = CAMERA_MSG_VENDOR_START, + CAMERA_MSG_META_DATA = 0x2000, + CAMERA_MSG_VENDOR_END = 0x8000, CAMERA_MSG_ALL_MSGS = 0xFFFF }; +/** meta data type in CameraMetaDataCallback */ +enum { + CAMERA_META_DATA_ASD = 0x001, //ASD data + CAMERA_META_DATA_FD = 0x002, //FD/FP data + CAMERA_META_DATA_HDR = 0x003, //Auto HDR data +}; + /** cmdType in sendCommand functions */ enum { CAMERA_CMD_START_SMOOTH_ZOOM = 1, @@ -189,7 +200,40 @@ enum { * IMPLEMENTATION_DEFINED, then HALv3 devices will use gralloc usage flags * of SW_READ_OFTEN. */ - CAMERA_CMD_SET_VIDEO_FORMAT = 11 +#ifndef CAMERA_VENDOR_L_COMPAT + CAMERA_CMD_SET_VIDEO_FORMAT = 11, + + CAMERA_CMD_VENDOR_START = 20, + /** + * Commands to enable/disable preview histogram + * + * Based on user's input to enable/disable histogram from the camera + * UI, send the appropriate command to the HAL to turn on/off the histogram + * stats and start sending the data to the application. + */ + CAMERA_CMD_HISTOGRAM_ON = CAMERA_CMD_VENDOR_START, + CAMERA_CMD_HISTOGRAM_OFF = CAMERA_CMD_VENDOR_START + 1, + CAMERA_CMD_HISTOGRAM_SEND_DATA = CAMERA_CMD_VENDOR_START + 2, + CAMERA_CMD_LONGSHOT_ON = CAMERA_CMD_VENDOR_START + 3, + CAMERA_CMD_LONGSHOT_OFF = CAMERA_CMD_VENDOR_START + 4, + CAMERA_CMD_STOP_LONGSHOT = CAMERA_CMD_VENDOR_START + 5, + CAMERA_CMD_METADATA_ON = CAMERA_CMD_VENDOR_START + 6, + CAMERA_CMD_METADATA_OFF = CAMERA_CMD_VENDOR_START + 7, + CAMERA_CMD_VENDOR_END = 200, +#else + /** + * Values used by older HALs, provided as an option for compatibility + */ + CAMERA_CMD_HISTOGRAM_ON = 11, + CAMERA_CMD_HISTOGRAM_OFF = 12, + CAMERA_CMD_HISTOGRAM_SEND_DATA = 13, + CAMERA_CMD_LONGSHOT_ON = 14, + CAMERA_CMD_LONGSHOT_OFF = 15, + CAMERA_CMD_STOP_LONGSHOT = 16, + CAMERA_CMD_METADATA_ON = 100, + CAMERA_CMD_METADATA_OFF = 101, + CAMERA_CMD_SET_VIDEO_FORMAT = 102, +#endif }; /** camera fatal errors */ @@ -284,9 +328,31 @@ typedef struct camera_face { * -2000, -2000 if this is not supported. */ int32_t mouth[2]; + int32_t smile_degree; + int32_t smile_score; + int32_t blink_detected; + int32_t face_recognised; + int32_t gaze_angle; + int32_t updown_dir; + int32_t leftright_dir; + int32_t roll_dir; + int32_t left_right_gaze; + int32_t top_bottom_gaze; + int32_t leye_blink; + int32_t reye_blink; } camera_face_t; +/** + * The information of a data type received in a camera frame. + */ +typedef enum { + /** Data buffer */ + CAMERA_FRAME_DATA_BUF = 0x000, + /** File descriptor */ + CAMERA_FRAME_DATA_FD = 0x100 +} camera_frame_data_type_t; + /** * The metadata of the frame data. */ diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp index 31ca1383e7a2..78fec09e2bb1 100644 --- a/libutils/Threads.cpp +++ b/libutils/Threads.cpp @@ -663,7 +663,10 @@ status_t Thread::readyToRun() status_t Thread::run(const char* name, int32_t priority, size_t stack) { - LOG_ALWAYS_FATAL_IF(name == nullptr, "thread name not provided to Thread::run"); + if (name == nullptr) { + ALOGW("Thread name not provided to Thread::run"); + name = 0; + } Mutex::Autolock _l(mLock); diff --git a/logcat/logcat.cpp b/logcat/logcat.cpp index 15e07feefb95..400635d9be24 100644 --- a/logcat/logcat.cpp +++ b/logcat/logcat.cpp @@ -492,6 +492,7 @@ static void show_help(android_logcat_context_internal* context) { " other pruning activity is oldest first. Special case ~!\n" " represents an automatic quicker pruning for the noisiest\n" " UID as determined by the current statistics.\n" + " -C colored output\n" " -P ' ...', --prune=' ...'\n" " Set prune white and ~black list, using same format as\n" " listed above. Must be quoted.\n" @@ -867,6 +868,7 @@ static int __logcat(android_logcat_context_internal* context) { { "dividers", no_argument, nullptr, 'D' }, { "file", required_argument, nullptr, 'f' }, { "format", required_argument, nullptr, 'v' }, + { "color", no_argument, NULL, 'C' }, // hidden and undocumented reserved alias for --regex { "grep", required_argument, nullptr, 'e' }, // hidden and undocumented reserved alias for --max-count @@ -890,7 +892,7 @@ static int __logcat(android_logcat_context_internal* context) { }; // clang-format on - int c = getopt_long(argc, argv, ":cdDhLt:T:gG:sQf:r:n:v:b:BSpP:m:e:", long_options, + int c = getopt_long(argc, argv, ":cdDhLt:T:gG:sQf:r:n:v:b:BSpCP:m:e:", long_options, &option_index); if (c == -1) break; @@ -1058,6 +1060,10 @@ static int __logcat(android_logcat_context_internal* context) { setPruneList = optarg; break; + case 'C': + setLogFormat(context, "color"); + break; + case 'b': { std::unique_ptr buffers(strdup(optarg), free); char* arg = buffers.get(); diff --git a/mkbootimg/mkbootimg.py b/mkbootimg/mkbootimg.py index 92b11a56d40f..7e556d0c1eca 100644 --- a/mkbootimg/mkbootimg.py +++ b/mkbootimg/mkbootimg.py @@ -79,7 +79,7 @@ def write_header(args): args.base + args.second_offset, # physical load addr args.base + args.tags_offset, # physical addr for kernel tags args.pagesize, # flash page size we assume - args.header_version, # version of bootimage header + max(args.header_version, filesize(args.dt)), # version of bootimage header or dt size in bytes (args.os_version << 11) | args.os_patch_level)) # os version and patch level args.output.write(pack('16s', args.board.encode())) # asciiz product name args.output.write(pack('512s', args.cmdline[:512].encode())) @@ -88,6 +88,7 @@ def write_header(args): update_sha(sha, args.kernel) update_sha(sha, args.ramdisk) update_sha(sha, args.second) + update_sha(sha, args.dt) if args.header_version > 0: update_sha(sha, args.recovery_dtbo) @@ -199,19 +200,26 @@ def parse_cmdline(): parser.add_argument('--board', help='board name', default='', action=ValidateStrLenAction, maxlen=16) parser.add_argument('--pagesize', help='page size', type=parse_int, - choices=[2**i for i in range(11,15)], default=2048) + choices=[2**i for i in range(11,18)], default=2048) parser.add_argument('--id', help='print the image ID on standard output', action='store_true') parser.add_argument('--header_version', help='boot image header version', type=parse_int, default=0) + parser.add_argument('--dt', help='path to the device tree image', type=FileType('rb')) parser.add_argument('-o', '--output', help='output file name', type=FileType('wb'), required=True) - return parser.parse_args() + + args = parser.parse_args() + if args.header_version > 0 and args.dt != None: + raise ValueError('header_version and dt cannot be set at the same time') + + return args def write_data(args): write_padded_file(args.output, args.kernel, args.pagesize) write_padded_file(args.output, args.ramdisk, args.pagesize) write_padded_file(args.output, args.second, args.pagesize) + write_padded_file(args.output, args.dt, args.pagesize) if args.header_version > 0: write_padded_file(args.output, args.recovery_dtbo, args.pagesize) diff --git a/rootdir/init.rc b/rootdir/init.rc index 893998cee967..f2e65fccb459 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -848,3 +848,9 @@ on property:ro.debuggable=1 service flash_recovery /system/bin/install-recovery.sh class main oneshot + disabled + +# update recovery if enabled +on property:persist.sys.recovery_update=true + start flash_recovery +