diff --git a/BoardConfig.mk b/BoardConfig.mk index 4662ae1..1a9ba84 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -91,7 +91,6 @@ TARGET_RECOVERY_UI_MARGIN_HEIGHT := 105 TARGET_RECOVERY_UI_LIB := \ librecovery_ui_taimen \ - libbootloader_message \ libfstab # VTS DTBO Verification. This kernel cmdline parameter should be added by the bootloader diff --git a/init-taimen.rc b/init-taimen.rc index 78d48d8..da5ccaf 100644 --- a/init-taimen.rc +++ b/init-taimen.rc @@ -53,15 +53,13 @@ on late-init && property:ro.boot.revision=rev_a on late-init && property:ro.boot.revision=rev_b setprop vendor.thermal.config thermal_info_config_evt.json -# Write the dark theme magic (`theme-dark`, or 0x7468656d652d6461726b in hex string) to /misc -# partition. Offset 0 in vendor space is effectively offset 2048 in /misc partition. -service vendor.theme_set /vendor/bin/misc_writer --vendor-space-offset 0 --hex-string 0x7468656d652d6461726b +# Write the dark theme magic to /misc partition. +service vendor.theme_set /vendor/bin/misc_writer --set-dark-theme 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.theme_clear /vendor/bin/misc_writer --vendor-space-offset 0 --hex-string 0x00000000000000000000 +# Clear the dark theme magic in /misc partition. +service vendor.theme_clear /vendor/bin/misc_writer --clear-dark-theme disabled oneshot diff --git a/recovery/Android.bp b/recovery/Android.bp index 0df54eb..557eb27 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 2998b2a..9d8cf54 100644 --- a/recovery/recovery_ui.cpp +++ b/recovery/recovery_ui.cpp @@ -18,17 +18,18 @@ #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`). - const std::string wipe_str(10, '\x00'); - constexpr size_t kProvisionedFlagOffsetInVendorSpace = 0; - 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()) { + LOG(ERROR) << "Failed to clear the dark theme flag"; return false; } LOG(INFO) << "Provisioned flag wiped successful";