Fix ResourcesProvider being closed

This commit is contained in:
canyie 2023-01-20 13:59:06 +08:00 committed by John Wu
parent 0329f00129
commit 15a7e9af57

View File

@ -178,9 +178,8 @@ public class DownloadActivity extends Activity {
decryptResources(new FileOutputStream(fd)); decryptResources(new FileOutputStream(fd));
Os.lseek(fd, 0, OsConstants.SEEK_SET); Os.lseek(fd, 0, OsConstants.SEEK_SET);
var loader = new ResourcesLoader(); var loader = new ResourcesLoader();
try (var pfd = ParcelFileDescriptor.dup(fd); try (var pfd = ParcelFileDescriptor.dup(fd)) {
var provider = ResourcesProvider.loadFromTable(pfd, null)) { loader.addProvider(ResourcesProvider.loadFromTable(pfd, null));
loader.addProvider(provider);
getResources().addLoaders(loader); getResources().addLoaders(loader);
} }
} finally { } finally {