Fix package name "android"

This commit is contained in:
LoveSy 2023-01-11 09:52:37 +08:00 committed by LoveSy
parent 1ef284f287
commit cd88218865
2 changed files with 36 additions and 37 deletions

View File

@ -60,7 +60,7 @@ public abstract class XC_LoadPackage extends XCallback implements IXposedHookLoa
/** /**
* Wraps information about the app being loaded. * Wraps information about the app being loaded.
*/ */
public static final class LoadPackageParam extends XCallback.Param implements XposedModuleInterface.PackageLoadedParam { public static final class LoadPackageParam extends XCallback.Param {
/** /**
* @hide * @hide
*/ */
@ -92,41 +92,6 @@ public abstract class XC_LoadPackage extends XCallback implements IXposedHookLoa
* Set to {@code true} if this is the first (and main) application for this process. * Set to {@code true} if this is the first (and main) application for this process.
*/ */
public boolean isFirstApplication; public boolean isFirstApplication;
@NonNull
@Override
public String getPackageName() {
return packageName;
}
@NonNull
@Override
public ApplicationInfo getAppInfo() {
return appInfo;
}
@NonNull
@Override
public ClassLoader getClassLoader() {
return classLoader;
}
@NonNull
@Override
public String getProcessName() {
return processName;
}
@Override
public boolean isFirstApplication() {
return isFirstApplication;
}
@Nullable
@Override
public Bundle getExtras() {
return null;
}
} }
/** /**

View File

@ -25,6 +25,11 @@ import static org.lsposed.lspd.core.ApplicationServiceClient.serviceClient;
import android.app.ActivityThread; import android.app.ActivityThread;
import android.app.AndroidAppHelper; import android.app.AndroidAppHelper;
import android.app.LoadedApk; import android.app.LoadedApk;
import android.content.pm.ApplicationInfo;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import org.lsposed.lspd.impl.LSPosedContext; import org.lsposed.lspd.impl.LSPosedContext;
import org.lsposed.lspd.util.Hookers; import org.lsposed.lspd.util.Hookers;
@ -93,7 +98,36 @@ public class LoadedApkGetCLHooker extends XC_MethodHook {
Hookers.logD("Call handleLoadedPackage: packageName=" + lpparam.packageName + " processName=" + lpparam.processName + " isFirstApplication=" + isFirstApplication + " classLoader=" + lpparam.classLoader + " appInfo=" + lpparam.appInfo); Hookers.logD("Call handleLoadedPackage: packageName=" + lpparam.packageName + " processName=" + lpparam.processName + " isFirstApplication=" + isFirstApplication + " classLoader=" + lpparam.classLoader + " appInfo=" + lpparam.appInfo);
XC_LoadPackage.callAll(lpparam); XC_LoadPackage.callAll(lpparam);
LSPosedContext.callOnPackageLoaded(lpparam); LSPosedContext.callOnPackageLoaded(new XposedModuleInterface.PackageLoadedParam() {
@NonNull
@Override
public String getPackageName() {
return loadedApk.getPackageName();
}
@NonNull
@Override
public ApplicationInfo getAppInfo() {
return loadedApk.getApplicationInfo();
}
@NonNull
@Override
public ClassLoader getClassLoader() {
return classLoader;
}
@Override
public boolean isFirstApplication() {
return isFirstApplication;
}
@Nullable
@Override
public Bundle getExtras() {
return null;
}
});
} catch (Throwable t) { } catch (Throwable t) {
Hookers.logE("error when hooking LoadedApk#getClassLoader", t); Hookers.logE("error when hooking LoadedApk#getClassLoader", t);
} finally { } finally {