Further fix for Android 13

This commit is contained in:
Nullptr 2022-10-24 00:41:32 +08:00
parent f6c09a0ba0
commit 0bc6407caf
No known key found for this signature in database
2 changed files with 3 additions and 1 deletions

View File

@ -42,4 +42,5 @@ androidComponents.onVariants { variant ->
dependencies {
compileOnly(projects.hiddenapi.stubs)
implementation(projects.share.java)
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.3")
}

View File

@ -9,6 +9,7 @@ import android.os.ServiceManager;
import android.util.JsonReader;
import android.util.Log;
import org.lsposed.hiddenapibypass.HiddenApiBypass;
import org.lsposed.lspatch.share.Constants;
import java.io.ByteArrayOutputStream;
@ -68,7 +69,7 @@ public class LSPAppComponentFactoryStub extends AppComponentFactory {
var ipm = IPackageManager.Stub.asInterface(ServiceManager.getService("package"));
ApplicationInfo manager;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
manager = ipm.getApplicationInfo(Constants.MANAGER_PACKAGE_NAME, 0L, 0);
manager = (ApplicationInfo) HiddenApiBypass.invoke(IPackageManager.class, ipm, "getApplicationInfo", Constants.MANAGER_PACKAGE_NAME, 0L, 0);
} else {
manager = ipm.getApplicationInfo(Constants.MANAGER_PACKAGE_NAME, 0, 0);
}