service storageproxyd_wv_system /system_ext/bin/storageproxyd.system \
        -d VSOCK:${trusty.widevine_vm.vm_cid}:0 \
        -r /dev/socket/rpmb_mock_wv_system \
        -p /data/secure_storage_wv_system \
        -t sock
    disabled
    user system
    group system

service rpmb_mock_init_wv_system /system_ext/bin/rpmb_dev.wv.system \
        --dev /mnt/secure_storage_rpmb_wv_system/persist/RPMB_DATA --init --size 2048
    disabled
    user system
    group system
    oneshot

service rpmb_mock_wv_system /system_ext/bin/rpmb_dev.wv.system \
        --dev /mnt/secure_storage_rpmb_wv_system/persist/RPMB_DATA \
        --sock rpmb_mock_wv_system
    disabled
    user system
    group system
    socket rpmb_mock_wv_system stream 660 system system

# RPMB Mock
on early-boot
    # 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_wv_system 0770 system system
    mkdir /mnt/secure_storage_rpmb_wv_system 0770 system system
    symlink /metadata/secure_storage_rpmb_wv_system \
            /mnt/secure_storage_rpmb_wv_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_wv_system 0770 system system
    mkdir /mnt/secure_storage_persist_wv_system 0770 system system
    symlink /metadata/secure_storage_persist_wv_system \
            /mnt/secure_storage_persist_wv_system/persist
    # file contexts secure_storage_system_file
    mkdir /data/secure_storage_wv_system 0770 root system
    symlink /mnt/secure_storage_persist_wv_system/persist \
            /data/secure_storage_wv_system/persist
    chown root system /data/secure_storage_wv_system/persist
    exec_start rpmb_mock_init_wv_system
    start rpmb_mock_wv_system

on property:sys.boot_completed=1  && \
    property:trusty.widevine_vm.nonsecure_vm_ready=1 && \
    property:trusty.widevine_vm.vm_cid=*
    start storageproxyd_wv_system

