Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Fix getApplicationInfo on non-primary user (#247)
Browse files Browse the repository at this point in the history
Fix #224
  • Loading branch information
yujincheng08 authored Oct 12, 2023
1 parent 8462043 commit c9c5708
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.os.Build;
import android.os.Process;
import android.os.ServiceManager;
import android.util.JsonReader;
import android.util.Log;
Expand Down Expand Up @@ -70,9 +71,9 @@ 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 = (ApplicationInfo) HiddenApiBypass.invoke(IPackageManager.class, ipm, "getApplicationInfo", Constants.MANAGER_PACKAGE_NAME, 0L, 0);
manager = (ApplicationInfo) HiddenApiBypass.invoke(IPackageManager.class, ipm, "getApplicationInfo", Constants.MANAGER_PACKAGE_NAME, 0L, Process.myPid() / 100000);
} else {
manager = ipm.getApplicationInfo(Constants.MANAGER_PACKAGE_NAME, 0, 0);
manager = ipm.getApplicationInfo(Constants.MANAGER_PACKAGE_NAME, 0, Process.myUid() / 100000);
}
try (var zip = new ZipFile(new File(manager.sourceDir));
var is = zip.getInputStream(zip.getEntry(Constants.LOADER_DEX_ASSET_PATH));
Expand Down

0 comments on commit c9c5708

Please sign in to comment.