summaryrefslogtreecommitdiff
path: root/init.hardware.rc
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-05-28 10:09:39 -0700
committerTao Bao <tbao@google.com>2019-06-19 15:59:22 +0000
commitd99e3508122b7e48e91c80464ce9b589688d788f (patch)
tree9dbd6691c41558fc33af4f2d8845a4798ddb1d7a /init.hardware.rc
parentce819d1ecdb964a6ea18fad8d18743e1ec333088 (diff)
downloadbonito-d99e3508122b7e48e91c80464ce9b589688d788f.tar.gz
Dark boot on dark theme.
Bug: 113028175 Fixes: 135196332 Test: Build and flash bonito with the matching bootloader change. Check serial log regarding the start of theme_set and theme_clear services. Also read the value via `dd bs=1 skip=2048 if=/dev/block/mmcblk0p49 count=32 | xxd` to confirm the change. Test: Trigger a factory reset via Settings. Check the value in /misc after the reset. Change-Id: Id7500f84c94ad4a5362922650abce1521e925972
Diffstat (limited to 'init.hardware.rc')
-rw-r--r--init.hardware.rc24
1 files changed, 24 insertions, 0 deletions
diff --git a/init.hardware.rc b/init.hardware.rc
index 6139b4bc..6684d862 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -893,3 +893,27 @@ on property:sys.boot_completed=1
on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
start init-fingerprint-sh
+
+# 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
+ 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
+ disabled
+ oneshot
+
+# Set dark boot flag on dark mode (UiModeManager.MODE_NIGHT_YES == 2).
+on property:persist.sys.theme=2
+ start vendor.theme_set
+
+# Clear the dark boot flag on light mode (UiModeManager.MODE_NIGHT_NO == 1) or auto mode
+# (UiModeManager.MODE_NIGHT_AUTO == 0).
+on property:persist.sys.theme=1
+ start vendor.theme_clear
+
+on property:persist.sys.theme=0
+ start vendor.theme_clear