diff --git a/init-common.rc b/init-common.rc index f10721d..3b6d4a4 100644 --- a/init-common.rc +++ b/init-common.rc @@ -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 diff --git a/recovery/Android.bp b/recovery/Android.bp index fffe848..6eb0788 100644 --- a/recovery/Android.bp +++ b/recovery/Android.bp @@ -27,7 +27,8 @@ cc_library_static { "recovery_ui.cpp", ], - static_libs: [ + whole_static_libs: [ + "libmisc_writer", "libbootloader_message", ], diff --git a/recovery/recovery_ui.cpp b/recovery/recovery_ui.cpp index 0ac214f..6a80151 100644 --- a/recovery/recovery_ui.cpp +++ b/recovery/recovery_ui.cpp @@ -18,18 +18,20 @@ #include #include +#include #include #include +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"; diff --git a/walleye/BoardConfig.mk b/walleye/BoardConfig.mk index cd1e5c2..791b963 100644 --- a/walleye/BoardConfig.mk +++ b/walleye/BoardConfig.mk @@ -38,5 +38,4 @@ BOARD_EXT4_SHARE_DUP_BLOCKS := true TARGET_RECOVERY_UI_LIB := \ librecovery_ui_walleye \ - libbootloader_message \ libfstab