Support i18n apex in Microdroid environment
The i18n APEX expects the ANDROID_I18N_ROOT and ANDROID_TZDATA_ROOT
variables to be configured.
The ANDROID_I18N_ROOT should be set to /apex/com.android.i18n, since
this is where i18n libs are located. It is no-op if i18n APEX is not
mounted.
For now the ANDROID_TZDATA_ROOT is set to a non-existent path, since
libicu seem to work correctly without it. We might need to also add
tzdata APEX to support APIS that depend on tzdata.
Bug: 390557313
Test: atest MicrodroidTests
Change-Id: Id89bd26a9bcb7b6d0aa0935171be4a4bdf916a20
diff --git a/build/microdroid/init.rc b/build/microdroid/init.rc
index 672f47d..ce26a35 100644
--- a/build/microdroid/init.rc
+++ b/build/microdroid/init.rc
@@ -35,6 +35,16 @@
# (In Android this happens inside apexd-bootstrap.)
wait_for_prop ro.cold_boot_done true
+ # We need to define ANDROID_TZDATA_ROOT otherwise libicu complains.
+ # For now set it to a non-existent value, because libicu APIs that don't depend on tzdata work
+ # correctly without it.
+ # Once loading tzdata APEX is supported, we can set this value to /apex/com.android.tzdata.
+ # This is no-op for most microdroid VMs, and is only used if com.android.i18n APEX was mounted.
+ export ANDROID_TZDATA_ROOT /does/not/exist
+ # Set ANDROID_I18N_ROOT otherwise libicu will complain.
+ # This is no-op for most microdroid VMs, and is only used if com.android.i18n APEX was mounted.
+ export ANDROID_I18N_ROOT /apex/com.android.i18n
+
on init
mkdir /mnt/apk 0755 root root
mkdir /mnt/extra-apk 0755 root root