dynsystem: Fix memory leak

Right now the MemoryFile object isn't closed after use, and dangling
file descriptors are leaked into memory each time a MemoryFile object
is created.

Replace android.os.MemoryFile with android.os.SharedMemory and use
try-with-resources to auto manage the opened file descriptors and mapped
memory regions.

Bug: 225310919
Test: Start a DSU installation and check /proc/$pid/maps
Change-Id: I15d9f658c926ef0a46fb558215bfab40f76ddc9a
1 file changed