Use more specific option to set dark mode am: fd8e984334 am: 018b2075cb

am: bac448e58e

Change-Id: I7707d64dd11a3d346be0a8a3028e93b0d861fd36
This commit is contained in:
Tianjie Xu
2019-11-13 14:41:51 -08:00
committed by android-build-merger
4 changed files with 15 additions and 15 deletions

View File

@@ -49,16 +49,14 @@ on property:persist.vendor.charge.stop.level=* && property:sys.all.modules.ready
on property:persist.vendor.charge.start.level=* && property:sys.all.modules.ready=1
write /sys/module/htc_battery/parameters/charge_start_level ${persist.vendor.charge.start.level}
# Write the dark theme magic (`theme-dark`, or 0x7468656d652d6461726b in hex string) to /misc
# partition. Offset 12360 (0x3048) in vendor space is effectively offset 14408 (0x3848) in /misc
# partition.
service vendor.darkboot /vendor/bin/misc_writer --vendor-space-offset 12360 --hex-string 0x7468656d652d6461726b
# Write the dark theme magic to /misc partition. Offset 12360 (0x3048) in vendor space is
# effectively offset 14408 (0x3848) in /misc partition.
service vendor.darkboot /vendor/bin/misc_writer --set-dark-theme --override-vendor-space-offset 12360
disabled
oneshot
# Clear the 10-byte dark theme magic in /misc partition. Offset 0 in vendor space is effectively
# offset 2048 in /misc partition.
service vendor.darkboot_clear /vendor/bin/misc_writer --vendor-space-offset 12360 --hex-string 0x00000000000000000000
# Clear the dark theme magic in /misc partition.
service vendor.darkboot_clear --clear-dark-theme --override-vendor-space-offset 12360
disabled
oneshot

View File

@@ -27,7 +27,8 @@ cc_library_static {
"recovery_ui.cpp",
],
static_libs: [
whole_static_libs: [
"libmisc_writer",
"libbootloader_message",
],

View File

@@ -18,18 +18,20 @@
#include <android-base/logging.h>
#include <bootloader_message/bootloader_message.h>
#include <misc_writer/misc_writer.h>
#include <recovery_ui/device.h>
#include <recovery_ui/screen_ui.h>
using android::hardware::google::pixel::MiscWriter;
using android::hardware::google::pixel::MiscWriterActions;
// Wipes the provisioned flag as part of data wipe.
static bool WipeProvisionedFlag() {
// Must be consistent with the one in init.hardware.rc (10-byte `theme-dark`). The magic is at
// 0x3048 in vendor space, or (0x800 + 0x3048) since the start of /misc.
const std::string wipe_str(10, '\x00');
// The magic is at 0x3048 in vendor space, or (0x800 + 0x3048) since the start of /misc.
constexpr size_t kProvisionedFlagOffsetInVendorSpace = 0x3048;
if (std::string err; !WriteMiscPartitionVendorSpace(
wipe_str.data(), wipe_str.size(), kProvisionedFlagOffsetInVendorSpace, &err)) {
LOG(ERROR) << "Failed to write wipe string: " << err;
MiscWriter misc_writer(MiscWriterActions::kClearDarkThemeFlag);
if (!misc_writer.PerformAction(kProvisionedFlagOffsetInVendorSpace)) {
LOG(ERROR) << "Failed to clear the dark theme flag";
return false;
}
LOG(INFO) << "Provisioned flag wiped successful";

View File

@@ -38,5 +38,4 @@ BOARD_EXT4_SHARE_DUP_BLOCKS := true
TARGET_RECOVERY_UI_LIB := \
librecovery_ui_walleye \
libbootloader_message \
libfstab