Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Hide Mock Location Universal Patch #3389

Closed
3 tasks done
KotlinNight opened this issue Jun 27, 2024 · 7 comments · Fixed by #3417 or #3438
Closed
3 tasks done

feat: Hide Mock Location Universal Patch #3389

KotlinNight opened this issue Jun 27, 2024 · 7 comments · Fixed by #3417 or #3438
Labels
Feature request Requesting a new feature that's not implemented yet

Comments

@KotlinNight
Copy link

Feature description

A universal patch to hide mock location. In Android the user can set the gps location by using "mock locations". However, an App can check if this is the real location or not by checking isMock() (API >= 31) or isFromMockProvider (API < 31). This behavior could be change by making these functions always return false.

Motivation

This feature could let the user change gps location in apps that don't allow it. It could also enhance user privacy, by letting the user set a random location as the "real" location. In some cases it could also help circumvent geo filtering.

Acknowledgements

  • I have checked all open and closed feature requests and this is not a duplicate
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@KotlinNight KotlinNight added the Feature request Requesting a new feature that's not implemented yet label Jun 27, 2024
@epireyn
Copy link
Contributor

epireyn commented Jul 2, 2024

Hello!

Thank you for your request. Would you have any app to test the patch?

Thank you.

@KotlinNight
Copy link
Author

Hello!

Thank you for your request. Would you have any app to test the patch?

Thank you.

@epireyn

Yes here's a quick and easy app to test it with without creating any accounts. I have checked the behaviour of the app is as expected, it can detect mock/no mock accurately.

https://apkpure.com/mock-location-root-detector/com.check.mock/download

@epireyn
Copy link
Contributor

epireyn commented Jul 6, 2024

Thank you for your answer.

Unfortunately, it confirms what I thought: the method is inside the core library of android, and therefore not compiled with the app (it is shared by all apps and integrated to the OS). The only solution I see would be to recompile the whole lib (and therefore the OS), which is not possible with Revanced.

Since I started retro-engineering android a couple weeks ago, I keep this issue open until someone more experienced can confirm or deny my statement.

@oSumAtrIX
Copy link
Member

oSumAtrIX commented Jul 6, 2024

Can you please explain why it would not be possible? The API may be in the OS but the return value can be changed.

@epireyn
Copy link
Contributor

epireyn commented Jul 6, 2024

The returned value can be changed, but it would be app-specific, and not universal. Since the package android.location is not implemented inside the app(s) package, but is a compile only dependency (unless I'm wrong), Revanced should parse the dependency, which seems to be part of Android OS.

A solution would be to hook the method during runtime, but it isn't what Revanced is made for.

@oSumAtrIX
Copy link
Member

You can filter for all references to that API and spoof the call's return value. Besides, if your initial assumption was that the code would be in the app itself, it would be even less possible to create a universal patch. Refer to https://github.com/ReVanced/revanced-patches/blob/main/src/main/kotlin/app/revanced/patches/all/connectivity/wifi/spoof/SpoofWifiPatch.kt for an example on how to spoof the return value of an API call part of the OS.

Hooking at runtime is possible via ReVanced.

epireyn added a commit to epireyn/revanced-patches that referenced this issue Jul 6, 2024
@epireyn
Copy link
Contributor

epireyn commented Jul 6, 2024

Thank for that precious information. I still have a great deal to learn!
I made two PR, one on integrations and the other here.

@oSumAtrIX oSumAtrIX linked a pull request Jul 6, 2024 that will close this issue
@LisoUseInAIKyrios LisoUseInAIKyrios linked a pull request Jul 24, 2024 that will close this issue
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Requesting a new feature that's not implemented yet
Projects
None yet
3 participants