service trusty_test_vm /apex/com.android.virt/bin/vm run \
    /data/local/tmp/TrustyTestVM_UnitTests/trusty-test_vm-config.json
    disabled
    user system
    group system

service storageproxyd_test_system /system_ext/bin/storageproxyd.system \
        -d VSOCK:${trusty.test_vm.vm_cid}:1 \
        -r /dev/socket/rpmb_mock_test_system \
        -p /data/secure_storage_test_system \
        -t sock
    disabled
    class hal
    user system
    group system

service rpmb_mock_init_test_system /system_ext/bin/rpmb_dev.test.system \
        --dev /mnt/secure_storage_rpmb_test_system/persist/RPMB_DATA --init --size 2048
    disabled
    user system
    group system
    oneshot

service rpmb_mock_test_system /system_ext/bin/rpmb_dev.test.system \
        --dev /mnt/secure_storage_rpmb_test_system/persist/RPMB_DATA \
        --sock rpmb_mock_test_system
    disabled
    user system
    group system
    socket rpmb_mock_test_system stream 660 system system

# RPMB Mock
on post-fs-data
    # Create a persistent location for the RPMB data
    # (work around lack of RPMb block device on CF).
    # file contexts secure_storage_rpmb_system_file
    # (only used on Cuttlefish as this is non secure)
    mkdir /metadata/secure_storage_rpmb_test_system 0770 system system
    mkdir /mnt/secure_storage_rpmb_test_system 0770 system system
    symlink /metadata/secure_storage_rpmb_test_system \
            /mnt/secure_storage_rpmb_test_system/persist
    # Create a system persist directory in /metadata
    # (work around lack of dedicated system persist partition).
    # file contexts secure_storage_persist_system_file
    mkdir /metadata/secure_storage_persist_test_system 0770 system system
    mkdir /mnt/secure_storage_persist_test_system 0770 system system
    symlink /metadata/secure_storage_persist_test_system \
            /mnt/secure_storage_persist_test_system/persist
    # file contexts secure_storage_system_file
    mkdir /data/secure_storage_test_system 0770 root system
    symlink /mnt/secure_storage_persist_test_system/persist \
            /data/secure_storage_test_system/persist
    chown root system /data/secure_storage_test_system/persist
    # setprop storageproxyd_test_system.trusty_ipc_dev VSOCK:${trusty.test_vm.vm_cid}:1
    exec_start rpmb_mock_init_test_system
    start rpmb_mock_test_system
