Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.thepiemonster.hidemocklocation;

import android.content.ContentResolver;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;

Expand Down Expand Up @@ -111,10 +112,15 @@ public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Th
hideMockGooglePlayServicesHook.init(lpparam.processName, lpparam.packageName));

// New way of checking if location is mocked, SDK 18+
// deprecated in API level 31
if (Common.JB_MR2_NEWER)
XposedHelpers.findAndHookMethod("android.location.Location", lpparam.classLoader,
"isFromMockProvider", hideMockProviderHook.init(lpparam.processName, lpparam.packageName));

if (Build.VERSION.SDK_INT >= 31)
XposedHelpers.findAndHookMethod("android.location.Location", lpparam.classLoader,
"isMock", hideMockProviderHook.init(lpparam.processName, lpparam.packageName));

// Self hook - informing Activity that Xposed module is enabled
if(lpparam.packageName.equals(Common.PACKAGE_NAME))
XposedHelpers.findAndHookMethod(Common.ACTIVITY_NAME, lpparam.classLoader, "isModuleEnabled",
Expand Down Expand Up @@ -183,4 +189,4 @@ protected void afterHookedMethod(MethodHookParam param) throws Throwable {
}
};
}
}
}