Add LinuxInstallerApp(and Stub)
Bug: 357827587
Bug: 362897977
Test: m && flash, and then setup.sh && m LinuxInstallerApp && adb
install
Change-Id: Ib74debb1f4cf3aaf87fd17f5ff3b6df3c342b54f
diff --git a/android/FerrochromeApp/Android.bp b/android/FerrochromeApp/Android.bp
index 9f0c735..3e4ad14 100644
--- a/android/FerrochromeApp/Android.bp
+++ b/android/FerrochromeApp/Android.bp
@@ -2,17 +2,22 @@
default_applicable_licenses: ["Android-Apache-2.0"],
}
+java_defaults {
+ name: "VmPayloadInstaller",
+ init_rc: [":custom_vm_setup.rc"],
+ required: ["custom_vm_setup"],
+ // TODO(b/348113995): move this app to product partition
+ system_ext_specific: true,
+ platform_apis: true,
+ privileged: true,
+}
+
android_app {
name: "FerrochromeApp",
srcs: ["java/**/*.java"],
resource_dirs: ["res"],
- platform_apis: true,
- // TODO(b/348113995): move this app to product partition
- system_ext_specific: true,
- privileged: true,
- init_rc: ["custom_vm_setup.rc"],
+ defaults: ["VmPayloadInstaller"],
required: [
- "custom_vm_setup",
"privapp-permissions-ferrochrome.xml",
],
}
@@ -24,6 +29,11 @@
system_ext_specific: true,
}
+filegroup {
+ name: "custom_vm_setup.rc",
+ srcs: ["custom_vm_setup.rc"],
+}
+
sh_binary {
name: "custom_vm_setup",
src: "custom_vm_setup.sh",
diff --git a/android/FerrochromeApp/custom_vm_setup.sh b/android/FerrochromeApp/custom_vm_setup.sh
index 4dce0c7..df1a3a6 100644
--- a/android/FerrochromeApp/custom_vm_setup.sh
+++ b/android/FerrochromeApp/custom_vm_setup.sh
@@ -15,12 +15,13 @@
cp -u ${src_dir}/vm_config.json ${dst_dir}
chmod 666 ${dst_dir}/*
- # increase the size of state.img to the multiple of 4096
- num_blocks=$(du -b -K ${dst_dir}state.img | cut -f 1)
- required_num_blocks=$(round_up ${num_blocks} 4)
- additional_blocks=$((( ${required_num_blocks} - ${num_blocks} )))
- dd if=/dev/zero bs=512 count=${additional_blocks} >> ${dst_dir}state.img
-
+ if [ -f ${dst_dir}state.img ]; then
+ # increase the size of state.img to the multiple of 4096
+ num_blocks=$(du -b -K ${dst_dir}state.img | cut -f 1)
+ required_num_blocks=$(round_up ${num_blocks} 4)
+ additional_blocks=$((( ${required_num_blocks} - ${num_blocks} )))
+ dd if=/dev/zero bs=512 count=${additional_blocks} >> ${dst_dir}state.img
+ fi
rm ${src_dir}/images.tar.gz*
rm ${src_dir}/vm_config.json
}