Skip to content

Commit adb6317

Browse files
committed
Fix some reflection errors
1 parent d9e9a25 commit adb6317

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

app/src/main/java/dev/zwander/installwithoptions/util/InternalInstaller.kt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import android.os.UserHandle
1616
import android.util.Log
1717
import dev.zwander.installwithoptions.BuildConfig
1818
import dev.zwander.installwithoptions.IOptionsApplier
19-
import rikka.shizuku.ShizukuSystemProperties
2019
import rikka.shizuku.SystemServiceHelper
2120
import java.io.OutputStream
2221
import kotlin.random.Random
@@ -91,7 +90,7 @@ class InternalInstaller(private val context: Context) {
9190
myUserId(),
9291
) as Int
9392
}
94-
val session = packageInstaller::class.java.getMethod("openSession")
93+
val session = packageInstaller::class.java.getMethod("openSession", Int::class.java)
9594
.invoke(packageInstaller, sessionId) as Any
9695

9796
try {
@@ -115,7 +114,10 @@ class InternalInstaller(private val context: Context) {
115114
0,
116115
fd.length,
117116
) as ParcelFileDescriptor?)?.run {
118-
if (ShizukuSystemProperties.getBoolean("fw.revocable_fd", false)) {
117+
if (Class.forName("android.os.SystemProperties")
118+
.getMethod("getBoolean", String::class.java, Boolean::class.java)
119+
.invoke(null, "fw.revocable_fd", false) as Boolean
120+
) {
119121
ParcelFileDescriptor.AutoCloseOutputStream(this)
120122
} else {
121123
Class.forName("android.os.FileBridge\$FileBridgeOutputStream")
@@ -131,8 +133,11 @@ class InternalInstaller(private val context: Context) {
131133
}
132134
}
133135

134-
session::class.java.getMethod("commit", IntentSender::class.java, Boolean::class.java)
135-
.invoke(session, statusIntent.intentSender, false)
136+
session::class.java.getMethod(
137+
"commit",
138+
IntentSender::class.java,
139+
Boolean::class.java
140+
).invoke(session, statusIntent.intentSender, false)
136141
} catch (e: Throwable) {
137142
Log.e("InstallWithOptions", "error", e)
138143
session::class.java.getMethod("abandon").invoke(session)

0 commit comments

Comments
 (0)