Skip to content

Unexpected com.google.android.gms load in handleLoadPackage even when targeting specific apps #469

@itapi

Description

@itapi

Steps to reproduce/复现步骤

🐞 Unexpected com.google.android.gms load in handleLoadPackage despite module scoping

I’m developing an Xposed/LSPosed module targeting only a few specific apps.
However, in handleLoadPackage, I always see com.google.android.gms being loaded, even though it is not in my module’s target list.

I don’t want to simply filter this package inside handleLoadPackage — that might "work," but it’s not a real solution.
This behavior seems like a possible bug in scope management, and it affects the behavior and performance of my module significantly.


Describe the solution you’d like

It would be helpful if the maintainers could:

  • Confirm whether this behavior is expected or a bug in LSPosed/Xposed scoping.
  • Provide proper documentation or guidance about how scope management works internally.
  • Suggest troubleshooting steps or reference material to help developers debug when non-targeted system packages (like com.google.android.gms) appear unexpectedly.
    code:
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) {
        try {
            XposedBridge.log("ActivitiesHook: Initializing for " + lpparam.packageName);

            // Hook Activity.onCreate
            XposedHelpers.findAndHookMethod(
                    Activity.class,
                    "onCreate",
                    Bundle.class,
                    new XC_MethodHook() {
                        @Override
                        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                            Activity activity = (Activity) param.thisObject;
                            String activityName = activity.getClass().getName();

                            XposedBridge.log("ActivitiesHook: onCreate called for: " + activityName);

                            if (activityName.contains("Ad")) {
                                XposedBridge.log("ActivitiesHook: Finishing ad activity: " + activityName);
                                activity.finish();
                                return;
                            }




                            XposedBridge.log("ActivitiesHook: Activity allowed: " + activityName);
                        }
                    }
            );

            XposedBridge.log("ActivitiesHook: Successfully hooked Activity.onCreate");

        } catch (Throwable e) {
            XposedBridge.log("ActivitiesHook: Error hooking activities: " + e);
        }
    }
}


Additional context

  • My module explicitly checks for target apps using lpparam.packageName.
  • The unexpected load of system packages happens consistently, regardless of the defined scope.
  • This issue impacts modules that rely on precise scoping and can cause unnecessary overhead.

This request follows the troubleshooting guide suggestion for providing reproducible module-scoping issues.

Expected behaviour/预期行为

handleLoadPackage should only be triggered for the packages explicitly included in the module’s scope (as defined in LSPosed Manager).
System apps such as com.google.android.gms should not be passed to the module unless they are intentionally added to the scope.
In other words, the LSPosed scope management should ensure that modules only see and hook the apps they’re scoped to.

Actual behaviour/实际行为

com.google.android.gms being loaded, even though it is not in my module’s target list

Xposed Module List/Xposed 模块列表

MainModule(my module)

Root implementation/Root 方案

Magisk

System Module List/系统模块列表

lsposed only.

LSPosed version/LSPosed 版本

7197

Android version/Android 版本

12

Version requirement/版本要求

Logs/日志

LSPosed_2025-11-09T14_44_36.417.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions