UpdateInstaller: Set file permissions on uncrypt ota package

-----

E RecoverySystemService: Failed to reserve space for compressed apex:
E RecoverySystemService: java.io.FileNotFoundException: /data/lineageos_updates/lineage-19.1-20220422-UNOFFICIAL-GMS-sagit.zip.uncrypt (Permission denied)
E RecoverySystemService: 	at java.util.zip.ZipFile.open(Native Method)
E RecoverySystemService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:265)
E RecoverySystemService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:187)
E RecoverySystemService: 	at java.util.zip.ZipFile.<init>(ZipFile.java:158)
E RecoverySystemService: 	at com.android.server.recoverysystem.RecoverySystemService.getCompressedApexInfoList(RecoverySystemService.java:921)
E RecoverySystemService: 	at com.android.server.recoverysystem.RecoverySystemService.allocateSpaceForUpdate(RecoverySystemService.java:972)
E RecoverySystemService: 	at android.os.IRecoverySystem$Stub.onTransact(IRecoverySystem.java:156)
E RecoverySystemService: 	at android.os.Binder.execTransactInternal(Binder.java:1179)
E RecoverySystemService: 	at android.os.Binder.execTransact(Binder.java:1143)
E UpdateInstaller: Could not install update
E UpdateInstaller: java.io.IOException: Failed to allocate space for update /data/lineageos_updates/lineage-19.1-20220422-UNOFFICIAL-GMS-sagit.zip.uncrypt
E UpdateInstaller: 	at android.os.RecoverySystem.installPackage(RecoverySystem.java:678)
E UpdateInstaller: 	at android.os.RecoverySystem.installPackage(RecoverySystem.java:596)
E UpdateInstaller: 	at org.lineageos.updater.controller.UpdateInstaller.installPackage(UpdateInstaller.java:100)
E UpdateInstaller: 	at org.lineageos.updater.controller.UpdateInstaller.access$400(UpdateInstaller.java:35)
E UpdateInstaller: 	at org.lineageos.updater.controller.UpdateInstaller$1.run(UpdateInstaller.java:144)
E UpdateInstaller: 	at java.lang.Thread.run(Thread.java:920)

Change-Id: I8250bf58709b92572cdffc8e5faca4bf243935aa
diff --git a/src/org/lineageos/updater/controller/UpdateInstaller.java b/src/org/lineageos/updater/controller/UpdateInstaller.java
index 9735429..b111f9f 100644
--- a/src/org/lineageos/updater/controller/UpdateInstaller.java
+++ b/src/org/lineageos/updater/controller/UpdateInstaller.java
@@ -31,6 +31,10 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.attribute.PosixFilePermission;
+import java.nio.file.Files;
+import java.util.HashSet;
+import java.util.Set;
 
 class UpdateInstaller {
 
@@ -131,6 +135,15 @@
                 try {
                     mCanCancel = true;
                     FileUtils.copyFile(update.getFile(), uncryptFile, mProgressCallBack);
+                    try {
+                        Set<PosixFilePermission> perms = new HashSet<>();
+                        perms.add(PosixFilePermission.OWNER_READ);
+                        perms.add(PosixFilePermission.OWNER_WRITE);
+                        perms.add(PosixFilePermission.OTHERS_READ);
+                        perms.add(PosixFilePermission.GROUP_READ);
+                        Files.setPosixFilePermissions(uncryptFile.toPath(), perms);
+                    } catch (IOException exception) {}
+
                     mCanCancel = false;
                     if (mPrepareUpdateThread.isInterrupted()) {
                         mUpdaterController.getActualUpdate(update.getDownloadId())